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) |
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)), |
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)), |
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)) |
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); |
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(); |
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 |