nextcloud-desktop/src/mirall/application.h

153 lines
4.1 KiB
C
Raw Normal View History

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>
#include <QNetworkReply>
#include <QSslError>
#include <QPointer>
#include <QQueue>
2011-02-17 02:21:45 +03:00
#include "qtsingleapplication.h"
2011-04-08 13:36:53 +04:00
#include "mirall/syncresult.h"
#include "mirall/logbrowser.h"
#include "mirall/systray.h"
#include "mirall/connectionvalidator.h"
#include "mirall/progressdispatcher.h"
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;
class QNetworkConfigurationManager;
class QSignalMapper;
class QNetworkReply;
2011-02-17 02:21:45 +03:00
namespace Mirall {
class Theme;
class Folder;
class FolderWatcher;
class FolderWizard;
class ownCloudInfo;
class SslErrorDialog;
class SettingsDialog;
class ItemProgressDialog;
2011-02-17 02:21:45 +03:00
class Application : public SharedTools::QtSingleApplication
2011-02-17 02:21:45 +03:00
{
Q_OBJECT
public:
2012-04-20 15:17:48 +04:00
explicit Application(int &argc, char **argv);
2011-02-17 02:21:45 +03:00
~Application();
2012-06-15 15:36:38 +04:00
bool giveHelp();
void showHelp();
2012-06-15 15:36:38 +04:00
public slots:
// TODO: this should not be public
2012-11-28 22:25:12 +04:00
void slotownCloudWizardDone(int);
2011-02-17 02:21:45 +03:00
protected:
void parseOptions(const QStringList& );
void setupTranslations();
2011-02-17 02:21:45 +03:00
void setupActions();
void setupSystemTray();
void setupContextMenu();
void setupLogBrowser();
void enterNextLogFile();
bool checkConfigExists(bool openSettings);
2011-02-17 02:21:45 +03:00
//folders have to be disabled while making config changes
void computeOverallSyncStatus();
2013-06-05 18:14:20 +04:00
// reimplemented
#if defined(Q_WS_WIN)
bool winEventFilter( MSG * message, long * result );
#endif
signals:
void folderRemoved();
void folderStateChanged(Folder*);
2011-09-26 17:00:12 +04:00
protected slots:
void slotFoldersChanged();
void slotSettings();
void slotItemProgressDialog();
void slotParseOptions( const QString& );
void slotShowTrayMessage(const QString&, const QString&);
void slotShowOptionalTrayMessage(const QString&, const QString&);
2013-08-07 16:58:56 +04:00
void slotShowGuiMessage(const QString& title, const QString& message);
void slotCheckConnection();
void slotConnectionValidatorResult(ConnectionValidator::Status);
void slotSyncStateChange( const QString& );
2011-09-26 17:00:12 +04:00
void slotTrayClicked( QSystemTrayIcon::ActivationReason );
void slotFolderOpenAction(const QString & );
void slotOpenOwnCloud();
void slotOpenLogBrowser();
void slotSSLFailed( QNetworkReply *reply, QList<QSslError> errors );
void slotStartUpdateDetector();
void slotSetupProxy();
void slotRefreshQuotaDisplay( qint64 total, qint64 used );
void slotUseMonoIconsChanged( bool );
void slotUpdateProgress(const QString&, const Progress::Info&);
void slotProgressSyncProblem(const QString& folder, const Progress::SyncProblem &problem);
void slotDisplayIdle();
void slotHelp();
void slotCredentialsFetched();
2011-02-17 02:21:45 +03:00
private:
void setHelp();
2013-01-15 23:41:52 +04:00
void raiseDialog( QWidget* );
void rebuildRecentMenus();
void runValidator();
2012-06-15 15:36:38 +04:00
Systray *_tray;
QAction *_actionOpenoC;
QAction *_actionSettings;
QAction *_actionQuota;
QAction *_actionStatus;
QAction *_actionRecent;
QAction *_actionHelp;
QAction *_actionQuit;
2011-10-14 18:39:53 +04:00
QNetworkConfigurationManager *_networkMgr;
2011-04-04 14:23:30 +04:00
QPointer<FolderWizard> _folderWizard;
SslErrorDialog *_sslErrorDialog;
ConnectionValidator *_conValidator;
2011-04-06 12:56:20 +04:00
// tray's menu
QMenu *_contextMenu;
QMenu *_recentActionsMenu;
Theme *_theme;
QSignalMapper *_folderOpenActionMapper;
LogBrowser *_logBrowser;
QPointer<SettingsDialog> _settingsDialog;
QPointer<ItemProgressDialog> _progressDialog;
QString _logFile;
QString _logDirectory;
int _logExpire;
bool _showLogWindow;
bool _logFlush;
bool _helpOnly;
2011-02-17 02:21:45 +03:00
};
} // namespace Mirall
#endif // APPLICATION_H