mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Revert the singleton PR
It turns out that this isn't working the way it was intended to. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
400b218f76
commit
9ae7040a91
15 changed files with 118 additions and 89 deletions
|
|
@ -109,6 +109,8 @@ extern "C" int updateProgress(const char *text)
|
|||
return progressDialogCanceled;
|
||||
}
|
||||
|
||||
MainWindow *MainWindow::m_Instance = nullptr;
|
||||
|
||||
extern "C" void showErrorFromC(char *buf)
|
||||
{
|
||||
QString error(buf);
|
||||
|
|
@ -126,6 +128,8 @@ MainWindow::MainWindow() : QMainWindow(),
|
|||
survey(nullptr),
|
||||
findMovedImagesDialog(nullptr)
|
||||
{
|
||||
Q_ASSERT_X(m_Instance == NULL, "MainWindow", "MainWindow recreated!");
|
||||
m_Instance = this;
|
||||
ui.setupUi(this);
|
||||
read_hashes();
|
||||
Command::init();
|
||||
|
|
@ -353,6 +357,7 @@ MainWindow::MainWindow() : QMainWindow(),
|
|||
MainWindow::~MainWindow()
|
||||
{
|
||||
write_hashes();
|
||||
m_Instance = nullptr;
|
||||
}
|
||||
|
||||
void MainWindow::setupSocialNetworkMenu()
|
||||
|
|
@ -393,6 +398,11 @@ void MainWindow::setDefaultState()
|
|||
ui.bottomLeft->currentWidget()->setEnabled(false);
|
||||
}
|
||||
|
||||
MainWindow *MainWindow::instance()
|
||||
{
|
||||
return m_Instance;
|
||||
}
|
||||
|
||||
// This gets called after one or more dives were added, edited or downloaded for a dive computer
|
||||
void MainWindow::refreshDisplay(bool doRecreateDiveList)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
#include "desktop-widgets/filterwidget2.h"
|
||||
#include "core/applicationstate.h"
|
||||
#include "core/gpslocation.h"
|
||||
#include "core/singleton.h"
|
||||
|
||||
#define NUM_RECENT_FILES 4
|
||||
|
||||
|
|
@ -43,7 +42,7 @@ class LocationInformationWidget;
|
|||
typedef std::pair<QByteArray, QVariant> WidgetProperty;
|
||||
typedef QVector<WidgetProperty> PropertyList;
|
||||
|
||||
class MainWindow : public QMainWindow, public SillySingleton<MainWindow> {
|
||||
class MainWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum {
|
||||
|
|
@ -62,6 +61,7 @@ public:
|
|||
|
||||
MainWindow();
|
||||
~MainWindow();
|
||||
static MainWindow *instance();
|
||||
void loadRecentFiles();
|
||||
void updateRecentFiles();
|
||||
void updateRecentFilesMenu();
|
||||
|
|
@ -193,6 +193,7 @@ private:
|
|||
QString filter_open();
|
||||
QString filter_import();
|
||||
QString filter_import_dive_sites();
|
||||
static MainWindow *m_Instance;
|
||||
QString displayedFilename(QString fullFilename);
|
||||
bool askSaveChanges();
|
||||
bool okToClose(QString message);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue