File: mainwindow.h

package info (click to toggle)
dc-qt 0.2.0.alpha-4
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,948 kB
  • ctags: 5,361
  • sloc: cpp: 28,936; makefile: 19
file content (81 lines) | stat: -rw-r--r-- 1,972 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "ui_mainwindow.h"
#include "backendconnection.h"
#include "settingsdialog.h"
#include "commandhandlers.h"
#include "sessionmanager.h"
#include "searchmanager.h"
#include "globalusermodel.h"
#include "queuemodel.h"
#include "finishedmodel.h"
#include "transferlistmodel.h"
#include "userfilemodel.h"

#include <QMainWindow>
#include <QPointer>
#include <boost/shared_ptr.hpp>
#include <rpcdriver.h>

class ConnectDialog;
class QLabel;

using namespace ui_cmd_handlers;

class MainWindow : public QMainWindow
{
    Q_OBJECT
public:
    MainWindow();
    virtual ~MainWindow();

    /**
    * Connects to the backend. TODO add code for connecting to another instance when already connected 
    */
    bool connectToBackend(const char* hostname,int port);

	public slots:
	/**
	* Connects to the backend using local settings.
	*/
	void connectToBackend();
	
protected:
    virtual void closeEvent(QCloseEvent*);

private:
    Ui::MainWindow ui;
	QLabel *shareStatusLbl;
	boost::shared_ptr<BackendConnection> backendConnection;
	QPointer<SettingsDialog> settingsDialog;
	QPointer<SessionManager> sessionManager;
	QPointer<SearchManager> searchManager;
	QPointer<ConnectDialog> connectDialog;
	QPointer<QueueModel> queueModel;
	QPointer<FinishedModel> finishedModel;
	QPointer<TransferListModel> transferModel;
				
    boost::shared_ptr< rpc::RpcClientDriver > driver;
	boost::shared_ptr< GlobalUserModel > userModel;
	
	int backendRetriesLeft;
	
	//! Registers the command handlers	
	void registerCommandHandlers();

	QString password;
	
private slots:
    void on_actionConnect_triggered();
	void on_actionSettings_triggered();
	void on_actionSearch_triggered();
	void on_actionForceAttempt_triggered();
	void on_actionCancelDownload_triggered();
	void userFileListing( const UserFileModelPtr& model );
	void onDisconnectPressed();
	void updateTotalShareStatus(qint64);
	void onQueueContextMenu(const QPoint&);
};

#endif