annotate Applications/Samples/Qt/SampleMainWindowWithButtons.cpp @ 326:612238b3f3e8 am-2

all 4 samples now working in Qt, SDL and wasm
author am@osimis.io
date Tue, 16 Oct 2018 12:57:38 +0200
parents
children 6cc3ce74dc05
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
326
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
1 /**
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
2 * Stone of Orthanc
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
6 *
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
10 * the License, or (at your option) any later version.
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
11 *
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
15 * Affero General Public License for more details.
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
16 *
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
19 **/
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
20
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
21 #include "SampleMainWindow.h"
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
22
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
23 /**
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
24 * Don't use "ui_MainWindow.h" instead of <ui_MainWindow.h> below, as
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
25 * this makes CMake unable to detect when the UI file changes.
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
26 **/
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
27 #include <ui_SampleMainWindowWithButtons.h>
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
28 #include "../../Applications/Samples/SampleApplicationBase.h"
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
29
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
30 namespace OrthancStone
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
31 {
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
32 namespace Samples
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
33 {
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
34
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
35 SampleMainWindowWithButtons::SampleMainWindowWithButtons(OrthancStone::NativeStoneApplicationContext& context, OrthancStone::Samples::SampleSingleCanvasWithButtonsApplicationBase& stoneSampleApplication, QWidget *parent) :
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
36 QStoneMainWindow(context, parent),
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
37 ui_(new Ui::SampleMainWindowWithButtons),
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
38 stoneSampleApplication_(stoneSampleApplication)
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
39 {
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
40 ui_->setupUi(this);
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
41 SetCentralStoneWidget(ui_->cairoCentralWidget);
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
42
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
43 #if QT_VERSION >= 0x050000
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
44 connect(ui_->toolButton1, &QToolButton::clicked, this, &SampleMainWindowWithButtons::tool1Clicked);
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
45 connect(ui_->toolButton2, &QToolButton::clicked, this, &SampleMainWindowWithButtons::tool2Clicked);
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
46 connect(ui_->pushButton1, &QPushButton::clicked, this, &SampleMainWindowWithButtons::pushButton1Clicked);
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
47 connect(ui_->pushButton1, &QPushButton::clicked, this, &SampleMainWindowWithButtons::pushButton2Clicked);
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
48 #else
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
49 connect(ui_->toolButton1, SIGNAL(clicked()), this, SLOT(tool1Clicked()));
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
50 connect(ui_->toolButton2, SIGNAL(clicked()), this, SLOT(tool2Clicked()));
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
51 connect(ui_->pushButton1, SIGNAL(clicked()), this, SLOT(pushButton1Clicked()));
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
52 connect(ui_->pushButton1, SIGNAL(clicked()), this, SLOT(pushButton2Clicked()));
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
53 #endif
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
54
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
55 std::string pushButton1Name;
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
56 std::string pushButton2Name;
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
57 std::string tool1Name;
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
58 std::string tool2Name;
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
59 stoneSampleApplication_.GetButtonNames(pushButton1Name, pushButton2Name, tool1Name, tool2Name);
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
60
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
61 ui_->toolButton1->setText(QString::fromStdString(tool1Name));
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
62 ui_->toolButton2->setText(QString::fromStdString(tool2Name));
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
63 ui_->pushButton1->setText(QString::fromStdString(pushButton1Name));
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
64 ui_->pushButton2->setText(QString::fromStdString(pushButton2Name));
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
65 }
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
66
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
67 SampleMainWindowWithButtons::~SampleMainWindowWithButtons()
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
68 {
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
69 delete ui_;
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
70 }
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
71
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
72 void SampleMainWindowWithButtons::tool1Clicked()
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
73 {
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
74 stoneSampleApplication_.OnTool1Clicked();
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
75 }
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
76
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
77 void SampleMainWindowWithButtons::tool2Clicked()
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
78 {
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
79 stoneSampleApplication_.OnTool2Clicked();
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
80 }
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
81
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
82 void SampleMainWindowWithButtons::pushButton1Clicked()
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
83 {
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
84 stoneSampleApplication_.OnPushButton1Clicked();
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
85 }
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
86
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
87 void SampleMainWindowWithButtons::pushButton2Clicked()
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
88 {
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
89 stoneSampleApplication_.OnPushButton2Clicked();
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
90 }
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
91
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
92 }
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents:
diff changeset
93 }