[a21201]: kwave / KwaveApp.h Maximize Restore History

Download this file

KwaveApp.h    161 lines (129 with data), 4.5 kB

  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
151
152
153
154
155
156
157
158
159
160
/***************************************************************************
KwaveApp.h - The Kwave main application
-------------------
begin : Wed Feb 28 2001
copyright : (C) 2001 by Thomas Eschenbacher
email : Thomas.Eschenbacher@gmx.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef _KWAVE_APP_H_
#define _KWAVE_APP_H_
#include "config.h"
#include <qptrlist.h>
#include <qstringlist.h>
#include <kuniqueapp.h>
#include <kapp.h>
class ClipBoard;
class KURL;
class MemoryManager;
class QString;
class TopWidget;
/**
* This is the main application class for Kwave. It contains functions
* for opening and saving files, opening new windows and holds global
* configuration data.
*/
class KwaveApp :public KUniqueApplication
{
Q_OBJECT
public:
KwaveApp();
/**
* Returns true if this instance was successfully initialized, or
* false if something went wrong during initialization.
*/
virtual bool isOK();
/** Destructor. */
virtual ~KwaveApp();
/**
* Returns the name of the application
*/
QString appName() { return name(); };
/**
* Adds a file to the top of the list of recent files. If it was
* already contained in the list the previous occourence is removed.
* @param filename path to the file
*/
void addRecentFile(const QString &filename);
/**
* Overwritten for unique application to open a new window.
*/
virtual int newInstance();
/**
* Opens a new toplevel window. If a filename is specified the will
* will be opened (should be a .wav-file).
* @param url URL of the file to be loaded, (optional, might be empty)
* @return true if succeeded
* @see #closeWindow()
* @see TopWidget
*/
bool newWindow(const KURL &url);
/**
* Closes a previously opened toplevel window.
* @param todel the toplevel window that closes down
* @return true if it was the last toplevel window
* @see #newWindow()
* @see TopWidget
*/
bool closeWindow(TopWidget *todel);
/** Returns a reference to the list of recent files */
QStringList recentFiles() {
return m_recent_files;
};
/** Returns a reference to Kwave's clipboard */
static ClipBoard &clipboard();
/** Returns a reference to Kwave's memory manager */
static MemoryManager &memoryManager();
signals:
/**
* Will be emitted if the list of recent files has changed. Can
* be used by toplevel widgets to update their menus.
*/
void recentFilesChanged();
protected:
friend class TopWidget;
bool executeCommand(const QString &command);
protected:
/**
* Reads the configuration settings and the list of recent files,
* opposite of saveConfig().
* @see #saveConfig()
*/
void readConfig();
/**
* Saves the list of recent files to the kwave configuration file
* @see KConfig
*/
void saveRecentFiles();
/**
* Saves the current configuration of kwave to the configuration file,
* opposite of readConfig(). Also saves the list of recent files.
* @see #saveRecentFiles()
*/
void saveConfig();
#ifdef HAVE_ARTS_SUPPORT
/** Initialises the aRts daemon */
void initArts();
#endif /* HAVE_ARTS_SUPPORT */
private:
/**
* Local list of recent files. This list will be synchronized
* with the global list of recent files stored in the libkwave
* library whenever there is a change.
*/
QStringList m_recent_files;
/** list of toplevel widgets */
QPtrList<TopWidget> m_topwidget_list;
/** Kwave's clipboard */
static ClipBoard &m_clipboard;
/** Kwave's memory manager */
static MemoryManager &m_memory_manager;
};
#endif // _KWAVE_APP_H_