# HG changeset patch # User am@osimis.io # Date 1535379728 -7200 # Node ID 829163c6efc1b7bf99e7d63a70face1a04166bc6 # Parent 8f5d7495076d2843a54af8619f4cdefa43735093 split MainWindow into a generic one and one specific to these samples diff -r 8f5d7495076d -r 829163c6efc1 Applications/Qt/QCairoWidget.cpp --- a/Applications/Qt/QCairoWidget.cpp Mon Aug 27 15:40:13 2018 +0200 +++ b/Applications/Qt/QCairoWidget.cpp Mon Aug 27 16:22:08 2018 +0200 @@ -1,3 +1,23 @@ +/** + * Stone of Orthanc + * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017-2018 Osimis S.A., Belgium + * + * This program is free software: you can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + **/ + #include "QCairoWidget.h" #include diff -r 8f5d7495076d -r 829163c6efc1 Applications/Qt/QCairoWidget.h --- a/Applications/Qt/QCairoWidget.h Mon Aug 27 15:40:13 2018 +0200 +++ b/Applications/Qt/QCairoWidget.h Mon Aug 27 16:22:08 2018 +0200 @@ -1,3 +1,23 @@ +/** + * Stone of Orthanc + * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017-2018 Osimis S.A., Belgium + * + * This program is free software: you can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + **/ + #pragma once #include "../../Framework/Widgets/CairoWidget.h" diff -r 8f5d7495076d -r 829163c6efc1 Applications/Qt/QStoneMainWindow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Applications/Qt/QStoneMainWindow.cpp Mon Aug 27 16:22:08 2018 +0200 @@ -0,0 +1,39 @@ +/** + * Stone of Orthanc + * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017-2018 Osimis S.A., Belgium + * + * This program is free software: you can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + **/ + +#include "QStoneMainWindow.h" + +QStoneMainWindow::QStoneMainWindow(OrthancStone::BasicNativeApplicationContext& context, QWidget *parent) : + QMainWindow(parent), + context_(context) +{ +} + +void QStoneMainWindow::SetCentralStoneWidget(QCairoWidget *centralWidget) +{ + cairoCentralWidget_ = centralWidget; + cairoCentralWidget_->SetContext(context_); +} + +QStoneMainWindow::~QStoneMainWindow() +{ +} + + diff -r 8f5d7495076d -r 829163c6efc1 Applications/Qt/QStoneMainWindow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Applications/Qt/QStoneMainWindow.h Mon Aug 27 16:22:08 2018 +0200 @@ -0,0 +1,42 @@ +/** + * Stone of Orthanc + * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017-2018 Osimis S.A., Belgium + * + * This program is free software: you can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + **/ +#pragma once + +#include + +#include "QCairoWidget.h" +#include "../Generic/BasicNativeApplicationContext.h" + +class QStoneMainWindow : public QMainWindow +{ + Q_OBJECT + +private: + OrthancStone::BasicNativeApplicationContext& context_; + QCairoWidget *cairoCentralWidget_; + +protected: // you must inherit this class + QStoneMainWindow(OrthancStone::BasicNativeApplicationContext& context, QWidget *parent = 0); + void SetCentralStoneWidget(QCairoWidget* centralWidget); +public: + virtual ~QStoneMainWindow(); + +}; + diff -r 8f5d7495076d -r 829163c6efc1 Applications/Samples/Qt/MainWindow.cpp --- a/Applications/Samples/Qt/MainWindow.cpp Mon Aug 27 15:40:13 2018 +0200 +++ b/Applications/Samples/Qt/MainWindow.cpp Mon Aug 27 16:22:08 2018 +0200 @@ -1,3 +1,23 @@ +/** + * Stone of Orthanc + * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017-2018 Osimis S.A., Belgium + * + * This program is free software: you can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + **/ + #include "MainWindow.h" /** @@ -7,13 +27,11 @@ #include MainWindow::MainWindow(OrthancStone::BasicNativeApplicationContext& context, QWidget *parent) : - QMainWindow(parent), - ui_(new Ui::MainWindow), - context_(context) + QStoneMainWindow(context, parent), + ui_(new Ui::MainWindow) { ui_->setupUi(this); - cairoCentralWidget_ = ui_->cairoCentralWidget; - cairoCentralWidget_->SetContext(context_); + SetCentralStoneWidget(ui_->cairoCentralWidget); } MainWindow::~MainWindow() diff -r 8f5d7495076d -r 829163c6efc1 Applications/Samples/Qt/MainWindow.h --- a/Applications/Samples/Qt/MainWindow.h Mon Aug 27 15:40:13 2018 +0200 +++ b/Applications/Samples/Qt/MainWindow.h Mon Aug 27 16:22:08 2018 +0200 @@ -1,30 +1,41 @@ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include +/** + * Stone of Orthanc + * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017-2018 Osimis S.A., Belgium + * + * This program is free software: you can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + **/ +#pragma once #include "../../Qt/QCairoWidget.h" -#include "../../Generic/BasicNativeApplicationContext.h" +#include "../../Qt/QStoneMainWindow.h" + namespace Ui { class MainWindow; } -class MainWindow : public QMainWindow +class MainWindow : public QStoneMainWindow { Q_OBJECT -public: - private: Ui::MainWindow *ui_; - OrthancStone::BasicNativeApplicationContext& context_; - QCairoWidget *cairoCentralWidget_; public: explicit MainWindow(OrthancStone::BasicNativeApplicationContext& context, QWidget *parent = 0); ~MainWindow(); }; - -#endif // MAINWINDOW_H diff -r 8f5d7495076d -r 829163c6efc1 Platforms/Generic/CMakeLists.txt --- a/Platforms/Generic/CMakeLists.txt Mon Aug 27 15:40:13 2018 +0200 +++ b/Platforms/Generic/CMakeLists.txt Mon Aug 27 16:22:08 2018 +0200 @@ -29,8 +29,8 @@ LIST(APPEND ORTHANC_BOOST_COMPONENTS program_options) -SET(ENABLE_SDL ON) -SET(ENABLE_QT OFF) +SET(ENABLE_SDL OFF) +SET(ENABLE_QT ON) SET(ORTHANC_SANDBOXED OFF) SET(ENABLE_CRYPTO_OPTIONS ON) SET(ENABLE_GOOGLE_TEST ON) @@ -47,6 +47,13 @@ ## Build all the sample applications ##################################################################### +if (ENABLE_QT) + list(APPEND APPLICATIONS_SOURCES + ${ORTHANC_STONE_ROOT}/Applications/Samples/Qt/MainWindow.cpp + ${ORTHANC_STONE_ROOT}/Applications/Samples/Qt/MainWindow.ui + ) +endif() + macro(BuildSample Target Header Sample) add_executable(${Target} ${ORTHANC_STONE_ROOT}/Applications/Samples/SampleMainNative.cpp diff -r 8f5d7495076d -r 829163c6efc1 Resources/CMake/QtConfiguration.cmake --- a/Resources/CMake/QtConfiguration.cmake Mon Aug 27 15:40:13 2018 +0200 +++ b/Resources/CMake/QtConfiguration.cmake Mon Aug 27 16:22:08 2018 +0200 @@ -26,16 +26,10 @@ find_package(Qt5Widgets) find_package(Qt5Core) -#qt5_wrap_ui(UI_HEADERS -# ${ORTHANC_STONE_ROOT}/Applications/Samples/Qt/MainWindow.ui -#) -set_property(SOURCE ${ORTHANC_STONE_ROOT}/Applications/Samples/Qt/MainWindow.h PROPERTY SKIP_AUTOMOC ON) - list(APPEND QT_SOURCES ${ORTHANC_STONE_ROOT}/Applications/Qt/QCairoWidget.cpp ${ORTHANC_STONE_ROOT}/Applications/Qt/BasicQtApplication.cpp - ${ORTHANC_STONE_ROOT}/Applications/Samples/Qt/MainWindow.cpp - ${ORTHANC_STONE_ROOT}/Applications/Samples/Qt/MainWindow.ui + ${ORTHANC_STONE_ROOT}/Applications/Qt/QStoneMainWindow.cpp ) include_directories(${ORTHANC_STONE_ROOT}/Applications/Qt/)