Added build script of Debian
[qtrapids] / src / gui / MainWindow.h
1 /***************************************************************************
2  *   Copyright (C) 2010 by Ixonos Plc   *
3  *                                                                         *
4  *   This program 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; version 2 of the License.               *
7  *                                                                         *
8  *   This program is distributed in the hope that it will be useful,       *
9  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
10  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
11  *   GNU General Public License for more details.                          *
12  *                                                                         *
13  *   You should have received a copy of the GNU General Public License     *
14  *   along with this program; if not, write to the                         *
15  *   Free Software Foundation, Inc.,                                       *
16  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
17  ***************************************************************************/
18 #ifndef MAINWINDOW_H
19 #define MAINWINDOW_H
20
21 #include <QMainWindow>
22 #include <QSettings>
23 #include <QDir>
24 #include <QStringList>
25
26 #include "PluginInterface.h"
27 #include "QBittorrentSession.h"
28
29 class QTabWidget;
30 class DownloadView;
31 class SeedView;
32 class PreferencesDialog;
33 class PluginInterface; 
34
35 /**
36         @author Lassi Väätämöinen <lassi.vaatamoinen@ixonos.com>
37 */
38 class MainWindow : public QMainWindow, public qtrapids::PluginHostInterface
39 {
40         Q_OBJECT
41
42         public:
43     MainWindow();
44     virtual ~MainWindow();
45                 
46                 // Implemented from PluginHostInterface
47                 virtual bool setGui(QWidget* widget, PluginWidgetType type = UNKNOWN_TYPE, qtrapids::PluginInterface* plugin = NULL);
48                 virtual void addPluginWidget(QWidget* widget, PluginWidgetType type = UNKNOWN_TYPE);
49                 virtual void addToolbar(QWidget* widget, PluginWidgetType type = UNKNOWN_TYPE);
50                 virtual void addToolItem(QWidget* widget, PluginWidgetType type = UNKNOWN_TYPE);
51                 virtual void addMenu(QWidget* widget, PluginWidgetType type = UNKNOWN_TYPE);
52                 virtual void addMenuItem(QWidget* widget, PluginWidgetType type = UNKNOWN_TYPE);
53                 virtual bool eventRequest(QVariant param, PluginRequest req = UNKNOWN_REQUEST);
54                 
55         signals:
56                 void itemSelected(bool enabled);
57                 
58         public slots:
59         private slots:
60                 void on_openAction_clicked();
61                 void on_removeAction_clicked();
62                 void on_quitAction_clicked();
63                 void on_preferencesAction_clicked();
64                 void on_aboutAction_clicked();
65                 void on_aboutQtAction_clicked();
66                 void on_tabWidget_tabCloseRequested(int index);
67                 void on_downloadItemSelectionChanged();
68                 void on_seedItemSelectionChanged();
69                 void handleToolBarAction(QAction* action);
70                 void on_torrentFileSelected(const QString& file);
71                 void on_alert(std::auto_ptr<Alert> al);
72         
73         private:
74                 void LoadPlugins();
75                 void RestoreSettings();
76                 void StartTorrentFromBufferData(char const* data, int size);
77                 
78         private:
79                 QTabWidget *tabWidget_;
80                 DownloadView *dlView_;
81                 SeedView *seedView_;
82                 QWidget *searchWidget_;
83                 PreferencesDialog *preferencesDialog_;
84                 QSettings settings_;
85                 QList<QDir> pluginDirs_;
86                 QStringList pluginFileNames_;
87                 //std::vector< std::auto_ptr<QTorrentHandle> const > torrentHandles_;
88                 
89                 qtrapids::QBittorrentSession btSession_;
90                 
91
92                 //bool IsNewTorrent(std::auto_ptr<QTorrentHandle> handlePtr);
93 };
94
95 #endif