transmission/qt/mainwin.h

195 lines
5.3 KiB
C
Raw Normal View History

2009-04-09 18:55:47 +00:00
/*
* This file Copyright (C) Mnemosyne LLC
2009-04-09 18:55:47 +00:00
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
2009-04-09 18:55:47 +00:00
*
* $Id$
2009-04-09 18:55:47 +00:00
*/
#ifndef MAIN_WINDOW_H
#define MAIN_WINDOW_H
#include <ctime>
#include <QCheckBox>
#include <QLineEdit>
2009-04-09 18:55:47 +00:00
#include <QIcon>
#include <QMainWindow>
#include <QMap>
#include <QPushButton>
2009-04-09 18:55:47 +00:00
#include <QSet>
#include <QSystemTrayIcon>
#include <QTimer>
#include <QWidgetList>
extern "C" {
struct tr_benc;
};
#include "filters.h"
2009-04-09 18:55:47 +00:00
#include "torrent-filter.h"
#include "ui_mainwin.h"
class ActionDelegator;
class Prefs;
class Details;
2009-04-09 18:55:47 +00:00
class Session;
class TorrentDelegate;
class TorrentDelegateMin;
class TorrentModel;
class QAction;
class QLabel;
class QMenu;
2009-04-09 18:55:47 +00:00
class QModelIndex;
class QSortFilterProxyModel;
class Filterbar;
2009-04-09 18:55:47 +00:00
class TrMainWindow: public QMainWindow
{
Q_OBJECT
private:
virtual void closeEvent( QCloseEvent * event );
2009-04-09 18:55:47 +00:00
private:
time_t myLastFullUpdateTime;
QDialog * mySessionDialog;
2009-04-09 18:55:47 +00:00
QDialog * myPrefsDialog;
QDialog * myAboutDialog;
QDialog * myStatsDialog;
Details * myDetailsDialog;
2009-04-09 18:55:47 +00:00
QCheckBox * myFileDialogOptionsCheck;
QSystemTrayIcon myTrayIcon;
TorrentFilter myFilterModel;
TorrentDelegate * myTorrentDelegate;
TorrentDelegateMin * myTorrentDelegateMin;
Session& mySession;
Prefs& myPrefs;
TorrentModel& myModel;
Ui_MainWindow ui;
QIcon mySpeedModeOffIcon;
QIcon mySpeedModeOnIcon;
time_t myLastSendTime;
time_t myLastReadTime;
QTimer myNetworkTimer;
QTimer myRefreshTrayIconTimer;
QTimer myRefreshActionSensitivityTimer;
QAction * myDlimitOffAction;
QAction * myDlimitOnAction;
QAction * myUlimitOffAction;
QAction * myUlimitOnAction;
QAction * myRatioOffAction;
QAction * myRatioOnAction;
2009-04-09 18:55:47 +00:00
private:
QIcon getStockIcon( const QString&, int fallback=-1 );
private:
QSet<int> getSelectedTorrents( ) const;
void updateNetworkIcon( );
QWidgetList myHidden;
public slots:
void openURL( QString );
2009-04-09 18:55:47 +00:00
private slots:
void onPrefsDestroyed( );
void openPreferences( );
void onDetailsDestroyed( );
2009-04-09 18:55:47 +00:00
void showTotalRatio( );
void showTotalTransfer( );
void showSessionRatio( );
void showSessionTransfer( );
void refreshVisibleCount( );
void refreshTitle( );
2009-04-09 18:55:47 +00:00
void refreshStatusBar( );
void refreshTrayIcon( );
void refreshTrayIconSoon( );
2009-04-09 18:55:47 +00:00
void openTorrent( );
void openURL( );
2009-04-09 18:55:47 +00:00
void newTorrent( );
void trayActivated( QSystemTrayIcon::ActivationReason );
void refreshPref( int key );
void addTorrents( const QStringList& filenames );
void removeTorrents( const bool deleteFiles );
void openDonate( );
2009-04-09 18:55:47 +00:00
void openHelp( );
void openFolder( );
void copyMagnetLinkToClipboard( );
void setLocation( );
2009-04-09 18:55:47 +00:00
void openProperties( );
void toggleSpeedMode( );
void dataReadProgress( );
void dataSendProgress( );
void toggleWindows( bool doShow );
void onSetPrefs( );
void onSetPrefs( bool );
void onSessionSourceChanged( );
void onModelReset( );
2009-04-09 18:55:47 +00:00
private slots:
void setSortPref ( int );
void setSortAscendingPref ( bool );
void onSortByActivityToggled ( bool );
void onSortByAgeToggled ( bool );
void onSortByETAToggled ( bool );
void onSortByNameToggled ( bool );
void onSortByProgressToggled ( bool );
void onSortByRatioToggled ( bool );
void onSortBySizeToggled ( bool );
void onSortByStateToggled ( bool );
private:
QWidget * myFilterBar;
private:
QMenu * createOptionsMenu( void );
QWidget * createStatusBar( void );
QWidget * myStatusBar;
QPushButton * myAltSpeedButton;
QPushButton * myOptionsButton;
QLabel * myVisibleCountLabel;
QPushButton * myStatsModeButton;
QLabel * myStatsLabel;
QLabel * myDownloadSpeedLabel;
QLabel * myUploadSpeedLabel;
QLabel * myNetworkLabel;
public slots:
2009-04-09 18:55:47 +00:00
void startAll( );
void startSelected( );
void pauseAll( );
void pauseSelected( );
void removeSelected( );
void deleteSelected( );
void verifySelected( );
void reannounceSelected( );
void addTorrent( const QString& filename );
void onNetworkTimer( );
private:
void clearSelection( );
public slots:
void setToolbarVisible( bool );
void setFilterbarVisible( bool );
void setStatusbarVisible( bool );
void setCompactView( bool );
2009-04-09 18:55:47 +00:00
void refreshActionSensitivity( );
void refreshActionSensitivitySoon( );
void wrongAuthentication( );
2009-04-09 18:55:47 +00:00
public:
TrMainWindow( Session&, Prefs&, TorrentModel&, bool minized );
virtual ~TrMainWindow( );
protected:
virtual void dragEnterEvent( QDragEnterEvent * );
virtual void dropEvent( QDropEvent * );
2009-04-09 18:55:47 +00:00
};
#endif