UserVolumeDlg::UserVolumeDlg(int userid, QWidget * parent/* = 0*/) : QDialog(parent, QT_DEFAULT_DIALOG_HINTS) , m_userid(userid) { ui.setupUi(this); setWindowIcon(QIcon(APPICON)); ui.voicevolSlider->setRange(0, 100); ui.mfvolSlider->setRange(0, 100); connect(ui.voicevolSlider, SIGNAL(valueChanged(int)), SLOT(slotVolumeChanged(int))); connect(ui.voiceleftChkBox, SIGNAL(clicked()), SLOT(slotMuteChannel())); connect(ui.voicerightChkBox, SIGNAL(clicked()), SLOT(slotMuteChannel())); connect(ui.mfvolSlider, SIGNAL(valueChanged(int)), SLOT(slotVolumeChanged(int))); connect(ui.mfleftChkBox, SIGNAL(clicked()), SLOT(slotMuteChannel())); connect(ui.mfrightChkBox, SIGNAL(clicked()), SLOT(slotMuteChannel())); connect(ui.defaultsButton, SIGNAL(clicked()), SLOT(slotDefaults())); User user; if(TT_GetUser(ttInst, m_userid, &user)) setWindowTitle(windowTitle() + QString(" - ") + _Q(user.szNickname)); ui.voicevolSlider->setValue(refVolumeToPercent(user.nVolumeVoice)); ui.mfvolSlider->setValue(refVolumeToPercent(user.nVolumeMediaFile)); ui.voiceleftChkBox->setChecked(!user.stereoPlaybackVoice[0]); ui.voicerightChkBox->setChecked(!user.stereoPlaybackVoice[1]); ui.mfleftChkBox->setChecked(!user.stereoPlaybackMediaFile[0]); ui.mfrightChkBox->setChecked(!user.stereoPlaybackMediaFile[1]); }
void QuasarConfig::slotCancel() { slotDefaults(); slotApply(); delete this; }
QuasarConfig::QuasarConfig(MainWindow* main) : QuasarWindow(main, "QuasarConfig"), _styleChanged(false) { _helpSource = "quasar_config.html"; QFrame* frame = new QFrame(this); _areas = new QListView(frame); _stack = new QWidgetStack(frame); _display = new QFrame(_stack); _i18n = new QFrame(_stack); _changeStyle = new QCheckBox(tr("Change Style?"), _display); _changeStyle->setMinimumSize(_changeStyle->sizeHint()); connect(_changeStyle, SIGNAL(toggled(bool)), SLOT(slotChangeStyle(bool))); _style = new ComboBox(_display); _style->insertItem(""); _style->insertStringList(QStyleFactory::keys()); _changeColor = new QCheckBox(tr("Change Color?"), _display); _changeColor->setMinimumSize(_changeColor->sizeHint()); connect(_changeColor, SIGNAL(toggled(bool)), SLOT(slotChangeColor(bool))); _color = new QPushButton(tr("New Color"), _display); connect(_color, SIGNAL(clicked()), SLOT(slotPickColor())); _changeFont = new QCheckBox(tr("Change Font?"), _display); _changeFont->setMinimumSize(_changeFont->sizeHint()); connect(_changeFont, SIGNAL(toggled(bool)), SLOT(slotChangeFont(bool))); _font = new QPushButton(tr("Push To Choose"), _display); connect(_font, SIGNAL(clicked()), SLOT(slotPickFont())); QGridLayout* displayGrid = new QGridLayout(_display); displayGrid->setSpacing(3); displayGrid->setMargin(3); displayGrid->setRowStretch(3, 1); displayGrid->setColStretch(2, 1); displayGrid->addWidget(_changeStyle, 0, 0); displayGrid->addWidget(_style, 0, 1); displayGrid->addWidget(_changeColor, 1, 0); displayGrid->addWidget(_color, 1, 1); displayGrid->addWidget(_changeFont, 2, 0); displayGrid->addWidget(_font, 2, 1); QLabel* localeLabel = new QLabel(tr("Locale:"), _i18n); _locale = new ComboBox(_i18n); _locale->setMinimumWidth(_locale->fontMetrics().width("x") * 30); localeLabel->setBuddy(_locale); connect(_locale, SIGNAL(activated(int)), SLOT(slotLocaleChange())); QGroupBox* samples = new QGroupBox(tr("Data Formats"), _i18n); QLabel* positiveLabel = new QLabel(tr("Positive"), samples); QLabel* negativeLabel = new QLabel(tr("Negative"), samples); QLabel* numLabel = new QLabel(tr("Number:"), samples); _numberPosSample = new QLabel(samples); _numberNegSample = new QLabel(samples); QLabel* moneyLabel = new QLabel(tr("Currency:"), samples); _moneyPosSample = new QLabel(samples); _moneyNegSample = new QLabel(samples); QLabel* percentLabel = new QLabel(tr("Percent:"), samples); _percentPosSample = new QLabel(samples); _percentNegSample = new QLabel(samples); QLabel* dateLabel = new QLabel(tr("Date:"), samples); _dateSample = new QLabel(samples); QLabel* timeLabel = new QLabel(tr("Time:"), samples); _timeSample = new QLabel(samples); QGridLayout* sampleGrid = new QGridLayout(samples); sampleGrid->addRowSpacing(0, samples->fontMetrics().height()); sampleGrid->setSpacing(3); sampleGrid->setMargin(10); sampleGrid->setColStretch(1, 1); sampleGrid->setColStretch(2, 1); sampleGrid->setRowStretch(3, 1); sampleGrid->addRowSpacing(3, 20); sampleGrid->addWidget(dateLabel, 1, 0); sampleGrid->addWidget(_dateSample, 1, 1, AlignRight|AlignVCenter); sampleGrid->addWidget(timeLabel, 2, 0); sampleGrid->addWidget(_timeSample, 2, 1, AlignRight|AlignVCenter); sampleGrid->addWidget(positiveLabel, 4, 1, AlignRight|AlignVCenter); sampleGrid->addWidget(negativeLabel, 4, 2, AlignRight|AlignVCenter); sampleGrid->addWidget(numLabel, 5, 0); sampleGrid->addWidget(_numberPosSample, 5, 1, AlignRight|AlignVCenter); sampleGrid->addWidget(_numberNegSample, 5, 2, AlignRight|AlignVCenter); sampleGrid->addWidget(moneyLabel, 6, 0); sampleGrid->addWidget(_moneyPosSample, 6, 1, AlignRight|AlignVCenter); sampleGrid->addWidget(_moneyNegSample, 6, 2, AlignRight|AlignVCenter); sampleGrid->addWidget(percentLabel, 7, 0); sampleGrid->addWidget(_percentPosSample, 7, 1, AlignRight|AlignVCenter); sampleGrid->addWidget(_percentNegSample, 7, 2, AlignRight|AlignVCenter); QGridLayout* i18nGrid = new QGridLayout(_i18n); i18nGrid->setSpacing(3); i18nGrid->setMargin(3); i18nGrid->addRowSpacing(1, 20); i18nGrid->setRowStretch(2, 1); i18nGrid->setColStretch(2, 1); i18nGrid->addWidget(localeLabel, 0, 0); i18nGrid->addWidget(_locale, 0, 1, AlignLeft | AlignVCenter); i18nGrid->addMultiCellWidget(samples, 2, 2, 0, 2); _stack->addWidget(_display, 0); _stack->addWidget(_i18n, 1); _areas->addColumn(tr("Area"), -1); _areas->setSorting(-1); _areas->header()->hide(); connect(_areas, SIGNAL(selectionChanged()), SLOT(slotAreaChange())); QListViewItem* user = new QListViewItem(_areas, tr("User Configuration")); user->setOpen(true); new QListViewItem(user, tr("Internationalization")); QListViewItem* displayArea = new QListViewItem(user, tr("Display")); QFrame* buttons = new QFrame(frame); QPushButton* ok = new QPushButton(tr("&OK"), buttons); QPushButton* apply = new QPushButton(tr("&Apply"), buttons); QPushButton* defaults = new QPushButton(tr("&Defaults"), buttons); QPushButton* cancel = new QPushButton(tr("&Cancel"), buttons); ok->setMinimumSize(defaults->sizeHint()); apply->setMinimumSize(defaults->sizeHint()); defaults->setMinimumSize(defaults->sizeHint()); cancel->setMinimumSize(defaults->sizeHint()); connect(ok, SIGNAL(clicked()), SLOT(slotOk())); connect(apply, SIGNAL(clicked()), SLOT(slotApply())); connect(defaults, SIGNAL(clicked()), SLOT(slotDefaults())); connect(cancel, SIGNAL(clicked()), this, SLOT(slotCancel())); QGridLayout* buttonGrid = new QGridLayout(buttons); buttonGrid->setSpacing(3); buttonGrid->setMargin(3); buttonGrid->setColStretch(0, 1); buttonGrid->addWidget(ok, 0, 1); buttonGrid->addWidget(apply, 0, 2); buttonGrid->addWidget(defaults, 0, 3); buttonGrid->addWidget(cancel, 0, 4); QGridLayout* grid = new QGridLayout(frame); grid->setSpacing(3); grid->setMargin(3); grid->setColStretch(1, 1); grid->addWidget(_areas, 0, 0); grid->addWidget(_stack, 0, 1); grid->addMultiCellWidget(buttons, 1, 1, 0, 1); _config.load(); _locales = Locale::getAvailableLocales(_localesCnt); slotDefaults(); _areas->setCurrentItem(displayArea); _stack->raiseWidget(_display); _changeStyle->setFocus(); setCentralWidget(frame); setCaption(tr("Quasar Configuration")); finalize(); }