summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoram <am@f440f766-f032-0410-8965-dc7d17de2ca0>2009-07-09 15:29:14 +0000
committeram <am@f440f766-f032-0410-8965-dc7d17de2ca0>2009-07-09 15:29:14 +0000
commitb6a85b8b76a4e86783c4c83048918d30bb36bdb8 (patch)
tree8e08b0c11d213ce0f41e235adc9c5cc5a13442ec
parenta12045635b23c80e3dd9f51212c6ea89c240b94e (diff)
downloadSheMov-b6a85b8b76a4e86783c4c83048918d30bb36bdb8.tar.gz
SheMov-b6a85b8b76a4e86783c4c83048918d30bb36bdb8.tar.bz2
SheMov-b6a85b8b76a4e86783c4c83048918d30bb36bdb8.zip
-added statusbar and no. of selected files
git-svn-id: file:///var/svn/repos2/shemov/trunk@381 f440f766-f032-0410-8965-dc7d17de2ca0
-rw-r--r--filesystemwidget.cpp2
-rw-r--r--fileview.cpp4
-rw-r--r--fileview.h2
-rw-r--r--shemov.cpp19
-rw-r--r--shemov.h9
5 files changed, 35 insertions, 1 deletions
diff --git a/filesystemwidget.cpp b/filesystemwidget.cpp
index 6d711ce..24e769b 100644
--- a/filesystemwidget.cpp
+++ b/filesystemwidget.cpp
@@ -70,6 +70,7 @@ FilesystemWidget::FilesystemWidget(QWidget *parent) : QWidget(parent) {
connect(mDirView->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(directoryChanged(const QModelIndex &, const QModelIndex &)));
connect(mFileView, SIGNAL(activated(const QModelIndex &)), this, SLOT(fileViewActivated(const QModelIndex &)));
connect(mFileView, SIGNAL(upDir()), this, SLOT(parentDir()));
+ //connect(mFileView, SIGNAL(show()), this, SLOT(showItem()));
connect(mDirEdit, SIGNAL(returnPressed()), this, SLOT(directoryEdited()));
QSettings s;
@@ -123,6 +124,7 @@ void FilesystemWidget::directoryEdited(){
}
void FilesystemWidget::fileViewActivated(const QModelIndex &idx){
+ qDebug() << "trying to activate elem";
QModelIndex real = mFileProxy->mapToSource(idx);
if(mModel->isDir(real)){
mDirView->setCurrentIndex(mDirProxy->mapFromSource(real));
diff --git a/fileview.cpp b/fileview.cpp
index db34e0a..decf8e5 100644
--- a/fileview.cpp
+++ b/fileview.cpp
@@ -71,6 +71,10 @@ void FileView::keyPressEvent(QKeyEvent *e){
emit upDir();
e->accept();
break;
+ /*case Qt::Key_Enter:
+ emit showItem();
+ e->accept();
+ break;*/
default:
QTreeView::keyPressEvent(e);
}
diff --git a/fileview.h b/fileview.h
index 9c10347..ec89e10 100644
--- a/fileview.h
+++ b/fileview.h
@@ -14,6 +14,7 @@ class QContextMenuEvent;
class QKeyEvent;
class QResizeEvent;
class MessageDialog;
+class QModelIndex;
class FileView : public QTreeView {
Q_OBJECT
@@ -23,6 +24,7 @@ class FileView : public QTreeView {
signals:
void upDir();
+ void show();
public slots:
void markFiles();
diff --git a/shemov.cpp b/shemov.cpp
index 1a8a166..cafd47a 100644
--- a/shemov.cpp
+++ b/shemov.cpp
@@ -11,6 +11,9 @@
#include <QAction>
#include <QMenuBar>
#include <QMenu>
+#include <QStatusBar>
+#include <QLabel>
+#include <QItemSelection>
#include <QDebug>
#include "shemov.h"
@@ -26,9 +29,12 @@ SheMov::SheMov(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, fla
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(mTab);
+ createStatusbar();
createActions();
createMenus();
+ connect(mFSWidget->fileView()->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), this, SLOT(updateSelectionCount(const QItemSelection &, const QItemSelection &)));
+
QWidget *centralWidget = new QWidget;
centralWidget->setLayout(mainLayout);
setCentralWidget(centralWidget);
@@ -36,8 +42,19 @@ SheMov::SheMov(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, fla
}
+void SheMov::updateSelectionCount(const QItemSelection & /* sel */, const QItemSelection & /* prev */){
+ mSelectedItems->setText(QString::number(mFSWidget->fileView()->selectionModel()->selectedRows().count()));
+}
+
+void SheMov::createStatusbar(){
+ QLabel *selCountL = new QLabel(tr("Sel. Items"));
+ mSelectedItems = new QLabel("0");
+ mSelectedItems->setFrameStyle(QFrame::Panel | QFrame::Sunken);
+ statusBar()->addPermanentWidget(selCountL);
+ statusBar()->addPermanentWidget(mSelectedItems);
+}
+
void SheMov::createActions(){
- qDebug() << "Creating Actions";
mQuitA = new QAction(tr("Quit"), this);
mQuitA->setShortcut(tr("CTRL+q"));
connect(mQuitA, SIGNAL(triggered()), qApp, SLOT(quit()));
diff --git a/shemov.h b/shemov.h
index aff8624..9daf0a0 100644
--- a/shemov.h
+++ b/shemov.h
@@ -13,6 +13,8 @@
class QTabWidget;
class FilesystemWidget;
class QAction;
+class QLabel;
+class QItemSelection;
class SheMov : public QMainWindow {
Q_OBJECT
@@ -20,10 +22,17 @@ class SheMov : public QMainWindow {
SheMov(QWidget *parent = 0, Qt::WindowFlags flags = 0);
~SheMov() {};
+ private slots:
+ void updateSelectionCount(const QItemSelection &sel, const QItemSelection &prev);
+
private:
+ void createStatusbar();
void createActions();
void createMenus();
+ //Statusbar Items
+ QLabel *mSelectedItems;
+
//Actions
QAction *mQuitA;
QAction *mMarkFilesA;