1 /***************************************************************************
2 * Copyright (C) 2010 by Ixonos Plc *
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. *
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. *
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 ***************************************************************************/
21 #include <QMainWindow>
24 #include <QStringList>
26 #include "PluginInterface.h"
27 #include "QBittorrentSession.h"
32 class PreferencesDialog;
33 class PluginInterface;
36 @author Lassi Väätämöinen <lassi.vaatamoinen@ixonos.com>
38 class MainWindow : public QMainWindow, public qtrapids::PluginHostInterface
44 virtual ~MainWindow();
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);
56 void itemSelected(bool enabled);
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);
75 void RestoreSettings();
76 void StartTorrentFromBufferData(char const* data, int size);
79 QTabWidget *tabWidget_;
80 DownloadView *dlView_;
82 QWidget *searchWidget_;
83 PreferencesDialog *preferencesDialog_;
85 QList<QDir> pluginDirs_;
86 QStringList pluginFileNames_;
87 //std::vector< std::auto_ptr<QTorrentHandle> const > torrentHandles_;
89 qtrapids::QBittorrentSession btSession_;
92 //bool IsNewTorrent(std::auto_ptr<QTorrentHandle> handlePtr);