cleanup
[fapman] / mainwindow.h
1 /*
2         This file is part of Faster Application Manager.
3
4         Faster Application Manager is free software: you can redistribute it and/or modify
5         it under the terms of the GNU General Public License as published by
6         the Free Software Foundation, either version 3 of the License, or
7         (at your option) any later version.
8
9         Faster Application Manager is distributed in the hope that it will be useful,
10         but WITHOUT ANY WARRANTY; without even the implied warranty of
11         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12         GNU General Public License for more details.
13
14         You should have received a copy of the GNU General Public License
15         along with Faster Application Manager.  If not, see <http://www.gnu.org/licenses/>.
16
17         (C) Heikki Holstila 2010
18 */
19
20 #ifndef MAINWINDOW_H
21 #define MAINWINDOW_H
22
23 #include <QtCore>
24 #include <QMainWindow>
25 #include <phonon/MediaObject>
26 #include "aaptinterface.h"
27
28 class PackageView;
29 class Uninstall;
30 class Dialog;
31 class dimmer;
32 class RepoView;
33 class Settings;
34 class DpkgInterface;
35
36 namespace Ui {
37     class MainWindow;
38 }
39
40 class MainWindow : public QMainWindow
41 {
42     Q_OBJECT
43 #ifdef Q_WS_MAEMO_5
44         Q_CLASSINFO("D-Bus Interface", "org.maemo.faster_application_manager")
45 #endif
46
47 public:
48         enum nextOperation { OpNone, OpPromptSimulated, OpOpenPkgView };
49
50     explicit MainWindow(QWidget *parent = 0);
51     ~MainWindow();
52         void operationQueueFinished(QList<AAptInterface::interfaceMode> lastModes, bool success, QString title, QStringList msgs);
53         void busyDialog(bool show_, QString title="", QString text="");
54         void closeEvent(QCloseEvent *event);
55         void GdkEventIconThemeReload();
56         void notifyDialog(QString title, QString msg);
57         bool confirmDialog(QString title, QString msg);
58         void resetIdlingTime() { iIdlingSince = QDateTime::currentDateTime(); }
59         void setNextOperation(nextOperation op_) { iNextOperation=op_; }
60
61 public slots:
62         void on_btnUpdate_clicked();
63 #ifdef Q_WS_MAEMO_5
64         Q_SCRIPTABLE int top_application();
65 #endif
66
67 protected:
68     void changeEvent(QEvent *e);
69
70 private:
71         void dateFetchAsk();
72
73     Ui::MainWindow *ui;
74         AAptInterface* iAptInterface;
75         DpkgInterface* iDpkgInterface;
76         PackageView* iWinPackageView;
77         RepoView* iWinRepoView;
78         Dialog* iDlgBusy;
79         Settings* iSettings;
80         //operation iOperation;
81         dimmer* iDimmer;
82         bool iReposAutoUpdating;
83         bool iUpgradeAutoUpdate;
84         nextOperation iNextOperation;
85         Phonon::MediaObject* iMediaObject;
86
87         QDateTime iIdlingSince;
88
89 private slots:
90         void on_actionLoad_file_triggered();
91         void on_actionOptions_triggered();
92         void on_actionView_log_triggered();
93         void on_btnRepos_clicked();
94         void on_actionClean_triggered();
95         void on_actionAbout_triggered();
96         void on_btnUpgrade_clicked();
97         void on_btnListInstallable_clicked();
98         void on_btnListInstalled_clicked();
99 };
100
101 #endif // MAINWINDOW_H