~leighman/ubuntu/raring/workrave/fix-desktop-file-2

« back to all changes in this revision

Viewing changes to frontend/text/src/GUI.hh

  • Committer: Package Import Robot
  • Author(s): Michael Terry
  • Date: 2013-01-24 11:04:41 UTC
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: package-import@ubuntu.com-20130124110441-t06q3xlc7mp4406p
Tags: upstream-1.10
ImportĀ upstreamĀ versionĀ 1.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// GUI.hh --- The WorkRave GUI
2
 
//
3
 
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Rob Caelers & Raymond Penners
4
 
// All rights reserved.
5
 
//
6
 
// This program is free software: you can redistribute it and/or modify
7
 
// it under the terms of the GNU General Public License as published by
8
 
// the Free Software Foundation, either version 3 of the License, or
9
 
// (at your option) any later version.
10
 
//
11
 
// This program is distributed in the hope that it will be useful,
12
 
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
// GNU General Public License for more details.
15
 
//
16
 
// You should have received a copy of the GNU General Public License
17
 
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 
//
19
 
 
20
 
#ifndef GUI_HH
21
 
#define GUI_HH
22
 
 
23
 
#include "preinclude.h"
24
 
#include <glib.h>
25
 
 
26
 
#include "ICoreEventListener.hh"
27
 
#include "IApp.hh"
28
 
 
29
 
// Generic GUI
30
 
class BreakControl;
31
 
class SoundPlayer;
32
 
class IBreakWindow;
33
 
class PreludeWindow;
34
 
class MainWindow;
35
 
 
36
 
using namespace workrave;
37
 
 
38
 
namespace workrave
39
 
{
40
 
  // Core interfaces
41
 
  class IConfigurator;
42
 
}
43
 
 
44
 
class GUI :
45
 
  public IApp,
46
 
  public ICoreEventListener
47
 
{
48
 
public:
49
 
  GUI(int argc, char **argv);
50
 
  virtual ~GUI();
51
 
 
52
 
  static GUI *get_instance();
53
 
 
54
 
  void main();
55
 
  void restbreak_now();
56
 
  void terminate();
57
 
 
58
 
  // IGUIFactory methods
59
 
  virtual void set_break_response(IBreakResponse *rep);
60
 
  virtual void create_prelude_window(BreakId break_id);
61
 
  virtual void create_break_window(BreakId break_id, BreakHint break_hint);
62
 
  virtual void hide_break_window();
63
 
  virtual void show_break_window();
64
 
  virtual void refresh_break_window();
65
 
  virtual void set_break_progress(int value, int max_value);
66
 
  virtual void set_prelude_stage(PreludeStage stage);
67
 
  virtual void set_prelude_progress_text(PreludeProgressText text);
68
 
 
69
 
  //
70
 
  void core_event_notify(CoreEvent event);
71
 
  void core_event_operation_mode_changed(const OperationMode m);
72
 
 
73
 
  SoundPlayer *get_sound_player() const;
74
 
 
75
 
  static gboolean static_on_timer(gpointer data);
76
 
 
77
 
  enum BlockMode { BLOCK_MODE_NONE = 0, BLOCK_MODE_INPUT, BLOCK_MODE_ALL };
78
 
 
79
 
private:
80
 
  bool on_timer();
81
 
  void init_gui();
82
 
  void init_debug();
83
 
  void init_nls();
84
 
  void init_core();
85
 
  void init_sound_player();
86
 
 
87
 
  void collect_garbage();
88
 
  IBreakWindow *new_break_window(BreakId break_id, bool ignorable);
89
 
 
90
 
  // Prefs
91
 
  static const std::string CFG_KEY_GUI_BLOCK_MODE;
92
 
  BlockMode get_block_mode();
93
 
  void set_block_mode(BlockMode mode);
94
 
 
95
 
private:
96
 
  GMainLoop *main_loop;
97
 
 
98
 
  //! The one and only instance
99
 
  static GUI *instance;
100
 
 
101
 
  //! The Configurator.
102
 
  IConfigurator *configurator;
103
 
 
104
 
  //! The Core controller
105
 
  ICore *core;
106
 
 
107
 
  //! The sound player
108
 
  SoundPlayer *sound_player;
109
 
 
110
 
  //! Interface to the break window.
111
 
  IBreakWindow *break_window;
112
 
 
113
 
  //! Interface to the prelude windows.
114
 
  PreludeWindow *prelude_window;
115
 
 
116
 
  //!
117
 
  MainWindow *main_window;
118
 
 
119
 
  //! Reponse interface for breaks
120
 
  IBreakResponse *response;
121
 
 
122
 
  //! Destroy break window on next heartbeat?
123
 
  bool break_window_destroy;
124
 
 
125
 
  //! Destroy prelude window on next heartbeat?
126
 
  bool prelude_window_destroy;
127
 
 
128
 
  //! Current active break.
129
 
  BreakId active_break_id;
130
 
 
131
 
  //! The number of command line arguments.
132
 
  int argc;
133
 
 
134
 
  //! The command line arguments.
135
 
  char **argv;
136
 
 
137
 
  //! Final prelude
138
 
  std::string progress_text;
139
 
 
140
 
  //! Progress values
141
 
  int progress_value;
142
 
  int progress_max_value;
143
 
};
144
 
 
145
 
 
146
 
//! Returns the only instance of GUI
147
 
inline GUI *
148
 
GUI::get_instance()
149
 
{
150
 
  return instance;
151
 
}
152
 
 
153
 
//! Returns the sound player
154
 
inline SoundPlayer *
155
 
GUI::get_sound_player() const
156
 
{
157
 
  return sound_player;
158
 
}
159
 
 
160
 
 
161
 
#endif // GUI_HH