1 /*
2     <one line to give the program's name and a brief idea of what it does.>
3     Copyright (C) 2013  <copyright holder> <email>
4 
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9 
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14 
15     You should have received a copy of the GNU General Public License along
16     with this program; if not, write to the Free Software Foundation, Inc.,
17     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19 
20 
21 #ifndef OBCONF_MAINDIALOG_H
22 #define OBCONF_MAINDIALOG_H
23 
24 #include <QDialog>
25 #include <glib.h>
26 
27 // We include a fixed version rather than the originally generated one.
28 #include "ui_obconf_fixed.h"
29 
30 class QStandardItemModel;
31 class QItemSelection;
32 
33 namespace Obconf {
34 
35 class MainDialog : public QDialog {
36   Q_OBJECT
37 
38 public:
39   MainDialog();
40   virtual ~MainDialog();
41 
42   virtual void accept();
43   virtual void reject();
44 
45   void theme_install(const char* path);
46   void theme_load_all();
47 
48 private:
49   void theme_setup_tab();
50   void appearance_setup_tab();
51   void windows_setup_tab();
52   void mouse_setup_tab();
53   void moveresize_setup_tab();
54   void margins_setup_tab();
55   void desktops_setup_tab();
56   void dock_setup_tab();
57 
58   // theme
59   void add_theme_dir(const char* dirname);
60 
61   // windows
62   void windows_enable_stuff();
63 
64   // move & resize
65   void moveresize_enable_stuff();
66   void write_fixed_position(const char* coord);
67 
68   // mouse
69   void mouse_enable_stuff();
70   int read_doubleclick_action();
71   void write_doubleclick_action(int a);
72 
73   // desktops
74   void desktops_read_names();
75   void desktops_write_names();
76   void desktops_write_number();
77 
78 private Q_SLOTS:
79 
80   void on_about_clicked();
81 
82   // theme
83   void onThemeNamesSelectionChanged(const QItemSelection & selected, const QItemSelection & deselected);
84   void on_install_theme_clicked();
85   void on_theme_archive_clicked();
86 
87   //apearance
88   void on_window_border_toggled(bool checked);
89   void on_animate_iconify_toggled(bool checked);
90   void on_title_layout_textChanged(const QString& text);
91 
92   // font
93   void on_font_active_changed();
94   void on_font_inactive_changed();
95   void on_font_menu_header_changed();
96   void on_font_menu_item_changed();
97   void on_font_active_display_changed();
98   void on_font_inactive_display_changed();
99 
100   // windows
101   void on_fixed_monitor_valueChanged(int newValue);
102   void on_focus_new_toggled(bool checked);
103   void on_place_mouse_toggled(bool checked);
104 
105   void on_place_active_popup_currentIndexChanged(int index);
106   void on_primary_monitor_popup_currentIndexChanged(int index);
107 
108   // move & resize
109   void on_resist_window_valueChanged(int newValue);
110   void on_resist_edge_valueChanged(int newValue);
111   void on_resize_contents_toggled(bool checked);
112 
113   void on_resize_popup_currentIndexChanged(int index);
114   void on_resize_position_currentIndexChanged(int index);
115   void on_fixed_x_popup_currentIndexChanged(int index);
116   void on_fixed_y_popup_currentIndexChanged(int index);
117 
118   void on_drag_threshold_valueChanged(int newValue);
119 
120   void on_fixed_x_pos_valueChanged(int newValue);
121   void on_fixed_y_pos_valueChanged(int newValue);
122   void on_warp_edge_toggled(bool checked);
123   void on_warp_edge_time_valueChanged(int newValue);
124 
125   // margins
126   void on_margins_left_valueChanged(int newValue);
127   void on_margins_right_valueChanged(int newValue);
128   void on_margins_top_valueChanged(int newValue);
129   void on_margins_bottom_valueChanged(int newValue);
130 
131   // mouse
132   void on_focus_mouse_toggled(bool checked);
133   void on_focus_delay_valueChanged(int newValue);
134   void on_focus_raise_toggled(bool checked);
135   void on_focus_notlast_toggled(bool checked);
136   void on_focus_under_mouse_toggled(bool checked);
137   void on_doubleclick_time_valueChanged(int newValue);
138   void on_titlebar_doubleclick_currentIndexChanged(int index);
139 
140   // desktop
141   void on_desktop_num_valueChanged(int newValue);
142   void on_desktop_popup_toggled(bool checked);
143   void on_desktop_popup_time_valueChanged(int newValue);
144   void on_desktop_names_itemChanged(QListWidgetItem * item);
145 
146   // docks
147   void on_dock_float_x_valueChanged(int newValue);
148   void on_dock_float_y_valueChanged(int newValue);
149   void on_dock_stack_top_toggled(bool checked);
150   void on_dock_stack_normal_toggled(bool checked);
151   void on_dock_stack_bottom_toggled(bool checked);
152   void on_dock_nostrut_toggled(bool checked);
153   void on_dock_hide_toggled(bool checked);
154   void on_dock_hide_delay_valueChanged(int newValue);
155   void on_dock_show_delay_valueChanged(int newValue);
156   void on_dock_position_currentIndexChanged(int index);
157   void on_dock_direction_currentIndexChanged(int index);
158 
159 private:
160   Ui::MainDialog ui;
161   GList* themes;
162   QStandardItemModel* themes_model;
163 };
164 
165 }
166 
167 #endif // OBCONF_MAINDIALOG_H
168