Sat, 24 Mar 2018 12:09:26 +0200
renamed sink() to singleton()
src/generics/functions.h | file | annotate | diff | comparison | revisions | |
src/main.cpp | file | annotate | diff | comparison | revisions | |
src/mainwindow.cpp | file | annotate | diff | comparison | revisions | |
src/mainwindow.h | file | annotate | diff | comparison | revisions | |
src/types/vertex.cpp | file | annotate | diff | comparison | revisions |
--- a/src/generics/functions.h Sat Mar 24 12:06:49 2018 +0200 +++ b/src/generics/functions.h Sat Mar 24 12:09:26 2018 +0200 @@ -202,7 +202,7 @@ * pointer. */ template<typename T> -inline T& sink() +inline T& singleton() { static T result; return result;
--- a/src/main.cpp Sat Mar 24 12:06:49 2018 +0200 +++ b/src/main.cpp Sat Mar 24 12:09:26 2018 +0200 @@ -36,17 +36,16 @@ qRegisterMetaType<Vertex>("Vertex"); qRegisterMetaTypeStreamOperators<Vertex>("Vertex"); - static Configuration configObject; - config = &configObject; + config = &::singleton<Configuration>(); initializeCrashHandler(); LDColor::initColors(); - MainWindow* win = new MainWindow(configObject); - win->show(); + MainWindow* mainWindow = new MainWindow; + mainWindow->show(); // Process the command line for (int arg = 1; arg < argc; ++arg) - win->documents()->openMainModel (QString::fromLocal8Bit (argv[arg])); + mainWindow->documents()->openMainModel(QString::fromLocal8Bit(argv[arg])); return app.exec(); }
--- a/src/mainwindow.cpp Sat Mar 24 12:06:49 2018 +0200 +++ b/src/mainwindow.cpp Sat Mar 24 12:09:26 2018 +0200 @@ -50,9 +50,9 @@ // --------------------------------------------------------------------------------------------------------------------- // -MainWindow::MainWindow(class Configuration& config, QWidget* parent, Qt::WindowFlags flags) : +MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags) : QMainWindow (parent, flags), - m_config(config), + m_config(*::config), m_guiUtilities (new GuiUtilities (this)), m_primitives(new PrimitiveManager(this)), m_grid(new Grid(this)),
--- a/src/mainwindow.h Sat Mar 24 12:06:49 2018 +0200 +++ b/src/mainwindow.h Sat Mar 24 12:09:26 2018 +0200 @@ -61,7 +61,7 @@ Q_OBJECT public: - explicit MainWindow(Configuration& config, QWidget* parent = nullptr, Qt::WindowFlags flags = 0); + explicit MainWindow(QWidget* parent = nullptr, Qt::WindowFlags flags = 0); ~MainWindow(); void addMessage (QString msg);