2011-04-06 13:48:02 +04:00
|
|
|
/*
|
|
|
|
* Copyright (C) by Duncan Mac-Vicar P. <duncan@kde.org>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2011-02-17 02:21:45 +03:00
|
|
|
#ifndef APPLICATION_H
|
|
|
|
#define APPLICATION_H
|
|
|
|
|
|
|
|
#include <QApplication>
|
2011-04-04 13:36:44 +04:00
|
|
|
#include <QHash>
|
2011-02-17 02:21:45 +03:00
|
|
|
|
|
|
|
class QAction;
|
2011-04-06 12:56:20 +04:00
|
|
|
class QMenu;
|
2011-02-17 02:21:45 +03:00
|
|
|
class QSystemTrayIcon;
|
2011-04-04 13:36:44 +04:00
|
|
|
class QNetworkConfigurationManager;
|
2011-02-17 02:21:45 +03:00
|
|
|
|
|
|
|
namespace Mirall {
|
|
|
|
|
|
|
|
class Folder;
|
2011-04-05 20:31:14 +04:00
|
|
|
class FolderWizard;
|
2011-02-17 02:21:45 +03:00
|
|
|
|
|
|
|
class Application : public QApplication
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit Application(int argc, char **argv);
|
|
|
|
~Application();
|
|
|
|
signals:
|
|
|
|
|
|
|
|
protected slots:
|
|
|
|
|
|
|
|
void slotAddFolder();
|
|
|
|
|
2011-04-04 14:23:30 +04:00
|
|
|
void slotFolderSyncStarted();
|
|
|
|
void slotFolderSyncFinished();
|
|
|
|
|
2011-02-17 02:21:45 +03:00
|
|
|
protected:
|
|
|
|
|
2011-04-04 13:36:44 +04:00
|
|
|
QString folderConfigPath() const;
|
|
|
|
|
2011-02-17 02:21:45 +03:00
|
|
|
void setupActions();
|
|
|
|
void setupSystemTray();
|
|
|
|
void setupContextMenu();
|
|
|
|
|
2011-04-04 13:36:44 +04:00
|
|
|
// finds all folder configuration files
|
|
|
|
// and create the folders
|
|
|
|
void setupKnownFolders();
|
|
|
|
|
|
|
|
// creates a folder for a specific
|
|
|
|
// configuration
|
|
|
|
void setupFolderFromConfigFile(const QString &filename);
|
|
|
|
|
2011-02-17 02:21:45 +03:00
|
|
|
private:
|
2011-04-04 13:36:44 +04:00
|
|
|
// configuration file -> folder
|
|
|
|
QHash<QString, Folder *> _folderMap;
|
2011-02-17 02:21:45 +03:00
|
|
|
QSystemTrayIcon *_tray;
|
|
|
|
QAction *_actionQuit;
|
|
|
|
QAction *_actionAddFolder;
|
2011-04-04 13:36:44 +04:00
|
|
|
QNetworkConfigurationManager *_networkMgr;
|
|
|
|
QString _folderConfigPath;
|
2011-04-04 14:23:30 +04:00
|
|
|
|
|
|
|
// counter tracking number of folders doing a sync
|
|
|
|
int _folderSyncCount;
|
|
|
|
|
2011-04-05 20:31:14 +04:00
|
|
|
FolderWizard *_folderWizard;
|
2011-04-06 12:56:20 +04:00
|
|
|
|
|
|
|
// tray's menu
|
|
|
|
QMenu *_contextMenu;
|
|
|
|
|
2011-02-17 02:21:45 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Mirall
|
|
|
|
|
|
|
|
#endif // APPLICATION_H
|