ctkExampleDicomAppLogic.cpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*=============================================================================
  2. Library: CTK
  3. Copyright (c) 2010 German Cancer Research Center,
  4. Division of Medical and Biological Informatics
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. =============================================================================*/
  15. #include "ctkExampleDicomAppLogic_p.h"
  16. #include <QtPlugin>
  17. #include <QRect>
  18. #include <QDebug>
  19. #include <QPushButton>
  20. ctkExampleDicomAppLogic::ctkExampleDicomAppLogic(ServiceAccessor<ctkDicomHostInterface> host)
  21. : host(host)
  22. {
  23. try
  24. {
  25. host->notifyStateChanged(ctkDicomWG23::IDLE);
  26. }
  27. catch (const std::runtime_error& e)
  28. {
  29. qCritical() << e.what();
  30. }
  31. }
  32. ctkExampleDicomAppLogic::~ctkExampleDicomAppLogic()
  33. {
  34. }
  35. ctkDicomWG23::State ctkExampleDicomAppLogic::getState()
  36. {
  37. return ctkDicomWG23::IDLE;
  38. }
  39. bool ctkExampleDicomAppLogic::setState(ctkDicomWG23::State newState)
  40. {
  41. qDebug() << "setState called";
  42. if (newState == ctkDicomWG23::INPROGRESS)
  43. {
  44. QPushButton *button = new QPushButton("Button from App");
  45. button->show();
  46. }
  47. return true;
  48. }
  49. bool ctkExampleDicomAppLogic::bringToFront(const QRect& requestedScreenArea)
  50. {
  51. return false;
  52. }
  53. void ctkExampleDicomAppLogic::do_something()
  54. {
  55. QRect preferred;
  56. try
  57. {
  58. QRect rect = host->getAvailableScreen(preferred);
  59. }
  60. catch (const std::runtime_error& e)
  61. {
  62. qCritical() << e.what();
  63. }
  64. }