/guitone-1.0rc5/src/view/dialogs/Dialog.cpp
C++ | 65 lines | 37 code | 11 blank | 17 comment | 1 complexity | f4019fd31e7330eb8a0ea2d3af0d5a3d MD5 | raw file
Possible License(s): GPL-3.0
1/***************************************************************************
2 * Copyright (C) 2007 by Thomas Keller *
3 * me@thomaskeller.biz *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 3 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17 ***************************************************************************/
18
19#include "Dialog.h"
20#include "Settings.h"
21#include "MainWindow.h"
22#include "vocab.h"
23
24#include <QMenuBar>
25
26Dialog::Dialog(QWidget * parent) : QDialog(parent) {}
27
28Dialog::Dialog(QWidget * parent, const QString & objName)
29: QDialog(parent)
30{
31 setObjectName(objName);
32}
33
34Dialog::~Dialog()
35{
36 saveState();
37}
38
39void Dialog::init()
40{
41 restoreState();
42}
43
44void Dialog::restoreState(void)
45{
46 restoreGeometry(Settings::getWindowGeometry(objectName()));
47}
48
49void Dialog::saveState(void)
50{
51 Settings::setWindowGeometry(objectName(), saveGeometry());
52}
53
54void Dialog::setStayOnTop()
55{
56 if (isVisible()) return;
57 setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
58}
59
60void Dialog::hideEvent(QHideEvent * event)
61{
62 emit dialogHidden();
63 event->accept();
64}
65