comparison Applications/Samples/SimpleViewer/Qt/SimpleViewerMainWindow.cpp @ 319:daa04d15192c am-2

new SimpleViewer sample that has been split in multiple files to be able to scale it
author am@osimis.io
date Thu, 11 Oct 2018 13:16:54 +0200
parents
children 10d188d6e5cc
comparison
equal deleted inserted replaced
318:3a4ca166fafa 319:daa04d15192c
1 /**
2 * Stone of Orthanc
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium
6 *
7 * This program is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU Affero General Public License
9 * as published by the Free Software Foundation, either version 3 of
10 * the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Affero General Public License for more details.
16 *
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 **/
20
21 #include "SimpleViewerMainWindow.h"
22
23 /**
24 * Don't use "ui_MainWindow.h" instead of <ui_MainWindow.h> below, as
25 * this makes CMake unable to detect when the UI file changes.
26 **/
27 #include <ui_SimpleViewerMainWindow.h>
28 #include "../SimpleViewerApplication.h"
29
30 namespace SimpleViewer
31 {
32
33 SimpleViewerMainWindow::SimpleViewerMainWindow(OrthancStone::NativeStoneApplicationContext& context, SimpleViewerApplication& stoneApplication, QWidget *parent) :
34 QStoneMainWindow(context, parent),
35 ui_(new Ui::SimpleViewerMainWindow),
36 stoneApplication_(stoneApplication)
37 {
38 ui_->setupUi(this);
39 SetCentralStoneWidget(ui_->cairoCentralWidget);
40
41 connect(ui_->toolButtonCrop, &QToolButton::clicked, this, &SimpleViewerMainWindow::cropClicked);
42 connect(ui_->toolButtonLine, &QToolButton::clicked, this, &SimpleViewerMainWindow::lineClicked);
43 connect(ui_->toolButtonCircle, &QToolButton::clicked, this, &SimpleViewerMainWindow::circleClicked);
44 connect(ui_->toolButtonWindowing, &QToolButton::clicked, this, &SimpleViewerMainWindow::windowingClicked);
45 connect(ui_->pushButtonRotate, &QPushButton::clicked, this, &SimpleViewerMainWindow::rotateClicked);
46 connect(ui_->pushButtonInvert, &QPushButton::clicked, this, &SimpleViewerMainWindow::invertClicked);
47 }
48
49 SimpleViewerMainWindow::~SimpleViewerMainWindow()
50 {
51 delete ui_;
52 }
53
54 void SimpleViewerMainWindow::cropClicked()
55 {
56 GenericNoArgCommand command("selectTool:crop");
57 stoneApplication_.ExecuteCommand(command);
58 }
59
60 void SimpleViewerMainWindow::lineClicked()
61 {
62 GenericNoArgCommand command("selectTool:line-measure");
63 stoneApplication_.ExecuteCommand(command);
64 }
65
66 void SimpleViewerMainWindow::circleClicked()
67 {
68 GenericNoArgCommand command("selectTool:circle-measure");
69 stoneApplication_.ExecuteCommand(command);
70 }
71
72 void SimpleViewerMainWindow::windowingClicked()
73 {
74 GenericNoArgCommand command("selectTool:windowing");
75 stoneApplication_.ExecuteCommand(command);
76 }
77
78 void SimpleViewerMainWindow::rotateClicked()
79 {
80 GenericNoArgCommand command("action:rotate");
81 stoneApplication_.ExecuteCommand(command);
82 }
83
84 void SimpleViewerMainWindow::invertClicked()
85 {
86 GenericNoArgCommand command("action:invert");
87 stoneApplication_.ExecuteCommand(command);
88 }
89 }