annotate Applications/Samples/SimpleViewer/Qt/SimpleViewerMainWindow.cpp @ 439:b70e9be013e4

preparing for 2019
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 24 Dec 2018 13:41:12 +0100
parents 6cc3ce74dc05
children b1377625e4ba
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
1 /**
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
2 * Stone of Orthanc
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
439
b70e9be013e4 preparing for 2019
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 385
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
6 *
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
10 * the License, or (at your option) any later version.
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
11 *
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
15 * Affero General Public License for more details.
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
16 *
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
19 **/
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
20
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
21 #include "SimpleViewerMainWindow.h"
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
22
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
23 /**
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
24 * Don't use "ui_MainWindow.h" instead of <ui_MainWindow.h> below, as
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
25 * this makes CMake unable to detect when the UI file changes.
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
26 **/
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
27 #include <ui_SimpleViewerMainWindow.h>
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
28 #include "../SimpleViewerApplication.h"
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
29
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
30 namespace SimpleViewer
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
31 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
32
385
6cc3ce74dc05 using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 321
diff changeset
33 SimpleViewerMainWindow::SimpleViewerMainWindow(
6cc3ce74dc05 using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 321
diff changeset
34 OrthancStone::NativeStoneApplicationContext& context,
6cc3ce74dc05 using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 321
diff changeset
35 SimpleViewerApplication& stoneApplication,
6cc3ce74dc05 using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 321
diff changeset
36 QWidget *parent) :
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
37 QStoneMainWindow(context, parent),
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
38 ui_(new Ui::SimpleViewerMainWindow),
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
39 stoneApplication_(stoneApplication)
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
40 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
41 ui_->setupUi(this);
385
6cc3ce74dc05 using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 321
diff changeset
42 SetCentralStoneWidget(*ui_->cairoCentralWidget);
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
43
320
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
44 #if QT_VERSION >= 0x050000
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
45 connect(ui_->toolButtonCrop, &QToolButton::clicked, this, &SimpleViewerMainWindow::cropClicked);
321
56b2e47d3c0c added undo-crop button
am@osimis.io
parents: 320
diff changeset
46 connect(ui_->pushButtonUndoCrop, &QToolButton::clicked, this, &SimpleViewerMainWindow::undoCropClicked);
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
47 connect(ui_->toolButtonLine, &QToolButton::clicked, this, &SimpleViewerMainWindow::lineClicked);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
48 connect(ui_->toolButtonCircle, &QToolButton::clicked, this, &SimpleViewerMainWindow::circleClicked);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
49 connect(ui_->toolButtonWindowing, &QToolButton::clicked, this, &SimpleViewerMainWindow::windowingClicked);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
50 connect(ui_->pushButtonRotate, &QPushButton::clicked, this, &SimpleViewerMainWindow::rotateClicked);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
51 connect(ui_->pushButtonInvert, &QPushButton::clicked, this, &SimpleViewerMainWindow::invertClicked);
320
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
52 #else
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
53 connect(ui_->toolButtonCrop, SIGNAL(clicked()), this, SLOT(cropClicked()));
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
54 connect(ui_->toolButtonLine, SIGNAL(clicked()), this, SLOT(lineClicked()));
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
55 connect(ui_->toolButtonCircle, SIGNAL(clicked()), this, SLOT(circleClicked()));
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
56 connect(ui_->toolButtonWindowing, SIGNAL(clicked()), this, SLOT(windowingClicked()));
321
56b2e47d3c0c added undo-crop button
am@osimis.io
parents: 320
diff changeset
57 connect(ui_->pushButtonUndoCrop, SIGNAL(clicked()), this, SLOT(undoCropClicked()));
320
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
58 connect(ui_->pushButtonRotate, SIGNAL(clicked()), this, SLOT(rotateClicked()));
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
59 connect(ui_->pushButtonInvert, SIGNAL(clicked()), this, SLOT(invertClicked()));
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
60 #endif
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
61 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
62
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
63 SimpleViewerMainWindow::~SimpleViewerMainWindow()
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
64 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
65 delete ui_;
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
66 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
67
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
68 void SimpleViewerMainWindow::cropClicked()
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
69 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
70 GenericNoArgCommand command("selectTool:crop");
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
71 stoneApplication_.ExecuteCommand(command);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
72 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
73
321
56b2e47d3c0c added undo-crop button
am@osimis.io
parents: 320
diff changeset
74 void SimpleViewerMainWindow::undoCropClicked()
56b2e47d3c0c added undo-crop button
am@osimis.io
parents: 320
diff changeset
75 {
56b2e47d3c0c added undo-crop button
am@osimis.io
parents: 320
diff changeset
76 GenericNoArgCommand command("action:undo-crop");
56b2e47d3c0c added undo-crop button
am@osimis.io
parents: 320
diff changeset
77 stoneApplication_.ExecuteCommand(command);
56b2e47d3c0c added undo-crop button
am@osimis.io
parents: 320
diff changeset
78 }
56b2e47d3c0c added undo-crop button
am@osimis.io
parents: 320
diff changeset
79
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
80 void SimpleViewerMainWindow::lineClicked()
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
81 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
82 GenericNoArgCommand command("selectTool:line-measure");
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
83 stoneApplication_.ExecuteCommand(command);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
84 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
85
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
86 void SimpleViewerMainWindow::circleClicked()
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
87 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
88 GenericNoArgCommand command("selectTool:circle-measure");
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
89 stoneApplication_.ExecuteCommand(command);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
90 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
91
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
92 void SimpleViewerMainWindow::windowingClicked()
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
93 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
94 GenericNoArgCommand command("selectTool:windowing");
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
95 stoneApplication_.ExecuteCommand(command);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
96 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
97
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
98 void SimpleViewerMainWindow::rotateClicked()
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
99 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
100 GenericNoArgCommand command("action:rotate");
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
101 stoneApplication_.ExecuteCommand(command);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
102 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
103
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
104 void SimpleViewerMainWindow::invertClicked()
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
105 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
106 GenericNoArgCommand command("action:invert");
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
107 stoneApplication_.ExecuteCommand(command);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
108 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
109 }