summaryrefslogtreecommitdiffstats
path: root/shemovcleaner.cpp
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2016-09-04 13:16:09 +0200
committerArno <arno@disconnect.de>2016-09-04 13:16:09 +0200
commitc930104f93104649ad4ae5b9e23e65a3fa2c058d (patch)
tree50568d6557d0cce8494b9445b993b49de15c976e /shemovcleaner.cpp
parent0603a0c7d29413f99568d3c4898712f4f6289a7c (diff)
downloadShemovCleaner-c930104f93104649ad4ae5b9e23e65a3fa2c058d.tar.gz
ShemovCleaner-c930104f93104649ad4ae5b9e23e65a3fa2c058d.tar.bz2
ShemovCleaner-c930104f93104649ad4ae5b9e23e65a3fa2c058d.zip
Add ProgressBar to status bar
Indicate progress of gathering data in status bar Also (yes, I know, should be a separate commit) fix keyboard navigation by getting rid of ShemovCleaner::keyPressEvent and replace it with buddies in QTabWidget.
Diffstat (limited to 'shemovcleaner.cpp')
-rw-r--r--shemovcleaner.cpp38
1 files changed, 9 insertions, 29 deletions
diff --git a/shemovcleaner.cpp b/shemovcleaner.cpp
index f2cdbd2..dc45fc6 100644
--- a/shemovcleaner.cpp
+++ b/shemovcleaner.cpp
@@ -12,6 +12,7 @@
#include <QTreeView>
#include <QSettings>
#include <QKeyEvent>
+#include <QProgressBar>
#include "shemovcleaner.h"
#include "torrentwidget.h"
@@ -25,15 +26,17 @@ ShemovCleaner::ShemovCleaner(QWidget *parent, Qt::WindowFlags f) : QMainWindow(p
setMinimumWidth(800);
setMinimumHeight(600);
openDatabase();
+ createStatusBar();
mTorrentTab = new TorrentWidget;
mTab = new QTabWidget;
mFileTab = new FileWidget;
- mTab->addTab(mTorrentTab, tr("Torrents"));
- mTab->addTab(mFileTab, tr("Files"));
+ mFileTab->setProgressBar(mProgressBar);
+ mFileTab->gatherData();
+ mTab->addTab(mTorrentTab, tr("&Torrents"));
+ mTab->addTab(mFileTab, tr("Fi&les"));
setCentralWidget(mTab);
- createStatusBar();
createActions();
connect(mTorrentTab, SIGNAL(statusMessage(QString)), this, SLOT(statusBarMessage(QString)));
connect(mTorrentTab, SIGNAL(selectionCountChanged(QString)), this, SLOT(setSelectionCount(QString)));
@@ -83,32 +86,6 @@ void ShemovCleaner::closeEvent(QCloseEvent *e){
QMainWindow::closeEvent(e);
}
-void ShemovCleaner::keyPressEvent(QKeyEvent *e){
- //Yes, this could be much more terse, but this is readable!
- if(e->key() == Qt::Key_Left && (e->modifiers() & Qt::AltModifier)){
- int curTabIdx = mTab->currentIndex();
- if(curTabIdx - 1 < 0){
- curTabIdx = mTab->count() - 1;
- }else{
- --curTabIdx;
- }
- mTab->setCurrentIndex(curTabIdx);
- e->accept();
- return;
- }
- if(e->key() == Qt::Key_Right && (e->modifiers() & Qt::AltModifier)){
- int curTabIdx = mTab->currentIndex();
- if(curTabIdx + 1 >= mTab->count()){
- curTabIdx = 0;
- }else{
- ++curTabIdx;
- }
- mTab->setCurrentIndex(curTabIdx);
- e->accept();
- return;
- }
-}
-
void ShemovCleaner::createStatusBar(){
QLabel *l1 = new QLabel(tr("Sel."));
mSelected = new QLabel("000/000");
@@ -116,6 +93,9 @@ void ShemovCleaner::createStatusBar(){
QLabel *l2 = new QLabel(tr("Dur."));
mDuration = new QLabel("00:00:00");
mDuration->setFrameStyle(QFrame::Panel | QFrame::Sunken);
+ mProgressBar = new QProgressBar;
+ mProgressBar->setMaximumWidth(150);
+ statusBar()->addPermanentWidget(mProgressBar);
statusBar()->addPermanentWidget(l1);
statusBar()->addPermanentWidget(mSelected);
statusBar()->addPermanentWidget(l2);