limit to 4 windows, and disable 'new window' menu item when that amount is reached
This commit is contained in:
parent
d79d45a117
commit
238c552599
|
@ -203,6 +203,12 @@ void EmuInstance::createWindow()
|
||||||
// if creating a secondary window, we may need to initialize its OpenGL context here
|
// if creating a secondary window, we may need to initialize its OpenGL context here
|
||||||
if (win->hasOpenGL() && (id != 0))
|
if (win->hasOpenGL() && (id != 0))
|
||||||
emuThread->initContext(id);
|
emuThread->initContext(id);
|
||||||
|
|
||||||
|
bool enable = (numWindows < kMaxWindows);
|
||||||
|
doOnAllWindows([=](MainWindow* win)
|
||||||
|
{
|
||||||
|
win->actNewWindow->setEnabled(enable);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmuInstance::deleteWindow(int id, bool close)
|
void EmuInstance::deleteWindow(int id, bool close)
|
||||||
|
@ -232,6 +238,14 @@ void EmuInstance::deleteWindow(int id, bool close)
|
||||||
// if the main window is closed, Qt will take care of closing any secondary windows
|
// if the main window is closed, Qt will take care of closing any secondary windows
|
||||||
deleteEmuInstance(instanceID);
|
deleteEmuInstance(instanceID);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bool enable = (numWindows < kMaxWindows);
|
||||||
|
doOnAllWindows([=](MainWindow* win)
|
||||||
|
{
|
||||||
|
win->actNewWindow->setEnabled(enable);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmuInstance::deleteAllWindows()
|
void EmuInstance::deleteAllWindows()
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "SaveManager.h"
|
#include "SaveManager.h"
|
||||||
|
|
||||||
const int kMaxWindows = 16;
|
const int kMaxWindows = 4;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -87,6 +87,7 @@ public:
|
||||||
melonDS::NDS* getNDS() { return nds; }
|
melonDS::NDS* getNDS() { return nds; }
|
||||||
|
|
||||||
MainWindow* getMainWindow() { return mainWindow; }
|
MainWindow* getMainWindow() { return mainWindow; }
|
||||||
|
int getNumWindows() { return numWindows; }
|
||||||
MainWindow* getWindow(int id) { return windowList[id]; }
|
MainWindow* getWindow(int id) { return windowList[id]; }
|
||||||
|
|
||||||
void doOnAllWindows(std::function<void(MainWindow*)> func, int exclude = -1);
|
void doOnAllWindows(std::function<void(MainWindow*)> func, int exclude = -1);
|
||||||
|
|
Loading…
Reference in New Issue