1 /**********************************************************************
2  *
3  *   FreeDoko a Doppelkopf-Game
4  *
5  *   Copyright (C) 2001 – 2018 by Diether Knof and Borg Enders
6  *
7  *   This program is free software; you can redistribute it and/or
8  *   modify it under the terms of the GNU General Public License as
9  *   published by the Free Software Foundation; either version 2 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,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *   GNU General Public License for more details.
16  *   You can find this license in the file 'gpl.txt'.
17  *
18  *   You should have received a copy of the GNU General Public License
19  *   along with this program; if not, write to the Free Software
20  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21  *   MA  02111-1307  USA
22  *
23  *  Contact:
24  *    Diether Knof dknof@posteo.de
25  *
26  **********************************************************************/
27 
28 #ifdef USE_UI_GTKMM
29 
30 #pragma once
31 
32 #include "base.h"
33 
34 #include "widgets/sticky_dialog.h"
35 #include "widgets/file_chooser_dialog_wrapper.h"
36 
37 namespace Gtk {
38 class TextView;
39 class CheckButton;
40 } // namespace Gtk
41 
42 namespace UI_GTKMM_NS {
43 
44 /**
45  ** the bug report dialog and selector
46  **/
47 class BugReport : public Base, public Gtk::StickyDialog {
48   public:
49     BugReport() = delete;
50     BugReport(Base* parent, string message = "");
51     BugReport(BugReport const&) = delete;
52     BugReport& operator=(BugReport const&) = delete;
53     ~BugReport() override;
54 
55     bool load(string filename);
56 
57     // sets the widget as destination for the drop of a bug report
58     void set_dnd_destination(Gtk::Widget& widget);
59 
60     void create_report();
61     void save();
62 
63     void preference_update(int type) override;
64 
65   private:
66     void init();
67 
68     void save_on_desktop_toggled_event();
69 
70     // drag-and-drop: a bug report was dropped
71     void on_bug_report_dropped(Glib::RefPtr<Gdk::DragContext> const& context,
72                                int x, int y,
73                                Gtk::SelectionData const& selection_data,
74                                guint info, guint time);
75   private:
76     Gtk::TextView* description = nullptr;
77     Gtk::Label* file_label = nullptr;
78     Gtk::CheckButton* save_on_desktop_button = nullptr;
79     Gtk::TextView* message = nullptr;
80     Gtk::Button* dismiss_button = nullptr;
81     Gtk::Button* save_button = nullptr;
82 
83   public:
84     unique_ptr<Gtk::FileChooserDialogWrapper> load_file_chooser;
85 }; // class BugReport : public Base, public Gtk::StickyDialog
86 
87 } // namespace UI_GTKMM_NS
88 
89 #endif // #ifdef USE_UI_GTKMM
90