summaryrefslogtreecommitdiffstats
path: root/src/knutclient.h
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-19 18:17:02 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-19 18:17:02 +0000
commitf867212c1762e156553d039319b904a17f7b563d (patch)
tree461c1a743b3ff8291e03360742dbbfb4cc0087e4 /src/knutclient.h
downloadknutclient-f867212c1762e156553d039319b904a17f7b563d.tar.gz
knutclient-f867212c1762e156553d039319b904a17f7b563d.zip
Added KDE3 version of knutclient
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/knutclient@1092914 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/knutclient.h')
-rwxr-xr-xsrc/knutclient.h210
1 files changed, 210 insertions, 0 deletions
diff --git a/src/knutclient.h b/src/knutclient.h
new file mode 100755
index 0000000..fab2295
--- /dev/null
+++ b/src/knutclient.h
@@ -0,0 +1,210 @@
+/***************************************************************************
+ knutclient.h - description
+ -------------------
+ begin : Út srp 21 19:12:20 CEST 2001
+ copyright : (C) 2001 by Daniel Prynych
+ email : Daniel.Prynych@alo.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef KNUTCLIENT_H
+#define KNUTCLIENT_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "knutmainwindow.h"
+#include "knutvardata.h"
+#include "knutupsdata.h"
+#include "knutnet.h"
+#include "knutdock.h"
+#include "knutprefdlg.h"
+#include "knutmessagemanager.h"
+
+#include <kapplication.h>
+
+
+#include <qwidget.h>
+#include <qtimer.h>
+#include <qstringlist.h>
+#include <qmutex.h>
+
+ const int countNextConnDelay = 10;
+ const int nextConnDelay[] = {
+ 5, 5, 20, 30, 60, 60, 120, 300, 600, 900 };
+
+
+class KNutClient : public QObject, public KSessionManaged {
+ Q_OBJECT
+ public:
+ KNutClient(bool noDock = false, QObject* parent=0,const char* name=0);
+ ~KNutClient();
+
+ private slots:
+ void slotTimeout (void);
+
+ void slotReconnectTimeout (void);
+
+ void slotSetNewUPS (QString name);
+
+ void slotPreferenceUps(void);
+
+ void slotSetConfig (unsigned int changeSetting);
+
+ void slotPrintUPSVars(void);
+ void slotInstComms(void);
+ void slotRWVars(void);
+ void slotChangeRWVars( QString );
+
+ void slotSaveConf (void);
+
+
+ void slotExitApplication(void);
+
+
+/**
+ *
+ * Calls function for repainting of icon in dock.
+ * Vola funkci pro prekresleni icony v doku.
+ *
+ * @since 0.1
+ **/
+ void slotTryFirstConnection (int maxCount);
+
+
+
+/**
+ * This function is called when program repeats other connection;
+ * Calls function for repainting of icon in dock.
+ * Tata funkce je volana, kdyz program opakuje pokus o pripojeni.
+ * Vola funkci pro prekresleni icony v doku.
+ *
+ * @since 0.1
+ **/
+ void slotTryReepatFirstConnection (int number );
+
+
+/**
+ * Nastavi hodnoty po prvem pripojeni na UPS, zavola prekresleni docku a nastartuje timer
+ * Sets values after the first conection to UPS ,calls to repaint of dock and starts timer
+ *
+ * @since 0.2
+ **/
+ void slotFirstConnection (void);
+
+
+
+/**
+ * Zpracuje chybu spojeni
+ * Executes error of connection
+ *
+ * @since 0.1
+ **/
+ void slotErrorConnection (int error);
+
+
+/**
+ * Zpracuje ukonceni spojeni, pokud spojeni bylo ukonceno druhou stranou.
+ * Executes end of connection, when connection was closed by the second side.
+ *
+ * @since 0.1
+ **/
+ void slotConnectionClosed(void);
+
+
+/**
+ *
+ *
+ * @since 0.1
+ **/
+ void slotRefreshConnection(void);
+
+
+ void closeMainWindow (void);
+ void exitMainWindow (void);
+ void slotActiveMainWindow (void);
+
+ virtual bool commitData (QSessionManager&);
+ virtual bool saveState (QSessionManager&);
+
+ private:
+
+/**
+ * Prepares and show main window.
+ * Pripravi a zobrazi hlavni okno.
+ *
+ * @since 0.1
+ **/
+ void makeMainWindow (void);
+
+/**
+ * Sets all variables to initial values.
+ * Nastavi vsechny vsechny promenne na pocatecni hodnoty.
+ *
+ * @since 0.1
+ **/
+ void initVars (void);
+
+ void loadConfiguration ( void );
+ void saveConfiguration ( bool all = true );
+
+ void upsActivate (void);
+ void upsDeactivate (void);
+
+ void setActiveUpsVars (bool mWindow = true);
+ void setActiveXFerVars (bool activate);
+
+ void getUpsData (void);
+
+ void setActiveUpsInfo (QString name);
+
+ void addEventString (const QString text, const QString UPSAddress = QString::null);
+
+ void showStatusEvent(void);
+
+
+
+
+/********* PRIVATE VARS****************/
+ // hlavni informace o upsce
+ // main informacion about UPS
+ KNutVarData::upsInfoDef m_mainUpsInfo;
+
+ // v teto strukture jsou ulozeny promene ktere nastavuji konfiguraci
+ // in this structure are saveing values, which setting configuration
+ KNutVarData::SettingDataDef settingData;
+
+ KNutDock* m_myDock;
+
+ KNutMainWindow* mainWindow;
+
+ KNutUpsData* upsRecords;
+ KNutVarData* analogRecords;
+
+ QTimer* m_upsTimer;
+ QTimer* m_reconnectTimer;
+
+ QStringList* m_listKNutEvent;
+
+ bool m_panelsAreZeroing; // indikuje zda je panel nulovany // use if analog panels is setting to zero
+ // kod posledni chyby spojeni zjistene v timeoutu
+ // nebere ohled zda byla chyba pri inicializaci
+ int m_lastError;
+
+ KNutMessageManager* m_myMessMan;
+
+ // mutex for reconnect, only one reconnect at a time
+ QMutex m_reconnectMutex;
+ QMutex m_upsDeactivateMutex;
+
+ };
+#endif