From 1e247c6fea51dab6815e3a15f22cd08e56039e89 Mon Sep 17 00:00:00 2001 From: Arno Date: Sun, 23 Jun 2013 05:47:10 +0200 Subject: Make the archive cache useful Read the cache if there is one, if not, read it in another thread and update the view when it's done. --- archiveview.cpp | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'archiveview.cpp') diff --git a/archiveview.cpp b/archiveview.cpp index 263bc41..166be89 100644 --- a/archiveview.cpp +++ b/archiveview.cpp @@ -23,13 +23,8 @@ ArchiveView::ArchiveView(QWidget *parent) : QWidget(parent), mConstructing(true) { QSettings s; mArchiveModel = static_cast(SmGlobals::instance()->model("ArchiveModel")); - connect(mArchiveModel->collector(), SIGNAL(started()), this, SLOT(collectorStarted())); - connect(mArchiveModel->collector(), SIGNAL(finished()), this, SLOT(collectorFinished())); connect(mArchiveModel, SIGNAL(needRefresh()), this, SLOT(refreshArchive())); connect(mArchiveModel, SIGNAL(databaseError(QString)), this, SLOT(showDatabaseError(QString))); - mProgress = new ArchiveProgressDialog(this); - mProgress->setHidden(true); - connect(mArchiveModel->collector(), SIGNAL(message(QString)), mProgress, SLOT(setMessage(QString))); mProxy = new ArchiveProxy; mProxy->setSourceModel(mArchiveModel); @@ -104,10 +99,6 @@ void ArchiveView::writeSettings() { s.setValue("archivemodel/expandeditems", expandedItems); } -QWidget *ArchiveView::progressDialog(){ - return qobject_cast(mProgress); -} - void ArchiveView::refreshArchive(){ writeSettings(); mArchiveModel->refresh(); @@ -137,18 +128,6 @@ void ArchiveView::clearFilter(){ mTree->collapseAll(); } -void ArchiveView::collectorStarted(){ - if(mConstructing){ - return; - } - mProgress->show(); -} - -void ArchiveView::collectorFinished(){ - mProgress->hide(); - setExpanded(); -} - void ArchiveView::showDatabaseError(const QString &errorMsg){ QMessageBox::critical(this, tr("Database Error"), errorMsg); } @@ -201,18 +180,6 @@ void ArchiveTree::impossible(const QString msg){ QMessageBox::critical(this, tr("Error"), msg); } -ArchiveProgressDialog::ArchiveProgressDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f){ - QHBoxLayout *mainLayout = new QHBoxLayout; - mMessage = new QLabel; - mainLayout->addWidget(mMessage); - setLayout(mainLayout); -} - -void ArchiveProgressDialog::setMessage(const QString &msg){ - QString message = QString(tr("Gathering data... please wait!
  • %1
")).arg(msg); - mMessage->setText(message); -} - ArchiveFiles::ArchiveFiles(QWidget *parent) : SmTreeView(parent){ } -- cgit v1.2.3-70-g09d2