summaryrefslogtreecommitdiffstats
path: root/kshutdown/configuration.h
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2013-07-28 02:30:20 +0200
committerSlávek Banko <slavek.banko@axis.cz>2013-07-28 02:30:20 +0200
commit48a589b8c526b34e79e8cdddc4cb7f5fc7b76815 (patch)
tree0f30d90998669b60a0aa840f824cc3d4ea7ddc66 /kshutdown/configuration.h
downloadkshutdown-48a589b8c526b34e79e8cdddc4cb7f5fc7b76815.tar.gz
kshutdown-48a589b8c526b34e79e8cdddc4cb7f5fc7b76815.zip
Initial import of kshutdown 1.0.4
Diffstat (limited to 'kshutdown/configuration.h')
-rw-r--r--kshutdown/configuration.h91
1 files changed, 91 insertions, 0 deletions
diff --git a/kshutdown/configuration.h b/kshutdown/configuration.h
new file mode 100644
index 0000000..d5d39fb
--- /dev/null
+++ b/kshutdown/configuration.h
@@ -0,0 +1,91 @@
+/*
+ configuration.h - A configuration
+ Copyright (C) 2004 Konrad Twardowski <kdtonline@poczta.onet.pl>
+
+ 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 2 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, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef __CONFIGURATION_H__
+#define __CONFIGURATION_H__
+
+#include <kconfigskeleton.h>
+
+#define kshutdownrc Config::getInstance()->getInstance()
+
+#define KS_CONFIG_AMOR_MESSAGE "dcop amor AmorIface showMessage \"%appname: %text\""
+#define KS_CONFIG_KDIALOG_MESSAGE "kdialog --title \"%title\" --passivepopup \"%text\" 10"
+
+/**
+ * @short A configuration reader/writer.
+ * Use the @c kshutdownrc macro to access these members.
+ */
+class Config: public KConfigSkeleton
+{
+public:
+ // automation
+ bool cdTrayClose;
+ ItemBool *i_cdTrayClose;
+ QString cdTrayCloseCommand;
+ ItemString *i_cdTrayCloseCommand;
+
+ // custom message
+ bool customMessageEnabled;
+ ItemBool *i_customMessageEnabled;
+ QString customMessageCommand;
+ ItemString *i_customMessageCommand;
+
+ // general
+ int generalAction;
+ int generalDelayType;
+ QDateTime generalDateTime;
+
+ // progress bar
+ bool progressBarEnabled;
+ ItemBool *i_progressBarEnabled;
+ int progressBarPosition;
+ ItemInt *i_progressBarPosition;
+
+ // statistics
+ bool statsLongFormat;
+ ItemBool *i_statsLongFormat;
+ bool statsToggleFromField;
+ ItemBool *i_statsToggleFromField;
+
+ // system tray
+ int systemTray;
+ ItemInt *i_systemTray;
+
+ // warning message
+ bool warningMessageEnabled;
+ ItemBool *i_warningMessageEnabled;
+ int warningMessageDelay;
+ ItemInt *i_warningMessageDelay;
+
+ /**
+ * Constructs and returns a singleton instance of the configuration.
+ */
+ inline static Config *getInstance()
+ {
+ if (!_instance)
+ _instance = new Config();
+
+ return _instance;
+ }
+private:
+ Config();
+ static Config *_instance;
+};
+
+#endif // __CONFIGURATION_H__