diff options
Diffstat (limited to 'shemov.cpp')
-rw-r--r-- | shemov.cpp | 37 |
1 files changed, 10 insertions, 27 deletions
@@ -76,16 +76,19 @@ SheMov::SheMov(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, fla mATree = new ArchiveTreeView; mTab->addTab(mATree, "Archive"); connect(mATree->filesWidget(), SIGNAL(statusMessage(QString)), this, SLOT(statusbarMessage(QString))); - connect(mATree->filesWidget(), SIGNAL(sizeChanged(qint64)), this, SLOT(setSize(qint64))); connect(mATree, SIGNAL(needWindowTitleChange(QString)), this, SLOT(setWindowTitle(QString))); - connect(mATree->filesWidget()->filesTree()->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), this, SLOT(updateSelectionCount(const QItemSelection &, const QItemSelection &))); - connect(mATree->seriesWidget()->seriesTree()->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(updateSelectionCount(QItemSelection,QItemSelection))); + connect(mATree->filesWidget(), SIGNAL(numSelected(int)), this, SLOT(updateSelectedCount(int))); + connect(mATree->filesWidget(), SIGNAL(selectedSize(qint64)), this, SLOT(setSize(qint64))); + connect(mATree->filesWidget(), SIGNAL(statusMessage(QString)), this, SLOT(statusbarMessage(QString))); connect(this, SIGNAL(configChanged()), mATree, SLOT(readSettings())); //pictures mPicWidget = new PicturesWidget; mTab->addTab(mPicWidget, tr("Pictures")); connect(mPicWidget, SIGNAL(needWindowTitleChange(QString)), this, SLOT(setWindowTitle(QString))); + connect(mPicWidget->picView(), SIGNAL(newMappings(QString)), this, SLOT(statusbarMessage(QString))); + connect(mPicWidget->picView(), SIGNAL(numSelected(int)), this, SLOT(updateSelectedCount(int))); + connect(mPicWidget->picView(), SIGNAL(selectedSize(qint64)), this, SLOT(setSize(qint64))); //newmoviewizard + dbanalyzer mNewMovieWizard = new NewMovieWizard(this); @@ -103,7 +106,8 @@ SheMov::SheMov(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, fla createToolBar(); setFsFree(); - connect(mFSWidget->fileView()->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), this, SLOT(updateSelectionCount(const QItemSelection &, const QItemSelection &))); + connect(mFSWidget->fileView(), SIGNAL(selectedSize(qint64)), this, SLOT(setSize(qint64))); + connect(mFSWidget->fileView(), SIGNAL(numSelected(int)), this, SLOT(updateSelectedCount(int))); connect(mFSWidget, SIGNAL(windowTitle(QString)), this, SLOT(setWindowTitle(QString))); connect(mFSWidget->fileView(), SIGNAL(statusbarMessage(const QString &)), this, SLOT(statusbarMessage(const QString &))); connect(mFSWidget, SIGNAL(statusbarMessage(const QString &)), this, SLOT(statusbarMessage(const QString &))); @@ -142,28 +146,8 @@ void SheMov::closeEvent(QCloseEvent *event){ event->accept(); } -void SheMov::updateSelectionCount(const QItemSelection & /* sel */, const QItemSelection & /* prev */){ - QLocale l; - switch (mTab->currentIndex()) { - case 0: { - int selCount = mFSWidget->fileView()->selectionModel()->selectedRows().count(); - mSelectedItems->setText(QString::number(selCount)); - qint64 selSize(0); - foreach(QModelIndex idx, mFSWidget->fileView()->selectionModel()->selectedRows()){ - QModelIndex real = mFSWidget->fileProxy()->mapToSource(idx); - if(real.isValid()){ - QFileInfo fi = mFSWidget->dirModel()->fileInfo(real); - selSize += fi.size(); - } - } - mSelectedSize->setText(QString(tr("<span style=\"color:#000000\">%1</span>")).arg(l.toString((selSize)))); - break; - } - case 1: { - int selCount = mATree->filesWidget()->filesTree()->selectionModel()->selectedRows().count(); - mSelectedItems->setText(QString::number(selCount)); - } - } +void SheMov::updateSelectedCount(int count){ + mSelectedItems->setText(QString::number(count)); } void SheMov::statusbarMessage(const QString &message){ @@ -196,7 +180,6 @@ void SheMov::tabChanged(int newTab){ mShowTreeGroup->setEnabled(newTab == 1); mPicActionGroup->setEnabled(newTab == 2); mFilterFavoritesA->setEnabled(newTab == 1); - updateSelectionCount(QItemSelection(), QItemSelection()); } void SheMov::setFsFree(){ |