File indexing completed on 2024-04-21 05:50:00

0001 //***************************************************************************
0002 //   Copyright 2006 - 2017 Martin Koller, kollix@aon.at
0003 //
0004 //   This program is free software; you can redistribute it and/or modify
0005 //   it under the terms of the GNU General Public License as published by
0006 //   the Free Software Foundation, version 2 of the License
0007 //
0008 //***************************************************************************
0009 
0010 #ifndef _MAIN_WINDOW_H_
0011 #define _MAIN_WINDOW_H_
0012 
0013 #include <kxmlguiwindow.h>
0014 
0015 class Selector;
0016 class MainWidget;
0017 class KStatusNotifierItem;
0018 class KToggleAction;
0019 class QAction;
0020 class KRecentFilesAction;
0021 class QUrl;
0022 class QSplitter;
0023 
0024 class MainWindow : public KXmlGuiWindow
0025 {
0026   Q_OBJECT
0027 
0028   public:
0029     MainWindow();
0030     void loadProfile(const QString &fileName, bool adaptTreeWidth = false);
0031 
0032     // start backup and quit application after it's finished
0033     void runBackup();
0034 
0035   protected:
0036     bool queryClose() override;
0037 
0038   private Q_SLOTS:
0039     void loadProfile();
0040     void saveProfileAs();
0041     void saveProfile(QString fileName = QString());
0042     void profileSettings();
0043     void newProfile();
0044     void loggingSlot(const QString &message);
0045     void changeSystrayTip();
0046     void inProgress(bool);
0047     void dockInSysTray(bool checked);
0048     void showHiddenFiles(bool checked);
0049     void maybeQuit();
0050     void recentProfileSelected(const QUrl &url);
0051     void enableAllMessages();
0052 
0053   private:
0054     bool stopAllowed();
0055     void setLoadedProfile(const QString &name);
0056 
0057   private:
0058     QSplitter *splitter = nullptr;
0059     Selector *selector = nullptr;
0060     MainWidget *mainWidget = nullptr;
0061     KStatusNotifierItem *sysTray = nullptr;
0062     QString lastLog;
0063     QAction *startBackupAction = nullptr;
0064     QAction *cancelBackupAction = nullptr;
0065     QAction *quitAction = nullptr;
0066     KRecentFilesAction *recentFiles = nullptr;
0067     bool autorun = false;
0068     QString loadedProfile;
0069 };
0070 
0071 #endif