Checking in WiP on the MessageModel. More cleanly separated code and compiling of...
[quassel.git] / src / uisupport / uistyle.cpp
index 0420a7c..94c9742 100644 (file)
@@ -17,6 +17,7 @@
  *   Free Software Foundation, Inc.,                                       *
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
+#include <QApplication>
 
 #include "uistyle.h"
 #include "uistylesettings.h"
@@ -25,7 +26,8 @@ UiStyle::UiStyle(const QString &settingsKey) : _settingsKey(settingsKey) {
   // Default format
   QTextCharFormat def;
   def.setForeground(QBrush("#000000"));
-  //def.setFont(QFont("Courier", 10));
+  def.setFont(QFont("Monospace", QApplication::font().pointSize()));
+  def.font().setFixedPitch(true);
   def.font().setStyleHint(QFont::TypeWriter);
   _defaultFormats = QVector<QTextCharFormat>(NumFormatTypes, def);
   _customFormats = QVector<QTextCharFormat>(NumFormatTypes, QTextFormat().toCharFormat());
@@ -129,14 +131,8 @@ QString UiStyle::formatCode(FormatType ftype) const {
   return _formatCodes.key(ftype);
 }
 
-UiStyle::StyledText UiStyle::styleString(QString s) {
-  // FIXME
-  // The following two lines fix garbled fonts for me. I have no effing clue how or why.
-  // Without comparing s to something (anything), invalid formats with negative lengths are created...
-  // This smells like a gcc/Qt error or something, but maybe it's my fault somehow.
-  bool flg = (s == "foo");
-  Q_UNUSED(flg);
-
+UiStyle::StyledText UiStyle::styleString(const QString &_s) {
+  QString s = _s;
   StyledText result;
   QList<FormatType> fmtList;
   fmtList.append(None);
@@ -244,5 +240,3 @@ QTextCharFormat UiStyle::mergedFormat(QList<FormatType> formatList) {
   }
   return fmt;
 }
-
-