0.7.1
[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         virtual ~MainWindow();
52
53         void openNetworkConnection();
54
55         void operationQueueFinished(QList<AAptInterface::interfaceMode> lastModes, bool success, QString title, QStringList msgs);
56         void busyDialog(bool show_, QString title="", QString text="");
57         void closeEvent(QCloseEvent *event);
58         void GdkEventIconThemeReload();
59         void notifyDialog(QString title, QString msg);
60         bool confirmDialog(QString title, QString msg);
61         void setNextOperation(nextOperation op_) { iNextOperation=op_; }
62
63         void on_btnUpdate_clicked();
64         void resizeEvent(QResizeEvent* event);
65
66 public slots:
67         void orientationChanged();
68 #ifdef Q_WS_MAEMO_5
69         Q_SCRIPTABLE int top_application();
70 #endif
71
72 protected:
73     void changeEvent(QEvent *e);
74
75 private:
76         MainWindow(const MainWindow& old);
77         MainWindow operator= (const MainWindow& old);
78
79         void dateFetchAsk();
80         void showFreeSpace();
81         void rescaleMenuView();
82
83     Ui::MainWindow *ui;
84         AAptInterface* iAptInterface;
85         DpkgInterface* iDpkgInterface;
86         PackageView* iWinPackageView;
87         RepoView* iWinRepoView;
88         Dialog* iDlgBusy;
89         Settings* iSettings;
90         //operation iOperation;
91         dimmer* iDimmer;
92         bool iReposAutoUpdating;
93         bool iUpgradeAutoUpdate;
94         nextOperation iNextOperation;
95         Phonon::MediaObject* iMediaObject;
96         QNetworkSession* iNetworkSession;
97         QNetworkConfigurationManager* iNetworkConfigurationManager;
98
99         void on_btnRepos_clicked();
100         void on_btnUpgrade_clicked();
101         void on_btnListInstallable_clicked();
102         void on_btnListInstalled_clicked();
103
104 private slots:
105         void on_listWidget_itemClicked(QListWidgetItem* item);
106         void on_actionLoad_file_triggered();
107         void on_actionOptions_triggered();
108         void on_actionView_log_triggered();
109         void on_actionClean_triggered();
110         void on_actionAbout_triggered();
111 };
112
113 #endif // MAINWINDOW_H