source: tspsg/src/settingsdialog.cpp @ 5fce561905

0.1.3.145-beta1-symbian0.1.4.170-beta2-bb10appveyorimgbotreadme
Last change on this file since 5fce561905 was 5354a01311, checked in by Oleksii Serdiuk, 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 mode set to 100644
File size: 2.6 KB
Line 
1/*
2 *  TSPSG - TSP Solver and Generator
3 *  Copyright (C) 2007-2009 Lёppa <contacts[at]oleksii[dot]name>
4 *
5 *  $Id$
6 *  $URL$
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 <QMessageBox>
25#include <QStatusTipEvent>
26#include <QFontDialog>
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)));
36        connect(buttonFont,SIGNAL(clicked()),this,SLOT(buttonFontClicked()));
37//      setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint);
38        setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
39        layout()->setSizeConstraint(layout()->SetFixedSize);
40#ifndef Q_OS_WINCE
41        // Setting initial text of dialog hint label to own status tip
42        // text.
43        labelHint->setText(labelHint->statusTip());
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());
48#endif // Q_OS_WINCE
49}
50
51#ifndef Q_OS_WINCE
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
56        // dialog hint label text to own status tip text.
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}
67#endif // Q_OS_WINCE
68
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.