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
82
83
84
85
86
87
88
89
90
91
92
93
|
#include <QTabWidget>
#include <QLabel>
#include <QStatusBar>
#include <QAction>
#include <QToolBar>
#include <QMenu>
#include <QMenuBar>
#include <QApplication>
#include "shemovcleaner.h"
#include "torrentwidget.h"
ShemovCleaner::ShemovCleaner(QWidget *parent, Qt::WindowFlags f) : QMainWindow(parent, f) {
//general setup
qApp->setWindowIcon(QIcon(":/clean_tampon.png"));
setMinimumWidth(800);
setMinimumHeight(600);
mTorrentTab = new TorrentWidget;
mTab = new QTabWidget;
mTab->addTab(mTorrentTab, tr("Torrents"));
setCentralWidget(mTab);
createStatusBar();
createActions();
connect(mTorrentTab, SIGNAL(statusMessage(QString)), this, SLOT(statusBarMessage(QString)));
connect(mTorrentTab, SIGNAL(selectionCountChanged(QString)), this, SLOT(setSelectionCount(QString)));
}
void ShemovCleaner::statusBarMessage(const QString &msg){
statusBar()->showMessage(msg);
}
void ShemovCleaner::setSelectionCount(const QString &msg){
mSelected->setText(msg);
}
void ShemovCleaner::createStatusBar(){
QLabel *l1 = new QLabel(tr("Sel."));
mSelected = new QLabel("000/000");
mSelected->setFrameStyle(QFrame::Panel | QFrame::Sunken);
statusBar()->addPermanentWidget(l1);
statusBar()->addPermanentWidget(mSelected);
}
void ShemovCleaner::createActions(){
//Application
QAction *quitA = new QAction(tr("Quit"), this);
connect(quitA, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));
//TorrentWidget
mTorRefreshA = new QAction(QIcon(":/refresh.png"), tr("Refresh"), this);
connect(mTorRefreshA, SIGNAL(triggered()), mTorrentTab, SLOT(gatherData()));
mTorDeleteA = new QAction(QIcon(":/delete.png"), tr("Delete..."), this);
connect(mTorDeleteA, SIGNAL(triggered()), mTorrentTab, SLOT(deleteFiles()));
mTorMoveA = new QAction(QIcon(":/diaper.png"), tr("Move..."), this);
connect(mTorMoveA, SIGNAL(triggered()), mTorrentTab, SLOT(moveFiles()));
mTorInfoA = new QAction(QIcon(":/huge_bra.png"), tr("Torrent info..."), this);
connect(mTorInfoA, SIGNAL(triggered()), mTorrentTab, SLOT(torrentInfo()));
mTorDirA = new QAction(QIcon(":/folder.png"), tr("Select folder..."), this);
connect(mTorDirA, SIGNAL(triggered()), mTorrentTab, SLOT(selectDir()));
mTorrentTab->toolBar()->addAction(mTorRefreshA);
mTorrentTab->toolBar()->addSeparator();
mTorrentTab->toolBar()->addAction(mTorDirA);
mTorrentTab->toolBar()->addAction(mTorMoveA);
mTorrentTab->toolBar()->addAction(mTorDeleteA);
mTorrentTab->toolBar()->addSeparator();
mTorrentTab->toolBar()->addAction(mTorInfoA);
QMenu *torFileM = new QMenu(tr("File"));
torFileM->addAction(mTorDirA);
torFileM->addAction(mTorRefreshA);
torFileM->addSeparator();
torFileM->addAction(quitA);
mTorrentTab->menuBar()->addMenu(torFileM);
QMenu *torEditM = new QMenu(tr("Edit"));
torEditM->addAction(mTorDeleteA);
torEditM->addAction(mTorMoveA);
torEditM->addSeparator();
torEditM->addAction(mTorInfoA);
mTorrentTab->menuBar()->addMenu(torEditM);
mTorrentTab->addAction(mTorInfoA);
mTorrentTab->addAction(createSeparator());
mTorrentTab->addAction(mTorRefreshA);
mTorrentTab->addAction(createSeparator());
mTorrentTab->addAction(mTorMoveA);
mTorrentTab->addAction(mTorDeleteA);
mTorrentTab->addAction(createSeparator());
mTorrentTab->addAction(mTorDirA);
}
QAction *ShemovCleaner::createSeparator(){
QAction *retval = new QAction(this);
retval->setSeparator(true);
return retval;
}
|