annotate Applications/Samples/SimpleViewer/Qt/SimpleViewerMainWindow.cpp @ 321:56b2e47d3c0c am-2

added undo-crop button
author am@osimis.io
date Fri, 12 Oct 2018 14:53:38 +0200
parents 10d188d6e5cc
children 6cc3ce74dc05
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
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium
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
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
33 SimpleViewerMainWindow::SimpleViewerMainWindow(OrthancStone::NativeStoneApplicationContext& context, SimpleViewerApplication& stoneApplication, QWidget *parent) :
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
34 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
35 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
36 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
37 {
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_->setupUi(this);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
39 SetCentralStoneWidget(ui_->cairoCentralWidget);
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
40
320
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
41 #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
42 connect(ui_->toolButtonCrop, &QToolButton::clicked, this, &SimpleViewerMainWindow::cropClicked);
321
56b2e47d3c0c added undo-crop button
am@osimis.io
parents: 320
diff changeset
43 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
44 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
45 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
46 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
47 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
48 connect(ui_->pushButtonInvert, &QPushButton::clicked, this, &SimpleViewerMainWindow::invertClicked);
320
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
49 #else
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
50 connect(ui_->toolButtonCrop, SIGNAL(clicked()), this, SLOT(cropClicked()));
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
51 connect(ui_->toolButtonLine, SIGNAL(clicked()), this, SLOT(lineClicked()));
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
52 connect(ui_->toolButtonCircle, SIGNAL(clicked()), this, SLOT(circleClicked()));
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
53 connect(ui_->toolButtonWindowing, SIGNAL(clicked()), this, SLOT(windowingClicked()));
321
56b2e47d3c0c added undo-crop button
am@osimis.io
parents: 320
diff changeset
54 connect(ui_->pushButtonUndoCrop, SIGNAL(clicked()), this, SLOT(undoCropClicked()));
320
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
55 connect(ui_->pushButtonRotate, SIGNAL(clicked()), this, SLOT(rotateClicked()));
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
56 connect(ui_->pushButtonInvert, SIGNAL(clicked()), this, SLOT(invertClicked()));
10d188d6e5cc compatibility with Qt4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 319
diff changeset
57 #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
58 }
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
59
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
60 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
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 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
63 }
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 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
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 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
68 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
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
321
56b2e47d3c0c added undo-crop button
am@osimis.io
parents: 320
diff changeset
71 void SimpleViewerMainWindow::undoCropClicked()
56b2e47d3c0c added undo-crop button
am@osimis.io
parents: 320
diff changeset
72 {
56b2e47d3c0c added undo-crop button
am@osimis.io
parents: 320
diff changeset
73 GenericNoArgCommand command("action:undo-crop");
56b2e47d3c0c added undo-crop button
am@osimis.io
parents: 320
diff changeset
74 stoneApplication_.ExecuteCommand(command);
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
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
77 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
78 {
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
79 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
80 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
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
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
83 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
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 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
86 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
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
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
89 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
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 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
92 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
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
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
95 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
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 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
98 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
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
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents:
diff changeset
101 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
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 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
104 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
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 }