diff options
author | Ben Boeckel <MathStuf@gmail.com> | 2009-03-20 23:33:44 -0400 |
---|---|---|
committer | Ben Boeckel <MathStuf@gmail.com> | 2009-03-20 23:37:14 -0400 |
commit | f00796a6f1b0520434b1056f6f0f57ef5d2cb838 (patch) | |
tree | 8d45ce82590ed03a3f7a2b03dc9bfbf47a255d90 /sigbattle | |
parent | a5377f78e9f15a272d55c02a02e2bf9d2d910dd3 (diff) | |
download | sigen-f00796a6f1b0520434b1056f6f0f57ef5d2cb838.tar.gz sigen-f00796a6f1b0520434b1056f6f0f57ef5d2cb838.tar.xz sigen-f00796a6f1b0520434b1056f6f0f57ef5d2cb838.zip |
Add basic Sigbattle code
Diffstat (limited to 'sigbattle')
-rw-r--r-- | sigbattle/CMakeLists.txt | 4 | ||||
-rw-r--r-- | sigbattle/SigbattleUI.cpp | 61 | ||||
-rw-r--r-- | sigbattle/SigbattleUI.h | 46 | ||||
-rw-r--r-- | sigbattle/sigbattle.ui | 10 |
4 files changed, 119 insertions, 2 deletions
diff --git a/sigbattle/CMakeLists.txt b/sigbattle/CMakeLists.txt index a9c5b7ba..b3600347 100644 --- a/sigbattle/CMakeLists.txt +++ b/sigbattle/CMakeLists.txt @@ -7,7 +7,7 @@ include_directories( ) set(sigbattle_FORMS -# sigbattle.ui + sigbattle.ui ) kde4_add_ui_files(sigbattle_UI_HEADERS ${sigbattle_FORMS}) set(sigbattle_KCFGC_FILES @@ -17,7 +17,7 @@ kde4_add_kcfg_files(sigbattle_KCFGC_SRCS ${sigbattle_KCFGC_FILES}) set(sigbattle_SRCS Sigbattle.cpp SigbattlePreferencesWidget.cpp -# SigbattleUI.cpp + SigbattleUI.cpp ) set(sigbattle_RC_FILES sigbattleui.rc diff --git a/sigbattle/SigbattleUI.cpp b/sigbattle/SigbattleUI.cpp new file mode 100644 index 00000000..05eac04a --- /dev/null +++ b/sigbattle/SigbattleUI.cpp @@ -0,0 +1,61 @@ +/* + * Copyright 2008-2009 Ben Boeckel <MathStuf@gmail.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +// Header include +#include "SigbattleUI.h" + +// Sigbattle includes +#include "SigbattlePreferences.h" +#include "SigbattlePreferencesWidget.h" + +// KDE includes +#include <KConfigDialog> +#include <KGlobal> +#include <KLocalizedString> + +using namespace Sigbattle; + +SigbattleUI::SigbattleUI(QWidget* parent) : + KXmlGuiWindow(parent) +{ + setupUi(this); + setupActions(); + setAutoSaveSettings("MainWindow", true); +} + +SigbattleUI::~SigbattleUI() +{ + SigbattlePreferences::self()->writeConfig(); + KGlobal::config()->sync(); +} + +void SigbattleUI::preferences() +{ + if (KConfigDialog::showDialog("sigbattle-prefs")) + return; + KConfigDialog* dialog = new KConfigDialog(this, "sigbattle-prefs", SigbattlePreferences::self()); + SigbattlePreferencesWidget* widget = new SigbattlePreferencesWidget; + dialog->addPage(widget, i18nc("General settings tab", "General"), "configure"); + connect(dialog, SIGNAL(okClicked()), widget, SLOT(save())); + dialog->exec(); +} + +void SigbattleUI::setupActions() +{ + setHelpMenuEnabled(true); + createGUI(); +} diff --git a/sigbattle/SigbattleUI.h b/sigbattle/SigbattleUI.h new file mode 100644 index 00000000..7c3e63d1 --- /dev/null +++ b/sigbattle/SigbattleUI.h @@ -0,0 +1,46 @@ +/* + * Copyright 2008-2009 Ben Boeckel <MathStuf@gmail.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef SIGBATTLE_SIGBATTLEUI +#define SIGBATTLE_SIGBATTLEUI + +// Form include +#include "ui_sigbattle.h" + +// KDE includes +#include <KXmlGuiWindow> + +// Qt includes +#include <QtXml/QDomDocument> + +namespace Sigbattle +{ +class SigbattleUI : public KXmlGuiWindow, private Ui::formSigbattle +{ + Q_OBJECT + + public: + SigbattleUI(QWidget* parent = 0); + ~SigbattleUI(); + protected slots: + void preferences(); + private: + void setupActions(); +}; +} + +#endif diff --git a/sigbattle/sigbattle.ui b/sigbattle/sigbattle.ui new file mode 100644 index 00000000..0dd2e680 --- /dev/null +++ b/sigbattle/sigbattle.ui @@ -0,0 +1,10 @@ +<ui version="4.0" > + <class>formSigbattle</class> + <widget class="KMainWindow" name="formSigbattle" > + <widget class="QWidget" name="frameMain" > + </widget> + <widget class="QStatusBar" name="windowStatusBar" /> + </widget> + <customwidgets /> + <tabstops /> +</ui> |