Saving qtab current index ( current playlist ).
This commit is contained in:
parent
0a1e7916d8
commit
b303d59b4c
|
@ -304,10 +304,8 @@ MainWindow::MainWindow(QNetworkAccessManager* network, QWidget *parent)
|
||||||
library_->StartThreads();
|
library_->StartThreads();
|
||||||
|
|
||||||
playlistManager_->SetTabWidget(ui_.tabWidget);
|
playlistManager_->SetTabWidget(ui_.tabWidget);
|
||||||
qDebug() << "restoring";
|
|
||||||
bool bRestored = playlistManager_->Restore() ;
|
QTimer::singleShot(500,this,SLOT(InitPlaylists())) ;
|
||||||
if ( !bRestored )
|
|
||||||
playlistManager_->addPlaylist();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -717,3 +715,8 @@ void MainWindow::CurrentTabChanged(int index ){
|
||||||
void MainWindow::CurrentPlaylistChanged(Playlist* pPlaylist){
|
void MainWindow::CurrentPlaylistChanged(Playlist* pPlaylist){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
void MainWindow::InitPlaylists(){
|
||||||
|
bool bRestored = playlistManager_->Restore() ;
|
||||||
|
if ( !bRestored )
|
||||||
|
playlistManager_->addPlaylist();
|
||||||
|
}
|
||||||
|
|
|
@ -91,6 +91,8 @@ class MainWindow : public QMainWindow {
|
||||||
|
|
||||||
void CurrentPlaylistChanged( Playlist * pPlaylist ) ;
|
void CurrentPlaylistChanged( Playlist * pPlaylist ) ;
|
||||||
|
|
||||||
|
void InitPlaylists() ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SaveGeometry();
|
void SaveGeometry();
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ void PlaylistManager::Save() const{
|
||||||
p->SaveR() ;
|
p->SaveR() ;
|
||||||
}
|
}
|
||||||
s.setValue("numberofplaylists", playlistCount_ ) ;
|
s.setValue("numberofplaylists", playlistCount_ ) ;
|
||||||
|
s.setValue("currentplaylistindex",pTabWidget_->currentIndex());
|
||||||
}
|
}
|
||||||
bool PlaylistManager::Restore(){
|
bool PlaylistManager::Restore(){
|
||||||
Q_ASSERT ( pTabWidget_ ) ;
|
Q_ASSERT ( pTabWidget_ ) ;
|
||||||
|
@ -102,6 +103,9 @@ bool PlaylistManager::Restore(){
|
||||||
pCurrentPlaylistView_ = playListView ;
|
pCurrentPlaylistView_ = playListView ;
|
||||||
playlists_ << playList ;
|
playlists_ << playList ;
|
||||||
}
|
}
|
||||||
|
int currentIndex = s.value("currentplaylistindex").toInt(&bOk);
|
||||||
|
if(bOk)
|
||||||
|
pTabWidget_->setCurrentIndex(currentIndex);
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue