~ubuntu-branches/ubuntu/jaunty/quassel/jaunty

« back to all changes in this revision

Viewing changes to src/qtui/settingspages/fontssettingspage.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Harald Sitter
  • Date: 2008-11-17 15:22:46 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20081117152246-3lwlpnr4r08910kv
Tags: 0.3.1-0ubuntu1
* New upstream release (LP: #271403)
* Drop all patches originated from upstream (quassel_*)
* Compile with non-builtin quassel icons
  + Introduce new quassel-data package
  + quassel and quassel-client depend on quassel-data
  + Don't manually enforce icon installation for desktop files in debian/rules
  + Add quassel_01_fix_iconloader.patch
* Drop perl build dependency, I have no clue why it was added in the first
  place. Neither changelog nor Bazaar knows, and since quassel compiles just
  fine without it, removing it should be save.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
#include "qtui.h"
24
24
#include "qtuisettings.h"
 
25
#include "qtuistyle.h"
25
26
 
26
27
#include <QFontDialog>
27
28
 
49
50
  mapper->setMapping(ui.chooseTimestamp, ui.demoTimestamp);
50
51
 
51
52
  connect(mapper, SIGNAL(mapped(QWidget *)), this, SLOT(chooseFont(QWidget *)));
52
 
  
 
53
 
53
54
  //connect(ui.customAppFonts, SIGNAL(clicked()), this, SLOT(widgetHasChanged()));
54
55
  connect(ui.checkTopic, SIGNAL(clicked()), this, SLOT(widgetHasChanged()));
55
56
  connect(ui.checkBufferView, SIGNAL(clicked()), this, SLOT(widgetHasChanged()));
87
88
    inputLineFont = qApp->font();
88
89
  }
89
90
  initLabel(ui.demoInputLine, inputLineFont);
90
 
  
 
91
 
91
92
  QTextCharFormat chatFormat = QtUi::style()->format(UiStyle::None, mode);
92
93
  initLabel(ui.demoChatMessages, chatFormat.font());
93
94
  QTextCharFormat nicksFormat = QtUi::style()->format(UiStyle::Sender, mode);
98
99
    initLabel(ui.demoNicks, chatFormat.font());
99
100
    ui.checkNicks->setChecked(false);
100
101
  }
 
102
 
101
103
  QTextCharFormat timestampFormat = QtUi::style()->format(UiStyle::Timestamp, mode);
102
104
  if(timestampFormat.hasProperty(QTextFormat::FontFamily)) {
103
105
    initLabel(ui.demoTimestamp, timestampFormat.font());
114
116
  QtUiSettings s;
115
117
  s.setValue("UseInputLineFont", (ui.checkInputLine->checkState() == Qt::Checked));
116
118
  s.setValue("InputLineFont", ui.demoInputLine->font());
117
 
  
 
119
 
118
120
  QTextCharFormat chatFormat = QtUi::style()->format(UiStyle::None);
119
121
  chatFormat.setFont(ui.demoChatMessages->font());
120
122
  QtUi::style()->setFormat(UiStyle::None, chatFormat, Settings::Custom);
121
123
 
122
 
  //FIXME: actually remove font properties from the formats
123
124
  QTextCharFormat nicksFormat = QtUi::style()->format(UiStyle::Sender);
124
 
  if(ui.checkNicks->checkState() == Qt::Checked) nicksFormat.setFont(ui.demoNicks->font());
125
 
  else nicksFormat.setFont(chatFormat.font());
 
125
  if(ui.checkNicks->checkState() == Qt::Checked)
 
126
    nicksFormat.setFont(ui.demoNicks->font());
 
127
  else
 
128
    clearFontFromFormat(nicksFormat);
126
129
  QtUi::style()->setFormat(UiStyle::Sender, nicksFormat, Settings::Custom);
127
130
 
128
131
  QTextCharFormat timestampFormat = QtUi::style()->format(UiStyle::Timestamp);
129
 
  if(ui.checkTimestamp->checkState() == Qt::Checked) timestampFormat.setFont(ui.demoTimestamp->font());
130
 
  else timestampFormat.setFont(chatFormat.font());
 
132
  if(ui.checkTimestamp->checkState() == Qt::Checked)
 
133
    timestampFormat.setFont(ui.demoTimestamp->font());
 
134
  else
 
135
    clearFontFromFormat(timestampFormat);
131
136
  QtUi::style()->setFormat(UiStyle::Timestamp, timestampFormat, Settings::Custom);
132
137
 
133
138
  setChangedState(false);
156
161
    setFont(label, font);
157
162
  }
158
163
}
 
164
 
 
165
void FontsSettingsPage::clearFontFromFormat(QTextCharFormat &fmt) {
 
166
  fmt.clearProperty(QTextFormat::FontFamily);
 
167
  fmt.clearProperty(QTextFormat::FontPointSize);
 
168
  fmt.clearProperty(QTextFormat::FontPixelSize);
 
169
  fmt.clearProperty(QTextFormat::FontWeight);
 
170
  fmt.clearProperty(QTextFormat::FontItalic);
 
171
  fmt.clearProperty(QTextFormat::TextUnderlineStyle);
 
172
  fmt.clearProperty(QTextFormat::FontOverline);
 
173
  fmt.clearProperty(QTextFormat::FontStrikeOut);
 
174
  fmt.clearProperty(QTextFormat::FontFixedPitch);
 
175
  fmt.clearProperty(QTextFormat::FontCapitalization);
 
176
  fmt.clearProperty(QTextFormat::FontWordSpacing);
 
177
  fmt.clearProperty(QTextFormat::FontLetterSpacing);
 
178
}