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

Last change on this file since 19 was 17, checked in by laleppa, 15 years ago

+ Windows CE (WM6, actually, but should work on other versions) support:

  • added optimized for wince forms (recommended minimal resolution is 240x320);
  • removed unsupported under wince features from menus (e.g., printing);
  • added preprocessor directives to remove code for unsupported under wince features.
  • Fixed wrong encoding in some files to UTF-8.
  • Updated copyright and e-mail.
  • Property svn:keywords set to Id URL
File size: 2.6 KB
RevLine 
[1]1/*
[6]2 *  TSPSG - TSP Solver and Generator
[17]3 *  Copyright (C) 2007-2009 Lёppa <contacts[at]oleksii[dot]name>
[1]4 *
[6]5 *  $Id: settingsdialog.cpp 17 2009-06-15 15:10:25Z laleppa $
6 *  $URL: https://tspsg.svn.sourceforge.net/svnroot/tspsg/trunk/src/settingsdialog.cpp $
[3]7 *
[6]8 *  This file is part of TSPSG.
[1]9 *
[6]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.
[1]14 *
[6]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.
[1]19 *
[6]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/>.
[1]22 */
23
[9]24#include <QMessageBox>
25#include <QStatusTipEvent>
[17]26#include <QFontDialog>
[1]27#include "settingsdialog.h"
28
29SettingsDialog::SettingsDialog(QWidget *parent)
30        : QDialog(parent)
31{
32        setupUi(this);
33        connect(buttonOK,SIGNAL(clicked()),this,SLOT(accept()));
34        connect(buttonCancel,SIGNAL(clicked()),this,SLOT(reject()));
35        connect(spinRandMin,SIGNAL(valueChanged(int)),this,SLOT(spinRandMinValueChanged(int)));
[17]36        connect(buttonFont,SIGNAL(clicked()),this,SLOT(buttonFontClicked()));
[1]37//      setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint);
38        setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
39        layout()->setSizeConstraint(layout()->SetFixedSize);
[17]40#ifndef Q_OS_WINCE
[10]41        // Setting initial text of dialog hint label to own status tip
42        // text.
[9]43        labelHint->setText(labelHint->statusTip());
[10]44        // HACK: Do not resize label hint (and dialog) when text changes
45        // from one-line to two-line and vice versa. Any better solution?
46        labelHint->setMaximumHeight(labelHint->height());
47        labelHint->setMinimumHeight(labelHint->height());
[17]48#endif // Q_OS_WINCE
[1]49}
50
[17]51#ifndef Q_OS_WINCE
[9]52bool SettingsDialog::event(QEvent *ev)
53{
54        // Checking for StatusTip event and if tip text is not empty string
55        // setting it as text of the dialog hint label. Otherwise, setting
[10]56        // dialog hint label text to own status tip text.
[9]57        if (ev->type() == QEvent::StatusTip) {
58QString tip = static_cast<QStatusTipEvent *>(ev)->tip();
59                if (tip.length() != 0)
60                        labelHint->setText(tip);
61                else
62                        labelHint->setText(labelHint->statusTip());
63                return true;
64        } else
65                return QDialog::event(ev);
66}
[17]67#endif // Q_OS_WINCE
[9]68
[17]69void SettingsDialog::buttonFontClicked()
70{
71        // TODO: Pass current font to dialog and save selected.
72QFontDialog fd;
73        fd.exec();
74}
Note: See TracBrowser for help on using the repository browser.