From 9092371858356efde3e2d6d002f692308127389c Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 23 Oct 2010 09:20:18 +0200 Subject: Fixed crash when remembering selected tab, improve performance Strange things happen. As stated in commit 19674f6, SheMov crashed when setting the archive as current tab and then changing to filesystem view. This can be resolved by first showing the MainWindow and then applying the display changes. I guess it's an qt internal thing. Also vastly improved performance when hovering by only entering the hover code path when we actually have a HoverEvent. Before CPU usage spiked at 100% even if SheMov was idle. --- shemov.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'shemov.cpp') diff --git a/shemov.cpp b/shemov.cpp index f00caf5..8009daf 100644 --- a/shemov.cpp +++ b/shemov.cpp @@ -61,6 +61,8 @@ SheMov::SheMov(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, fla 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(this, SIGNAL(configChanged()), mATree->seriesWidget()->seriesTree(), SLOT(readConfig())); + connect(this, SIGNAL(configChanged()), mATree->filesWidget()->filesTree(), SLOT(readConfig())); //newmoviewizard mNewMovieWizard = new NewMovieWizard(this); @@ -83,14 +85,15 @@ SheMov::SheMov(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, fla connect(mFSWidget->dirModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(setFsFree())); connect(mFSWidget->dirModel(), SIGNAL(layoutChanged()), this, SLOT(setFsFree())); connect(mFSWidget->dirModel(), SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(setFsFree())); + connect(this, SIGNAL(configChanged()), mFSWidget->fileView(), SLOT(readConfig())); QWidget *centralWidget = new QWidget; centralWidget->setLayout(mainLayout); setCentralWidget(centralWidget); + show(); mATree->seriesWidget()->readSettings(); mFSWidget->readSettings(); readSettings(); - show(); mFSWidget->fileView()->setFocus(Qt::ActiveWindowFocusReason); } @@ -142,8 +145,7 @@ void SheMov::configure(){ dlg.exec(); createOpenWithMenuFS(); createOpenWithMenuAV(); - mATree->seriesWidget()->seriesTree()->readConfig(); - mATree->filesWidget()->filesTree()->readConfig(); + emit configChanged(); } void SheMov::tabChanged(int newTab){ @@ -606,6 +608,10 @@ void SheMov::readSettings(){ if(winState){ setWindowState(Qt::WindowMaximized); } + int currentTab = s.value("ui/selectedtab", 0).toInt(); + if(currentTab < mTab->count() && currentTab != mTab->currentIndex()){ + mTab->setCurrentIndex(currentTab); + } int filesMode = s.value("ui/filestreemode", FilesTreeModel::Normal).toInt(); switch(filesMode){ case FilesTreeModel::Normal: -- cgit v1.2.3-70-g09d2