summaryrefslogtreecommitdiffstats
path: root/kdict/toplevel.h
blob: d9653413491be9afb3da6e88e302ad05d5c3bed0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/* -------------------------------------------------------------

   toplevel.h (part of The KDE Dictionary Client)

   Copyright (C) 2000-2001 Christian Gebauer <gebauer@kde.org>
   (C) by Matthias Hölzer 1998

   This file is distributed under the Artistic License.
   See LICENSE for details.

   -------------------------------------------------------------

   TopLevel   The toplevel widget of Kdict.

 ------------------------------------------------------------- */

#ifndef _TOPLEVEL_H_
#define _TOPLEVEL_H_

#include <tqtimer.h>
#include <kmainwindow.h>
#include "dcopinterface.h"

class TQSplitter;

class KToggleAction;
class KToolBarPopupAction;

class DictLabelAction;
class DictComboAction;
class DictButtonAction;
class MatchView;
class QueryView;
class OptionsDialog;
class DbSetsDialog;


class TopLevel : public KMainWindow, virtual public KDictIface
{
  Q_OBJECT
  

  friend class QueryView;

public:

  TopLevel(TQWidget* parent = 0, const char* name = 0);
  ~TopLevel();

  void normalStartup();             // called when started without commandline parameters

  // DCOP-Interface...
  void quit();
  void makeActiveWindow();
  void definePhrase(TQString phrase);
  void matchPhrase(TQString phrase);
  void defineClipboardContent();
  void matchClipboardContent();
  TQStringList getDatabases();
  TQString currentDatabase();
  TQStringList getStrategies();
  TQString currentStrategy();
  bool setDatabase(TQString db);
  bool setStrategy(TQString strategy);
  bool historyGoBack();
  bool historyGoForward();

public slots:

  void define(const TQString &query);
  void defineClipboard();

  void match(const TQString &query);
  void matchClipboard();

protected:
	bool queryClose();

private:

  void setupActions();
  void setupStatusBar();
  void recreateGUI();
  void raiseWindow();

  void addCurrentInputToHistory();  // add text in the query-combobox to the history

private slots:
  void clearInput();                // erase text in query-combobox

  void doDefine();                  // define text in the combobox
  void doMatch();                   // match text in the combobox

  void stopClients();

  void buildHistMenu();
  void queryHistMenu();             // process a query via the history menu
  void clearQueryHistory();

  void stratDbChanged();
  void dbInfoMenuClicked();
  void databaseSelected(int num);

  void enableCopy(bool selected);
  void enablePrintSave();

  void clientStarted(const TQString &message);
  void clientStopped(const TQString &message);
  void resetStatusbar();
  void renderingStarted();
  void renderingStopped();

  void newCaption(const TQString&);

  void toggleMatchListShow();
  void saveMatchViewSize();
  void adjustMatchViewSize();

  void slotConfToolbar();
  void slotNewToolbarConfig();

  void showSetsDialog();
  void hideSetsDialog();
  void setsChanged();

  void showOptionsDialog();
  void hideOptionsDialog();
  void optionsChanged();

private:

  KAction *actSave, *actPrint, *actStartQuery, *actStopQuery, *actCopy;
  KToggleAction *actShowMatchList;
  DictLabelAction *actQueryLabel, *actDbLabel;
  DictComboAction *actQueryCombo, *actDbCombo;
  DictButtonAction *actDefineBtn, *actMatchBtn;
  TQPtrList<KAction> historyActionList, dbActionList;
  KToolBarPopupAction *actBack, *actForward;

  TQSplitter *splitter;              // widgets....
  QueryView *queryView;
  MatchView *matchView;
  OptionsDialog *optDlg;
  DbSetsDialog *setsDlg;

  TQTimer resetStatusbarTimer;
  int stopRef;                      // remember how many "clients" are running
};

#endif