00001 #ifndef GLOBALSTATEINFO_H
00002 #define GLOBALSTATEINFO_H
00003
00004 #include <QList>
00005 #include <QMenu>
00006
00007 #include "arcstoragewindow.h"
00008 #include "transferlistwindow.h"
00009
00010 class GlobalStateInfo : public QObject
00011 {
00012 Q_OBJECT
00013 private:
00014 TransferListWindow* m_transferListWindow;
00015 QList<ArcStorageWindow*> m_childWindows;
00016 ArcStorageWindow* m_mainWindow;
00017 QMenu* m_windowMenu;
00018 public:
00019 enum TLogLevel {LL_VERBOSE, LL_INFO, LL_WARNING, LL_ERROR};
00020 static GlobalStateInfo* instance()
00021 {
00022 static QMutex mutex;
00023 if (!m_instance)
00024 {
00025 mutex.lock();
00026
00027 if (!m_instance)
00028 m_instance = new GlobalStateInfo;
00029
00030 mutex.unlock();
00031 }
00032
00033 return m_instance;
00034 }
00035
00036 static void drop()
00037 {
00038 static QMutex mutex;
00039 mutex.lock();
00040 delete m_instance;
00041 m_instance = 0;
00042 mutex.unlock();
00043 }
00044
00045 void writeSettings();
00046 void readSettings();
00047
00048 void setMainWindow(ArcStorageWindow* window);
00049 ArcStorageWindow* mainWindow();
00050 void addChildWindow(ArcStorageWindow* window);
00051 void removeChildWindow(ArcStorageWindow* window);
00052 void closeChildWindows();
00053 void showTransferWindow();
00054 void hideTransferWindow();
00055 int childWindowCount();
00056 ArcStorageWindow* getChildWindow(int idx);
00057
00058 QMenu* windowMenu();
00059
00060 void updateWindowList(QMenu* menu);
00061
00062 void enumerateWindows();
00063
00064 void setTransferTimeout(int timeout);
00065 int transferTimeout();
00066
00067 void setTransferRetries(int retries);
00068 int transferRetries();
00069
00070 void setSecureTransfers(bool secure);
00071 bool secureTransfers();
00072
00073 void setPassiveTransfers(bool passive);
00074 bool passiveTransfers();
00075
00076 void setMaxTransfers(int maxTransfers);
00077 int maxTransfers();
00078
00079 void setTransferThreadWakeUpInterval(int interval);
00080 int transferThreadWakeUpInterval();
00081
00082 void setLogLevel(TLogLevel level);
00083 TLogLevel logLevel();
00084
00085 void setRedirectLog(bool flag);
00086 bool redirectLog();
00087
00088 void setRememberWindowPositions(bool flag);
00089 bool rememberWindowPositions();
00090
00091 void setRememberStartupDirs(bool flag);
00092 bool rememberStartupDirs();
00093
00094 void setNewWindowUrl(QString url);
00095 QString newWindowUrl();
00096
00097 private:
00098
00099 GlobalStateInfo();
00100 static GlobalStateInfo* m_instance;
00101
00102
00103
00104 bool m_rememberWindowsPositions;
00105 bool m_rememberStartupDirs;
00106 QString m_newWindowUrl;
00107 TLogLevel m_logLevel;
00108 bool m_redirectLog;
00109
00110
00111
00112 int m_timeout;
00113 int m_retries;
00114 bool m_secure;
00115 bool m_passive;
00116 bool m_notpassive;
00117 bool m_force;
00118 bool m_verbose;
00119 bool m_nocopy;
00120
00121
00122
00123 int m_maxTransfers;
00124 int m_transferThreadWakeupInterval;
00125 };
00126
00127 #endif // GLOBALSTATEINFO_H