kwave  18.07.70
App.h
Go to the documentation of this file.
1 /***************************************************************************
2  App.h - The Kwave main application
3  -------------------
4  begin : Wed Feb 28 2001
5  copyright : (C) 2001 by Thomas Eschenbacher
6  email : Thomas.Eschenbacher@gmx.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef KWAVE_APP_H
19 #define KWAVE_APP_H
20 
21 #include "config.h"
22 
23 #include <QApplication>
24 #include <QList>
25 #include <QObject>
26 #include <QPair>
27 #include <QStringList>
28 
29 class QCommandLineParser;
30 class QString;
31 class QUrl;
32 
33 namespace Kwave
34 {
35 
36  class FileContext;
37  class TopWidget;
38 
44  class App :public QApplication
45  {
46  Q_OBJECT
47  public:
48 
49  typedef enum {
53  /* GUI_IDE integrated development environment (IDE) */
54  } GuiType;
55 
60  typedef QPair<QString,int> FileAndInstance;
61 
67  App(int &argc, char **argv);
68 
74  void processCmdline(QCommandLineParser *cmdline);
75 
80  virtual bool isOK() const;
81 
83  virtual ~App();
84 
90  void addRecentFile(const QString &filename);
91 
103  int newWindow(const QUrl &url);
104 
111 
113  inline QStringList recentFiles() const { return m_recent_files; }
114 
116  QList<FileAndInstance> openFiles() const;
117 
119  GuiType guiType() const { return m_gui_type; }
120 
127  void switchGuiType(Kwave::TopWidget *top, GuiType new_type);
128 
130  inline const QCommandLineParser *cmdline() const { return m_cmdline; }
131 
132  signals:
137  void recentFilesChanged();
138 
139  public slots:
140 
149  int newInstance(const QStringList &args, const QString &dir);
150 
151  protected:
152  friend class Kwave::TopWidget;
153 
161  int executeCommand(const QString &command);
162 
163  private:
164 
168  void readConfig();
169 
174  void saveRecentFiles();
175 
176  private:
177 
179  QCommandLineParser *m_cmdline;
180 
186  QStringList m_recent_files;
187 
189  QList<Kwave::TopWidget *> m_top_widgets;
190 
192  GuiType m_gui_type;
193  };
194 }
195 
196 #endif // KWAVE_APP_H
197 
198 //***************************************************************************
199 //***************************************************************************
int newInstance(const QStringList &args, const QString &dir)
Definition: App.cpp:129
App(int &argc, char **argv)
Definition: App.cpp:55
QCommandLineParser * m_cmdline
Definition: App.h:179
Definition: App.h:33
QStringList m_recent_files
Definition: App.h:186
QList< FileAndInstance > openFiles() const
Definition: App.cpp:294
GuiType
Definition: App.h:49
GuiType m_gui_type
Definition: App.h:192
Definition: App.h:44
void readConfig()
Definition: App.cpp:409
void switchGuiType(Kwave::TopWidget *top, GuiType new_type)
Definition: App.cpp:307
GuiType guiType() const
Definition: App.h:119
void processCmdline(QCommandLineParser *cmdline)
Definition: App.cpp:75
void recentFilesChanged()
virtual bool isOK() const
Definition: App.cpp:172
int newWindow(const QUrl &url)
Definition: App.cpp:224
const QCommandLineParser * cmdline() const
Definition: App.h:130
virtual ~App()
Definition: App.cpp:119
QStringList recentFiles() const
Definition: App.h:113
QPair< QString, int > FileAndInstance
Definition: App.h:60
void addRecentFile(const QString &filename)
Definition: App.cpp:202
int executeCommand(const QString &command)
Definition: App.cpp:178
bool toplevelWindowHasClosed(Kwave::TopWidget *todel)
Definition: App.cpp:280
QList< Kwave::TopWidget * > m_top_widgets
Definition: App.h:189
void saveRecentFiles()
Definition: App.cpp:392