/[svn]/qsampler/trunk/src/qsamplerOptionsForm.cpp
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerOptionsForm.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1474 by schoenebeck, Mon Nov 5 20:47:38 2007 UTC revision 1504 by capela, Wed Nov 21 11:46:40 2007 UTC
# Line 28  Line 28 
28  #include <QMessageBox>  #include <QMessageBox>
29  #include <QFontDialog>  #include <QFontDialog>
30    
31    
32  namespace QSampler {  namespace QSampler {
33    
34  OptionsForm::OptionsForm(QWidget* parent) : QDialog(parent)  OptionsForm::OptionsForm(QWidget* parent) : QDialog(parent)
# Line 48  OptionsForm::OptionsForm(QWidget* parent Line 49  OptionsForm::OptionsForm(QWidget* parent
49          adjustSize();          adjustSize();
50    
51          QObject::connect(ui.ServerHostComboBox,          QObject::connect(ui.ServerHostComboBox,
52                  SIGNAL(textChanged(const QString&)),                  SIGNAL(editTextChanged(const QString&)),
53                  SLOT(optionsChanged()));                  SLOT(optionsChanged()));
54          QObject::connect(ui.ServerPortComboBox,          QObject::connect(ui.ServerPortComboBox,
55                  SIGNAL(textChanged(const QString&)),                  SIGNAL(editTextChanged(const QString&)),
56                  SLOT(optionsChanged()));                  SLOT(optionsChanged()));
57          QObject::connect(ui.ServerTimeoutSpinBox,          QObject::connect(ui.ServerTimeoutSpinBox,
58                  SIGNAL(valueChanged(int)),                  SIGNAL(valueChanged(int)),
# Line 60  OptionsForm::OptionsForm(QWidget* parent Line 61  OptionsForm::OptionsForm(QWidget* parent
61                  SIGNAL(stateChanged(int)),                  SIGNAL(stateChanged(int)),
62                  SLOT(optionsChanged()));                  SLOT(optionsChanged()));
63          QObject::connect(ui.ServerCmdLineComboBox,          QObject::connect(ui.ServerCmdLineComboBox,
64                  SIGNAL(textChanged(const QString&)),                  SIGNAL(editTextChanged(const QString&)),
65                  SLOT(optionsChanged()));                  SLOT(optionsChanged()));
66          QObject::connect(ui.StartDelaySpinBox,          QObject::connect(ui.StartDelaySpinBox,
67                  SIGNAL(valueChanged(int)),                  SIGNAL(valueChanged(int)),
# Line 136  void OptionsForm::setup ( qsamplerOption Line 137  void OptionsForm::setup ( qsamplerOption
137      m_pOptions->loadComboBoxHistory(ui.ServerCmdLineComboBox);      m_pOptions->loadComboBoxHistory(ui.ServerCmdLineComboBox);
138    
139      // Load Server settings...      // Load Server settings...
140      ui.ServerHostComboBox->setCurrentText(m_pOptions->sServerHost);          ui.ServerHostComboBox->setItemText(
141      ui.ServerPortComboBox->setCurrentText(QString::number(m_pOptions->iServerPort));                  ui.ServerHostComboBox->currentIndex(),
142                    m_pOptions->sServerHost);
143            ui.ServerPortComboBox->setItemText(
144                    ui.ServerPortComboBox->currentIndex(),
145                    QString::number(m_pOptions->iServerPort));
146      ui.ServerTimeoutSpinBox->setValue(m_pOptions->iServerTimeout);      ui.ServerTimeoutSpinBox->setValue(m_pOptions->iServerTimeout);
147      ui.ServerStartCheckBox->setChecked(m_pOptions->bServerStart);      ui.ServerStartCheckBox->setChecked(m_pOptions->bServerStart);
148      ui.ServerCmdLineComboBox->setCurrentText(m_pOptions->sServerCmdLine);          ui.ServerCmdLineComboBox->setItemText(
149                    ui.ServerCmdLineComboBox->currentIndex(),
150                    m_pOptions->sServerCmdLine);
151      ui.StartDelaySpinBox->setValue(m_pOptions->iStartDelay);      ui.StartDelaySpinBox->setValue(m_pOptions->iStartDelay);
152    
153      // Load Display options...      // Load Display options...
154      QFont font;      QFont font;
155            QPalette pal;
156    
157      // Display font.      // Display font.
158      if (m_pOptions->sDisplayFont.isEmpty() || !font.fromString(m_pOptions->sDisplayFont))      if (m_pOptions->sDisplayFont.isEmpty() || !font.fromString(m_pOptions->sDisplayFont))
# Line 164  void OptionsForm::setup ( qsamplerOption Line 172  void OptionsForm::setup ( qsamplerOption
172      // Messages font.      // Messages font.
173      if (m_pOptions->sMessagesFont.isEmpty() || !font.fromString(m_pOptions->sMessagesFont))      if (m_pOptions->sMessagesFont.isEmpty() || !font.fromString(m_pOptions->sMessagesFont))
174          font = QFont("Fixed", 8);          font = QFont("Fixed", 8);
175            pal = ui.MessagesFontTextLabel->palette();
176            pal.setColor(QPalette::Background, Qt::white);
177            ui.MessagesFontTextLabel->setPalette(pal);
178      ui.MessagesFontTextLabel->setFont(font);      ui.MessagesFontTextLabel->setFont(font);
179      ui.MessagesFontTextLabel->setText(font.family() + " " + QString::number(font.pointSize()));      ui.MessagesFontTextLabel->setText(font.family() + ' ' + QString::number(font.pointSize()));
180    
181      // Messages limit option.      // Messages limit option.
182      ui.MessagesLimitCheckBox->setChecked(m_pOptions->bMessagesLimit);      ui.MessagesLimitCheckBox->setChecked(m_pOptions->bMessagesLimit);
# Line 195  void OptionsForm::accept (void) Line 206  void OptionsForm::accept (void)
206      // Save options...      // Save options...
207      if (m_iDirtyCount > 0) {      if (m_iDirtyCount > 0) {
208          // Server settings....          // Server settings....
209          m_pOptions->sServerHost         = ui.ServerHostComboBox->currentText().stripWhiteSpace();          m_pOptions->sServerHost         = ui.ServerHostComboBox->currentText().trimmed();
210          m_pOptions->iServerPort         = ui.ServerPortComboBox->currentText().toInt();          m_pOptions->iServerPort         = ui.ServerPortComboBox->currentText().toInt();
211          m_pOptions->iServerTimeout      = ui.ServerTimeoutSpinBox->value();          m_pOptions->iServerTimeout      = ui.ServerTimeoutSpinBox->value();
212          m_pOptions->bServerStart        = ui.ServerStartCheckBox->isChecked();          m_pOptions->bServerStart        = ui.ServerStartCheckBox->isChecked();
213          m_pOptions->sServerCmdLine      = ui.ServerCmdLineComboBox->currentText().stripWhiteSpace();          m_pOptions->sServerCmdLine      = ui.ServerCmdLineComboBox->currentText().trimmed();
214          m_pOptions->iStartDelay         = ui.StartDelaySpinBox->value();          m_pOptions->iStartDelay         = ui.StartDelaySpinBox->value();
215          // Channels options...          // Channels options...
216          m_pOptions->sDisplayFont        = ui.DisplayFontTextLabel->font().toString();          m_pOptions->sDisplayFont        = ui.DisplayFontTextLabel->font().toString();
# Line 315  void OptionsForm::chooseMessagesFont (vo Line 326  void OptionsForm::chooseMessagesFont (vo
326  // The channel display effect demo changer.  // The channel display effect demo changer.
327  void OptionsForm::toggleDisplayEffect ( bool bOn )  void OptionsForm::toggleDisplayEffect ( bool bOn )
328  {  {
329      QPixmap pm;          QPalette pal;
330      if (bOn)          pal.setColor(QPalette::Foreground, Qt::green);
331          pm = QPixmap(":/qsampler/pixmaps/displaybg1.png");          if (bOn) {
332      ui.DisplayFontTextLabel->setPaletteBackgroundPixmap(pm);                  QPixmap pm(":/icons/displaybg1.png");
333                    pal.setBrush(QPalette::Background, QBrush(pm));
334            } else {
335                    pal.setColor(QPalette::Background, Qt::black);
336            }
337            ui.DisplayFontTextLabel->setPalette(pal);
338    
339      optionsChanged();          optionsChanged();
340  }  }
341    
342  } // namespace QSampler  } // namespace QSampler

Legend:
Removed from v.1474  
changed lines
  Added in v.1504

  ViewVC Help
Powered by ViewVC