mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-15 05:40:01 -05:00
Reopen last opened tab in current session
Will reset to General tab on startup / scene collection change
This commit is contained in:
@@ -39,6 +39,7 @@ AdvSceneSwitcher::~AdvSceneSwitcher()
|
||||
{
|
||||
if (switcher) {
|
||||
switcher->settingsWindowOpened = false;
|
||||
switcher->lastOpenedTab = ui->tabWidget->currentIndex();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,6 +87,7 @@ void AdvSceneSwitcher::loadUI()
|
||||
setupMacroTab();
|
||||
|
||||
setTabOrder();
|
||||
setCurrentTab();
|
||||
restoreWindowGeo();
|
||||
checkFirstTimeSetup();
|
||||
|
||||
|
||||
@@ -460,6 +460,13 @@ void AdvSceneSwitcher::setTabOrder()
|
||||
connect(bar, &QTabBar::tabMoved, this, &AdvSceneSwitcher::on_tabMoved);
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::setCurrentTab()
|
||||
{
|
||||
if (switcher->lastOpenedTab >= 0) {
|
||||
ui->tabWidget->setCurrentIndex(switcher->lastOpenedTab);
|
||||
}
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::restoreWindowGeo()
|
||||
{
|
||||
if (switcher->saveWindowGeo && windowPosValid(switcher->windowPos)) {
|
||||
@@ -517,6 +524,9 @@ void SwitcherData::loadSettings(obs_data_t *obj)
|
||||
loadSceneTriggers(obj);
|
||||
loadGeneralSettings(obj);
|
||||
loadHotkeys(obj);
|
||||
|
||||
// Reset on startup and scene collection change
|
||||
switcher->lastOpenedTab = -1;
|
||||
}
|
||||
|
||||
void SwitcherData::saveSettings(obs_data_t *obj)
|
||||
|
||||
@@ -78,6 +78,7 @@ public:
|
||||
void setupNetworkTab();
|
||||
void setupMacroTab();
|
||||
void setTabOrder();
|
||||
void setCurrentTab();
|
||||
void restoreWindowGeo();
|
||||
void checkFirstTimeSetup();
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ struct SwitcherData {
|
||||
SwitcherThread *th = nullptr;
|
||||
|
||||
bool settingsWindowOpened = false;
|
||||
int lastOpenedTab = -1;
|
||||
bool firstBoot = true;
|
||||
|
||||
std::condition_variable cv;
|
||||
|
||||
Reference in New Issue
Block a user