/inc/mainwindow.h

https://code.google.com/p/dwarftherapist/ · C Header · 144 lines · 92 code · 22 blank · 30 comment · 0 complexity · 5de5175b1a90694be64f3cca0dd7d411 MD5 · raw file

  1. /*
  2. Dwarf Therapist
  3. Copyright (c) 2009 Trey Stout (chmod)
  4. Permission is hereby granted, free of charge, to any person obtaining a copy
  5. of this software and associated documentation files (the "Software"), to deal
  6. in the Software without restriction, including without limitation the rights
  7. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. copies of the Software, and to permit persons to whom the Software is
  9. furnished to do so, subject to the following conditions:
  10. The above copyright notice and this permission notice shall be included in
  11. all copies or substantial portions of the Software.
  12. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18. THE SOFTWARE.
  19. */
  20. #ifndef MAINWINDOW_H
  21. #define MAINWINDOW_H
  22. #include <QtCore>
  23. #include <QtGui>
  24. #include <QtNetwork>
  25. class StateTableView;
  26. class DFInstance;
  27. class DwarfModel;
  28. class DwarfModelProxy;
  29. class Dwarf;
  30. class AboutDialog;
  31. class CustomProfession;
  32. class ViewManager;
  33. class Scanner;
  34. class ScriptDialog;
  35. namespace Ui
  36. {
  37. class MainWindow;
  38. }
  39. class MainWindow : public QMainWindow
  40. {
  41. Q_OBJECT
  42. public:
  43. MainWindow(QWidget *parent = 0);
  44. ~MainWindow();
  45. QSettings *get_settings() {return m_settings;}
  46. QToolBar *get_toolbar();
  47. DwarfModel *get_model() {return m_model;}
  48. DwarfModelProxy *get_proxy() {return m_proxy;}
  49. ViewManager *get_view_manager() {return m_view_manager;}
  50. DFInstance *get_DFInstance() {return m_df;}
  51. Ui::MainWindow *ui;
  52. public slots:
  53. // DF related
  54. void connect_to_df();
  55. void read_dwarves();
  56. void scan_memory();
  57. void new_pending_changes(int);
  58. void lost_df_connection();
  59. //settings
  60. void set_group_by(int);
  61. void export_custom_professions();
  62. void import_custom_professions();
  63. void export_gridviews();
  64. void import_gridviews();
  65. void clear_user_settings();
  66. // dialogs
  67. void show_about();
  68. void list_pending();
  69. void draw_professions();
  70. void draw_custom_profession_context_menu(const QPoint &);
  71. void add_new_filter_script();
  72. void print_gridview();
  73. // version check
  74. void check_latest_version(bool show_result_on_equal=false);
  75. void version_check_finished(bool error);
  76. // layout check
  77. void check_for_layout(const QString & checksum);
  78. void layout_check_finished(bool error);
  79. // links
  80. void go_to_forums();
  81. void go_to_donate();
  82. void go_to_project_home();
  83. void go_to_new_issue();
  84. // progress
  85. void set_progress_message(const QString &msg);
  86. void set_progress_range(int min, int max);
  87. void set_progress_value(int value);
  88. // misc
  89. void show_dwarf_details_dock(Dwarf *d = 0);
  90. void new_filter_script_chosen(const QString &script_name);
  91. void redraw_filter_scripts_cb();
  92. private:
  93. DFInstance *m_df;
  94. QLabel *m_lbl_status;
  95. QProgressBar *m_progress;
  96. QSettings *m_settings;
  97. ViewManager *m_view_manager;
  98. DwarfModel *m_model;
  99. DwarfModelProxy *m_proxy;
  100. AboutDialog *m_about_dialog;
  101. CustomProfession *m_temp_cp;
  102. Scanner *m_scanner;
  103. ScriptDialog *m_script_dialog;
  104. QHttp *m_http;
  105. bool m_reading_settings;
  106. bool m_show_result_on_equal; //! used during version checks
  107. QCompleter *m_dwarf_name_completer;
  108. QStringList m_dwarf_names_list;
  109. bool m_force_connect;
  110. bool m_try_download;
  111. QString m_tmp_checksum;
  112. bool m_deleting_settings;
  113. void closeEvent(QCloseEvent *evt); // override;
  114. void read_settings();
  115. void write_settings();
  116. private slots:
  117. void set_interface_enabled(bool);
  118. };
  119. #endif // MAINWINDOW_H