2 * Copyright (C) 2011, Jamie Thompson
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License as published by the Free Software Foundation; either
7 * version 3 of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public
15 * License along with this program; If not, see
16 * <http://www.gnu.org/licenses/>.
19 #include "BaseWindow.h"
23 using namespace Windows;
25 BaseWindow::BaseWindow(Settings& settings, QWidget *parent) :
30 setWindowIcon(QIcon(":/resources/sphone.png"));
33 this->setAttribute(Qt::WA_Maemo5StackedWindow, true);
34 this->setAttribute(Qt::WA_Maemo5AutoOrientation, true);
36 this->setAttribute(Qt::WA_DeleteOnClose);
37 this->setWindowTitle("QwerkiSync");
38 this->setWindowIcon(QIcon(":/resources/sphone.png"));
45 BaseWindow::~BaseWindow()
49 void BaseWindow::closeEvent(QCloseEvent *)
51 if(Parent() != NULL && CurrentSettings().IsConfirmed())
55 void BaseWindow::CreateMenus()
57 m_HelpMenu = menuBar()->addMenu(tr("&Help"));
58 m_HelpMenu->addAction(m_AboutAct);
59 m_HelpMenu->addAction(m_AboutQtAct);
62 void BaseWindow::CreateActions()
64 m_AboutAct = new QAction(QIcon(":/resources/sphone.png"), tr("&About"), this);
65 m_AboutAct->setStatusTip(tr("Show the application's About box"));
66 m_AboutAct->setIconVisibleInMenu(true);
67 connect(m_AboutAct, SIGNAL(triggered()), this, SLOT(About()));
69 m_AboutQtAct = new QAction(tr("&About Qt"), this);
70 m_AboutQtAct->setStatusTip(tr("Qt"));
71 connect(m_AboutQtAct, SIGNAL(triggered()), this, SLOT(AboutQt()));
74 void BaseWindow::CreateContents()
76 QWidget *central = new QWidget(this);
77 setCentralWidget(central);
80 void BaseWindow::About()
82 QMessageBox::about(this, "about", "about me");
85 void BaseWindow::AboutQt()
87 QMessageBox::aboutQt(this, tr("About Qt"));