source: tspsg-svn/trunk/src/settingsdialog.cpp @ 152

Last change on this file since 152 was 151, checked in by laleppa, 14 years ago

Changed 2010 to 2011 in the source code copyrights.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id URL
File size: 19.2 KB
RevLine 
[100]1/*
2 *  TSPSG: TSP Solver and Generator
[151]3 *  Copyright (C) 2007-2011 Lёppa <contacts[at]oleksii[dot]name>
[100]4 *
5 *  $Id: settingsdialog.cpp 151 2011-01-19 22:27:49Z laleppa $
6 *  $URL: https://tspsg.svn.sourceforge.net/svnroot/tspsg/trunk/src/settingsdialog.cpp $
7 *
8 *  This file is part of TSPSG.
9 *
10 *  TSPSG is free software: you can redistribute it and/or modify
11 *  it under the terms of the GNU General Public License as published by
12 *  the Free Software Foundation, either version 3 of the License, or
13 *  (at your option) any later version.
14 *
15 *  TSPSG is distributed in the hope that it will be useful,
16 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 *  GNU General Public License for more details.
19 *
20 *  You should have received a copy of the GNU General Public License
21 *  along with TSPSG.  If not, see <http://www.gnu.org/licenses/>.
22 */
23
24#include "settingsdialog.h"
25
26/*!
27 * \brief Class constructor.
28 * \param parent Settings Dialog parent widget.
29 *
30 * Initializes Settings Dialog and creates its layout based on target OS.
31 */
32SettingsDialog::SettingsDialog(QWidget *parent)
[149]33    : QDialog(parent), _newFont(false), _newColor(false), _translucency(0)
[100]34{
[149]35    setupUi(this);
[100]36
[149]37    setWindowIcon(GET_ICON("preferences-system"));
[121]38
[149]39    buttonBox->button(QDialogButtonBox::Ok)->setIcon(GET_ICON("dialog-ok"));
[143]40#ifndef QT_NO_STATUSTIP
[149]41    buttonBox->button(QDialogButtonBox::Ok)->setStatusTip(tr("Save new preferences"));
[143]42#endif
[149]43    buttonBox->button(QDialogButtonBox::Ok)->setCursor(QCursor(Qt::PointingHandCursor));
44    buttonBox->button(QDialogButtonBox::Cancel)->setIcon(GET_ICON("dialog-cancel"));
[143]45#ifndef QT_NO_STATUSTIP
[149]46    buttonBox->button(QDialogButtonBox::Cancel)->setStatusTip(tr("Close without saving preferences"));
[143]47#endif
[149]48    buttonBox->button(QDialogButtonBox::Cancel)->setCursor(QCursor(Qt::PointingHandCursor));
[100]49
[149]50    buttonColor->setIcon(GET_ICON("format-text-color"));
51    buttonFont->setIcon(GET_ICON("preferences-desktop-font"));
52    buttonHelp->setIcon(GET_ICON("help-hint"));
[121]53
[104]54QPalette p = bgWhite->palette();
[149]55    p.setColor(QPalette::Window, p.color(QPalette::Base));
56    bgWhite->setPalette(p);
[104]57
[149]58    p = lineHorizontal->palette();
59    p.setColor(QPalette::Window, p.color(QPalette::Text));
60    lineHorizontal->setPalette(p);
[104]61
[140]62// Layout helpers
63QBoxLayout *box;
64QHBoxLayout *hbox;
[127]65#ifndef QT_NO_PRINTER
[149]66    cbHQGraph = new QCheckBox(bgWhite);
67    cbHQGraph->setObjectName("cbHQGraph");
[127]68#ifndef QT_NO_STATUSTIP
[149]69    cbHQGraph->setStatusTip(tr("Higher quality graph looks much better when printing but uglier on the screen"));
[127]70#endif // QT_NO_STATUSTIP
[149]71    cbHQGraph->setText(tr("Draw solution graph in higher quality"));
72    cbHQGraph->setCursor(QCursor(Qt::PointingHandCursor));
[127]73
[149]74    box = static_cast<QBoxLayout *>(tabOutput->layout());
75    hbox = new QHBoxLayout();
76    hbox->addSpacing(10);
77    hbox->addWidget(cbHQGraph);
78    box->insertLayout(box->indexOf(cbShowGraph) + 1, hbox);
79    connect(cbShowGraph, SIGNAL(toggled(bool)), cbHQGraph, SLOT(setEnabled(bool)));
[127]80#endif
81
[149]82    if (hasUpdater()) {
83        cbCheck4Updates = new QCheckBox(bgWhite);
84        cbCheck4Updates->setObjectName("cbCheck4Updates");
[139]85#ifndef QT_NO_STATUSTIP
[149]86        cbCheck4Updates->setStatusTip(tr("Automatically check for updates at the given interval"));
[139]87#endif // QT_NO_STATUSTIP
[149]88        cbCheck4Updates->setText(tr("Check for updates every"));
89        cbCheck4Updates->setCursor(QCursor(Qt::PointingHandCursor));
[139]90
[149]91        spinUpdateCheckInterval = new QSpinBox(bgWhite);
92        spinUpdateCheckInterval->setObjectName("spinUpdateCheckInterval");
[139]93#ifndef QT_NO_STATUSTIP
[149]94        spinUpdateCheckInterval->setStatusTip(tr("Minimal interval at which to check for updates"));
[139]95#endif // QT_NO_STATUSTIP
[149]96        spinUpdateCheckInterval->setSuffix(tr(" days", "Don't forget a space at the beginning!"));
97        spinUpdateCheckInterval->setRange(1, 365);
98        spinUpdateCheckInterval->setCursor(QCursor(Qt::PointingHandCursor));
[139]99
[149]100        connect(cbCheck4Updates, SIGNAL(toggled(bool)), spinUpdateCheckInterval, SLOT(setEnabled(bool)));
[139]101
[149]102        box = static_cast<QBoxLayout *>(tabGeneral->layout());
103        hbox = new QHBoxLayout();
104        hbox->setSpacing(0);
105        hbox->addWidget(cbCheck4Updates);
106        hbox->addWidget(spinUpdateCheckInterval);
107        hbox->addStretch();
108        box->insertLayout(box->indexOf(cbUseNativeDialogs) + 1, hbox);
109    } else
110        cbCheck4Updates = NULL;
[139]111
[100]112#ifdef HANDHELD
113QVBoxLayout *vbox1; // Layout helper
114
[141]115#ifdef Q_WS_WINCE_WM
[149]116    // On screens with small height when SIP is shown and the window is resized
117    // there is not enought space for all elements.
118    // So we show the scrollbars to be able to access them.
[100]119QScrollArea *scrollArea = new QScrollArea(this);
[149]120    scrollArea->setFrameShape(QFrame::NoFrame);
121    scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
122    scrollArea->setWidgetResizable(true);
123    scrollArea->setWidget(bgWhite);
[100]124#else
[149]125    buttons->insertStretch(buttons->indexOf(buttonHelp) + 1);
[141]126#endif // Q_WS_WINCE_WM
[100]127
[149]128    bgWhite->layout()->setMargin(0);
[100]129
[149]130    // Central layout
131    vbox1 = new QVBoxLayout(this);
132    vbox1->setMargin(0);
133    vbox1->setSpacing(0);
[141]134#ifdef Q_WS_WINCE_WM
[149]135    vbox1->addWidget(scrollArea);
[100]136#else
[149]137    vbox1->addWidget(bgWhite);
[141]138#endif // Q_WS_WINCE_WM
[149]139    vbox1->addWidget(bgGrey);
140    setLayout(vbox1);
[100]141#else // HANDHELD
[140]142QVBoxLayout *vbox; // Layout helper
[100]143
[150]144#ifndef HANDHELD
[149]145    if (QtWin::isCompositionEnabled()) {
146        cbUseTranslucency = new QCheckBox(bgWhite);
147        cbUseTranslucency->setObjectName("cbUseTranslucency");
[100]148#ifndef QT_NO_STATUSTIP
[149]149        cbUseTranslucency->setStatusTip(tr("Use translucent effect on the Main Window under Windows Vista and 7"));
[100]150#endif // QT_NO_STATUSTIP
[149]151        cbUseTranslucency->setText(tr("Use translucency effects"));
152        cbUseTranslucency->setCursor(QCursor(Qt::PointingHandCursor));
153    }
[150]154#endif // HANDHELD
[100]155
[149]156    cbSaveState = new QCheckBox(bgWhite);
157    cbSaveState->setObjectName("cbSaveState");
[100]158#ifndef QT_NO_STATUSTIP
[149]159    cbSaveState->setStatusTip(tr("Restore main window state and position on application restart"));
[100]160#endif // QT_NO_STATUSTIP
[149]161    cbSaveState->setText(tr("Save main window state and position"));
162    cbSaveState->setCursor(QCursor(Qt::PointingHandCursor));
[100]163
[149]164    imgIcon = new QLabel(this);
165    imgIcon->setObjectName("imgIcon");
166    imgIcon->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding);
167    imgIcon->setFrameShape(QFrame::NoFrame);
168    imgIcon->setPixmap(GET_ICON("preferences-system").pixmap(128, 128));
169    imgIcon->setStyleSheet("background-color: #0080C0; padding-top: 11px;");
170    imgIcon->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
171    imgIcon->setMinimumWidth(150);
[100]172
[149]173    labelHint = new QLabel(bgGrey);
174    labelHint->setObjectName("labelHint");
175    labelHint->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
[100]176//      labelHint->setMinimumSize(QSize(190,28));
[149]177    labelHint->setMinimumSize(QSize(0,28));
178    labelHint->setMaximumSize(QSize(QWIDGETSIZE_MAX,28));
179    labelHint->setTextFormat(Qt::PlainText);
[100]180//      labelHint->setAlignment(Qt::AlignLeft | Qt::AlignTop);
[149]181    labelHint->setWordWrap(true);
[100]182#ifndef QT_NO_STATUSTIP
[149]183    labelHint->setStatusTip(tr("Hover mouse pointer over dialog elements to get additional help"));
[100]184#endif // QT_NO_STATUSTIP
185
[149]186    lineVertical = new QFrame(this);
187    lineVertical->setObjectName("lineVertical");
188    lineVertical->setFrameShadow(QFrame::Plain);
189    lineVertical->setFrameShape(QFrame::VLine);
190    lineVertical->setLineWidth(2);
[100]191
[149]192    // Top line
193    hbox = new QHBoxLayout();
194    hbox->addWidget(imgIcon);
195    hbox->addWidget(lineVertical);
196    hbox->addWidget(bgWhite);
[100]197
[149]198    box = static_cast<QBoxLayout *>(tabGeneral->layout());
199    box->insertWidget(box->indexOf(cbUseNativeDialogs) + 1, cbSaveState);
[150]200#ifndef HANDHELD
[149]201    if (QtWin::isCompositionEnabled())
202        box->insertWidget(box->indexOf(cbUseNativeDialogs) + 1, cbUseTranslucency);
[150]203#endif // HANDHELD
[100]204
[149]205    // Inserting label for hints to the bottom part (with grey bg)
206    buttons->insertWidget(buttons->indexOf(buttonHelp) + 1, labelHint, 1);
[100]207
[149]208    // Central layout
209    vbox = new QVBoxLayout(this);
210    vbox->setMargin(0);
211    vbox->setSpacing(0);
212    vbox->addLayout(hbox);
213    vbox->addWidget(bgGrey);
214    setLayout(vbox);
[100]215#endif // HANDHELD
216
[141]217#ifdef Q_WS_WINCE_WM
[149]218    // We need to react to SIP show/hide and resize the window appropriately
219    connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), SLOT(desktopResized(int)));
[141]220#endif // Q_WS_WINCE_WM
[149]221    connect(spinRandMin, SIGNAL(valueChanged(int)), SLOT(spinRandMinValueChanged(int)));
222    connect(buttonFont, SIGNAL(clicked()), SLOT(buttonFontClicked()));
223    connect(buttonColor, SIGNAL(clicked()), SLOT(buttonColorClicked()));
224    setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
[143]225#if !defined(QT_NO_STATUSTIP) && !defined(HANDHELD)
[149]226    // Setting initial text of dialog hint label to own status tip text.
227    labelHint->setText(labelHint->statusTip());
[100]228#endif // HANDHELD
229
[149]230    settings = new QSettings(QSettings::IniFormat, QSettings::UserScope, "TSPSG", "tspsg", this);
231    settings->remove("SettingsReset");
[100]232
[149]233    cbAutosize->setChecked(settings->value("Autosize", DEF_AUTOSIZE).toBool());
234    cbSaveLastUsed->setChecked(settings->value("SaveLastUsed", DEF_SAVE_LAST_USED).toBool());
235    cbUseNativeDialogs->setChecked(settings->value("UseNativeDialogs", DEF_USE_NATIVE_DIALOGS).toBool());
[150]236#ifndef HANDHELD
[149]237    if (QtWin::isCompositionEnabled())
238        cbUseTranslucency->setChecked(settings->value("UseTranslucency", DEF_USE_TRANSLUCENCY).toBool());
[150]239#endif // HANDHELD
[100]240#ifndef HANDHELD
[149]241    cbSaveState->setChecked(settings->value("SavePos", DEF_SAVEPOS).toBool());
[100]242#endif // HANDHELD
[149]243    if (cbCheck4Updates != NULL) {
244        settings->beginGroup("Check4Updates");
245        cbCheck4Updates->setChecked(settings->value("Enabled", DEF_CHECK_FOR_UPDATES).toBool());
246        spinUpdateCheckInterval->setValue(settings->value("Interval", DEF_UPDATE_CHECK_INTERVAL).toInt());
247        settings->endGroup();
248        spinUpdateCheckInterval->setEnabled(cbCheck4Updates->isChecked());
249    }
[100]250
[149]251    settings->beginGroup("Task");
252    cbSymmetricMode->setChecked(settings->value("SymmetricMode", DEF_SYMMETRIC_MODE).toBool());
253    spinFractionalAccuracy->setValue(settings->value("FractionalAccuracy", DEF_FRACTIONAL_ACCURACY).toInt());
254    spinRandMin->setMaximum(MAX_RAND_VALUE);
255    spinRandMin->setValue(settings->value("RandMin",DEF_RAND_MIN).toInt());
256    spinRandMax->setMaximum(MAX_RAND_VALUE);
257    spinRandMax->setValue(settings->value("RandMax",DEF_RAND_MAX).toInt());
258    cbFractionalRandom->setChecked(settings->value("FractionalRandom", DEF_FRACTIONAL_RANDOM).toBool());
259    settings->endGroup();
[100]260
[149]261    settings->beginGroup("Output");
262    cbShowGraph->setChecked(settings->value("ShowGraph", DEF_SHOW_GRAPH).toBool());
[109]263
[127]264#ifndef QT_NO_PRINTER
[149]265    cbHQGraph->setEnabled(cbShowGraph->isChecked());
266    cbHQGraph->setChecked(settings->value("HQGraph", DEF_HQ_GRAPH && cbShowGraph->isChecked()).toBool());
[127]267#endif
268
[109]269#if !defined(NOSVG) && (QT_VERSION >= 0x040500)
[149]270    comboGraphImageFormat->addItem("svg");
[109]271#endif // NOSVG && QT_VERSION >= 0x040500
[149]272    // We create whitelist of formats, supported by the most popular web browsers according to
273    //  http://en.wikipedia.org/wiki/Comparison_of_web_browsers#Image_format_support
274    //  + TIFF format (there are plugins to support it).
[109]275QStringList whitelist;
[149]276    whitelist << "bmp" << "jpeg" << "png" << "tiff" << "xbm";
277    foreach (QByteArray format, QImageWriter::supportedImageFormats()) {
278        if (whitelist.contains(format))
279            comboGraphImageFormat->addItem(format);
280    }
281    comboGraphImageFormat->model()->sort(0);
282    comboGraphImageFormat->setCurrentIndex(comboGraphImageFormat->findText(settings->value("GraphImageFormat", DEF_GRAPH_IMAGE_FORMAT).toString(), Qt::MatchFixedString));
283    if (comboGraphImageFormat->currentIndex() < 0)
284        comboGraphImageFormat->setCurrentIndex(comboGraphImageFormat->findText(DEF_GRAPH_IMAGE_FORMAT, Qt::MatchFixedString));
285    labelGraphImageFormat->setEnabled(cbShowGraph->isChecked());
286    comboGraphImageFormat->setEnabled(cbShowGraph->isChecked());
[109]287
[149]288    cbShowMatrix->setChecked(settings->value("ShowMatrix", DEF_SHOW_MATRIX).toBool());
289    cbCitiesLimit->setEnabled(cbShowMatrix->isChecked());
290    cbCitiesLimit->setChecked(settings->value("UseShowMatrixLimit", DEF_USE_SHOW_MATRIX_LIMIT && cbShowMatrix->isChecked()).toBool());
291    spinCitiesLimit->setEnabled(cbShowMatrix->isChecked() && cbCitiesLimit->isChecked());
292    spinCitiesLimit->setValue(settings->value("ShowMatrixLimit", DEF_SHOW_MATRIX_LIMIT).toInt());
293    spinCitiesLimit->setMaximum(MAX_NUM_CITIES);
294    cbScrollToEnd->setChecked(settings->value("ScrollToEnd", DEF_SCROLL_TO_END).toBool());
[100]295
[149]296    font = qvariant_cast<QFont>(settings->value("Font", QFont(DEF_FONT_FACE, DEF_FONT_SIZE)));
297    color = qvariant_cast<QColor>(settings->value("Colors/Text", DEF_TEXT_COLOR));
298    settings->endGroup();
[100]299
[114]300#ifdef HANDHELD
[149]301    setWindowState(Qt::WindowMaximized);
[114]302#else
[149]303    adjustSize();
[141]304#endif // Q_WS_WINCE_WM
[100]305}
306
307/*!
308 * \brief Indicates whether or not the font color has been changed.
309 * \return \c true if font color changed, otherwise \c false.
310 */
311bool SettingsDialog::colorChanged() const
312{
[149]313    return _newColor;
[100]314}
315
316/*!
317 * \brief Indicates whether or not the font properties have been changed.
318 * \return \c true if font properties changed, otherwise \c false.
319 */
320bool SettingsDialog::fontChanged() const
321{
[149]322    return _newFont;
[100]323}
324
325/*!
326 * \brief Indicates whether and how the translucency setting was changed
327 * \retval -1 the translucency was \em disabled.
328 * \retval  0 the translucency was <em>not changed</em>.
329 * \retval  1 the translucency was \em enabled.
330 */
331qint8 SettingsDialog::translucencyChanged() const
332{
[149]333    return _translucency;
[100]334}
335
336/* Privates **********************************************************/
337
338void SettingsDialog::accept()
339{
[149]340    if (QApplication::keyboardModifiers() & Qt::ShiftModifier) {
341        if (QMessageBox::question(this, tr("Settings Reset"), tr("Do you really want to <b>reset all application settings to their defaults</b>?"), QMessageBox::RestoreDefaults | QMessageBox::Cancel) == QMessageBox::RestoreDefaults) {
342            _newFont = (font != QFont(DEF_FONT_FACE, DEF_FONT_SIZE));
343            _newColor = (color != DEF_TEXT_COLOR);
344            settings->remove("");
345            settings->setValue("SettingsReset", true);
346            QDialog::accept();
347            QMessageBox::information(this->parentWidget(), tr("Settings Reset"), tr("All settings where successfully reset to their defaults.\nIt is recommended to restart the application now."));
348            return;
349        } else
350            return;
351    }
352    settings->setValue("Autosize", cbAutosize->isChecked());
353    settings->setValue("SaveLastUsed", cbSaveLastUsed->isChecked());
354    settings->setValue("UseNativeDialogs", cbUseNativeDialogs->isChecked());
[150]355#ifndef HANDHELD
[149]356    if (QtWin::isCompositionEnabled()) {
[100]357bool old = settings->value("UseTranslucency", DEF_USE_TRANSLUCENCY).toBool();
[149]358        if ((!old && cbUseTranslucency->isChecked()) || (old && !cbUseTranslucency->isChecked())) {
359            _translucency = old ? -1 : 1;
360        } else
361            _translucency = 0;
362        settings->setValue("UseTranslucency", cbUseTranslucency->isChecked());
363    }
364    settings->setValue("SavePos", cbSaveState->isChecked());
[128]365#endif // HANDHELD
[149]366    if (cbCheck4Updates != NULL) {
367        settings->beginGroup("Check4Updates");
368        settings->setValue("Enabled", cbCheck4Updates->isChecked());
369        if (cbCheck4Updates->isChecked())
370            settings->setValue("Interval", spinUpdateCheckInterval->value());
371        settings->endGroup();
372    }
[100]373
[149]374    settings->beginGroup("Task");
375    settings->setValue("SymmetricMode", cbSymmetricMode->isChecked());
376    settings->setValue("FractionalAccuracy", spinFractionalAccuracy->value());
377    settings->setValue("RandMin", spinRandMin->value());
378    settings->setValue("RandMax", spinRandMax->value());
379    settings->setValue("FractionalRandom", cbFractionalRandom->isChecked());
380    settings->endGroup();
[100]381
[149]382    settings->beginGroup("Output");
383    settings->setValue("ShowGraph", cbShowGraph->isChecked());
[127]384#ifndef QT_NO_PRINTER
[149]385    settings->setValue("HQGraph", cbShowGraph->isChecked() && cbHQGraph->isChecked());
[127]386#endif
[149]387    if (cbShowGraph->isChecked()) {
388        if (comboGraphImageFormat->currentIndex() >= 0)
389            settings->setValue("GraphImageFormat", comboGraphImageFormat->currentText());
390        else
391            settings->setValue("GraphImageFormat", DEF_GRAPH_IMAGE_FORMAT);
392    }
393    settings->setValue("ShowMatrix", cbShowMatrix->isChecked());
394    settings->setValue("UseShowMatrixLimit", cbShowMatrix->isChecked() && cbCitiesLimit->isChecked());
395    if (cbCitiesLimit->isChecked())
396        settings->setValue("ShowMatrixLimit", spinCitiesLimit->value());
397    settings->setValue("ScrollToEnd", cbScrollToEnd->isChecked());
398    if (_newFont)
399        settings->setValue("Font", font);
400    if (_newColor)
401        settings->setValue("Colors/Text", color);
402    settings->endGroup();
403    QDialog::accept();
[100]404}
405
406void SettingsDialog::buttonColorClicked()
407{
408QColor color = QColorDialog::getColor(this->color,this);
[149]409    if (color.isValid() && (this->color != color)) {
410        this->color = color;
411        _newColor = true;
412    }
[100]413}
414
415void SettingsDialog::buttonFontClicked()
416{
417bool ok;
418QFont font = QFontDialog::getFont(&ok,this->font,this);
[149]419    if (ok && (this->font != font)) {
420        this->font = font;
421        _newFont = true;
422    }
[100]423}
424
[141]425#ifdef Q_WS_WINCE_WM
[100]426void SettingsDialog::desktopResized(int screen)
427{
[149]428    if (screen != 0)
429        return;
[100]430
431QRect availableGeometry = QApplication::desktop()->availableGeometry(0);
[149]432    if (currentGeometry != availableGeometry) {
433        QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
434        /*!
435         * \hack HACK: This hack checks whether \link QDesktopWidget::availableGeometry() availableGeometry()\endlink's \c top + \c hegiht = \link QDesktopWidget::screenGeometry() screenGeometry()\endlink's \c height.
436         *  If \c true, the window gets maximized. If we used \c setGeometry() in this case, the bottom of the
437         *  window would end up being behind the soft buttons. Is this a bug in Qt or Windows Mobile?
438         */
439        if ((availableGeometry.top() + availableGeometry.height()) == QApplication::desktop()->screenGeometry().height()) {
440            setWindowState(windowState() | Qt::WindowMaximized);
441        } else {
442            if (windowState() & Qt::WindowMaximized)
443                setWindowState(windowState() ^ Qt::WindowMaximized);
444            setGeometry(availableGeometry);
445        }
446        currentGeometry = availableGeometry;
447        QApplication::restoreOverrideCursor();
448    }
[100]449}
450
451void SettingsDialog::showEvent(QShowEvent *ev)
452{
[149]453    desktopResized(0);
[100]454
[149]455    QWidget::showEvent(ev);
[100]456}
[141]457#endif // Q_WS_WINCE_WM
[100]458
459void SettingsDialog::spinRandMinValueChanged(int val) {
[149]460    spinRandMax->setMinimum(val);
[100]461}
462
[143]463#if !defined(QT_NO_STATUSTIP) && !defined(HANDHELD)
[100]464bool SettingsDialog::event(QEvent *ev)
465{
[149]466    // Checking for StatusTip event and if tip text is not empty string
467    // setting it as text of the dialog hint label. Otherwise, setting
468    // dialog hint label text to own status tip text.
469    if (ev->type() == QEvent::StatusTip) {
[100]470QString tip = static_cast<QStatusTipEvent *>(ev)->tip();
[149]471        if (tip.length() != 0)
472            labelHint->setText(tip);
473        else
474            labelHint->setText(labelHint->statusTip());
475        return true;
476    } else
477        return QDialog::event(ev);
[100]478}
479#endif // HANDHELD
Note: See TracBrowser for help on using the repository browser.