Reuse the same preferences dialog, so the drop down menus keep the previous choices.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
86cc85bf8f
commit
2258d91208
4 changed files with 14 additions and 11 deletions
|
@ -1,6 +1,5 @@
|
|||
#include "preferences.h"
|
||||
#include <QFileDialog>
|
||||
#include <iostream>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -75,7 +74,7 @@ namespace
|
|||
|
||||
}
|
||||
|
||||
Preferences::Preferences(QWidget *parent, const Data & data) :
|
||||
Preferences::Preferences(QWidget *parent) :
|
||||
QDialog(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
|
@ -85,7 +84,10 @@ Preferences::Preferences(QWidget *parent, const Data & data) :
|
|||
myDisks.push_back(disk2);
|
||||
myHDs.push_back(hd1);
|
||||
myHDs.push_back(hd2);
|
||||
}
|
||||
|
||||
void Preferences::setData(const Data & data)
|
||||
{
|
||||
initialiseDisks(myDisks, data.disks);
|
||||
initialiseDisks(myHDs, data.hds);
|
||||
}
|
||||
|
@ -107,7 +109,6 @@ void Preferences::browseDisk(const std::vector<QComboBox *> & disks, const size_
|
|||
|
||||
if (disks[id]->currentIndex() >= 1)
|
||||
{
|
||||
std::cout << "Set path = " << disks[id]->currentText().toStdString() << std::endl;
|
||||
diskFileDialog.selectFile(disks[id]->currentText());
|
||||
}
|
||||
|
||||
|
|
|
@ -17,8 +17,9 @@ public:
|
|||
std::vector<QString> hds;
|
||||
};
|
||||
|
||||
explicit Preferences(QWidget *parent, const Data & data);
|
||||
explicit Preferences(QWidget *parent);
|
||||
|
||||
void setData(const Data & data);
|
||||
Data getData() const;
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
#include "emulator.h"
|
||||
#include "memorycontainer.h"
|
||||
#include "preferences.h"
|
||||
|
||||
#include <QMdiSubWindow>
|
||||
#include <QMessageBox>
|
||||
|
@ -113,7 +112,7 @@ BYTE __stdcall SpkrToggle (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCycle
|
|||
void VideoInitialize() {}
|
||||
|
||||
QApple::QApple(QWidget *parent) :
|
||||
QMainWindow(parent), myTimerID(0)
|
||||
QMainWindow(parent), myTimerID(0), myPreferences(this)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
|
@ -255,11 +254,11 @@ void QApple::on_actionOptions_triggered()
|
|||
}
|
||||
}
|
||||
|
||||
Preferences preferences(this, currentOptions);
|
||||
myPreferences.setData(currentOptions);
|
||||
|
||||
if (preferences.exec())
|
||||
if (myPreferences.exec())
|
||||
{
|
||||
const Preferences::Data newOptions = preferences.getData();
|
||||
const Preferences::Data newOptions = myPreferences.getData();
|
||||
|
||||
for (size_t i = 0; i < diskIDs.size(); ++i)
|
||||
{
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "ui_qapple.h"
|
||||
|
||||
#include <QElapsedTimer>
|
||||
#include "preferences.h"
|
||||
|
||||
class Emulator;
|
||||
|
||||
|
@ -46,13 +47,14 @@ private:
|
|||
|
||||
void stopTimer();
|
||||
|
||||
int myTimerID;
|
||||
Preferences myPreferences;
|
||||
|
||||
QElapsedTimer myElapsedTimer;
|
||||
QMdiSubWindow * myEmulatorWindow;
|
||||
Emulator * myEmulator;
|
||||
|
||||
int myMSGap;
|
||||
|
||||
int myTimerID;
|
||||
};
|
||||
|
||||
#endif // QAPPLE_H
|
||||
|
|
Loading…
Add table
Reference in a new issue