##// END OF EJS Templates
Adds Variable model in the Variable controller
Alexandre Leroux -
r113:cdfc14667f14
parent child
Show More
@@ -6,6 +6,7
6 6
7 7 #include <Common/spimpl.h>
8 8
9 class Variable;
9 10 Q_DECLARE_LOGGING_CATEGORY(LOG_VariableController)
10 11
11 12 /**
@@ -17,6 +18,13 public:
17 18 explicit VariableController(QObject *parent = 0);
18 19 virtual ~VariableController();
19 20
21 /**
22 * Creates a new variable
23 * @param name the name of the new variable
24 * @return the variable if it was created successfully, nullptr otherwise
25 */
26 Variable *createVariable(const QString &name) noexcept;
27
20 28 public slots:
21 29 void initialize();
22 30 void finalize();
@@ -1,4 +1,5
1 1 #include <Variable/VariableController.h>
2 #include <Variable/VariableModel.h>
2 3
3 4 #include <QMutex>
4 5 #include <QThread>
@@ -7,11 +8,12 Q_LOGGING_CATEGORY(LOG_VariableController, "VariableController")
7 8
8 9 struct VariableController::VariableControllerPrivate {
9 10 explicit VariableControllerPrivate()
10 : m_WorkingMutex{}
11 : m_WorkingMutex{}, m_VariableModel{std::make_unique<VariableModel>()}
11 12 {
12 13 }
13 14
14 15 QMutex m_WorkingMutex;
16 std::unique_ptr<VariableModel> m_VariableModel;
15 17 };
16 18
17 19 VariableController::VariableController(QObject *parent)
@@ -28,6 +30,11 VariableController::~VariableController()
28 30 this->waitForFinish();
29 31 }
30 32
33 Variable *VariableController::createVariable(const QString &name) noexcept
34 {
35 return impl->m_VariableModel->createVariable(name);
36 }
37
31 38 void VariableController::initialize()
32 39 {
33 40 qCDebug(LOG_VariableController()) << tr("VariableController init") << QThread::currentThread();
General Comments 0
You need to be logged in to leave comments. Login now