|
kwave
18.07.70
|
#include <App.h>


Public Types | |
| enum | GuiType { GUI_SDI, GUI_MDI, GUI_TAB } |
| typedef QPair< QString, int > | FileAndInstance |
Public Slots | |
| int | newInstance (const QStringList &args, const QString &dir) |
Signals | |
| void | recentFilesChanged () |
Public Member Functions | |
| App (int &argc, char **argv) | |
| void | processCmdline (QCommandLineParser *cmdline) |
| virtual bool | isOK () const |
| virtual | ~App () |
| void | addRecentFile (const QString &filename) |
| int | newWindow (const QUrl &url) |
| bool | toplevelWindowHasClosed (Kwave::TopWidget *todel) |
| QStringList | recentFiles () const |
| QList< FileAndInstance > | openFiles () const |
| GuiType | guiType () const |
| void | switchGuiType (Kwave::TopWidget *top, GuiType new_type) |
| const QCommandLineParser * | cmdline () const |
Protected Member Functions | |
| int | executeCommand (const QString &command) |
Private Member Functions | |
| void | readConfig () |
| void | saveRecentFiles () |
Private Attributes | |
| QCommandLineParser * | m_cmdline |
| QStringList | m_recent_files |
| QList< Kwave::TopWidget * > | m_top_widgets |
| GuiType | m_gui_type |
Friends | |
| class | Kwave::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.
| typedef QPair<QString,int> Kwave::App::FileAndInstance |
| enum Kwave::App::GuiType |
| Kwave::App::App | ( | int & | argc, |
| char ** | argv | ||
| ) |
Constructor
| argc | number of cmdline args, must be >= 1 |
| argv | list of cmdline args, must be static |
Definition at line 55 of file App.cpp.
References Kwave::connect(), and Kwave::ClipBoard::instance().

|
virtual |
Destructor.
Definition at line 119 of file App.cpp.
References m_recent_files, and saveRecentFiles().

| void Kwave::App::addRecentFile | ( | const QString & | filename | ) |
Adds a file to the top of the list of recent files. If it was already contained in the list the previous occurrence is removed.
| filename | path to the file |
Definition at line 202 of file App.cpp.
References m_recent_files, MAX_RECENT_FILES, recentFilesChanged(), and saveRecentFiles().
Referenced by Kwave::TopWidget::loadFile(), and Kwave::FileContext::saveFileAs().


|
inline |
Returns the command line parameters passed to the application
Definition at line 130 of file App.h.
References m_cmdline, newInstance(), and recentFilesChanged().
Referenced by processCmdline(), and Kwave::TopWidget::TopWidget().


|
protected |
process an application global Kwave text command
| command | the text command to handle |
| 0 | if succeeded |
| ENOSYS | if the command is unknown |
| -EIO | if failed |
Definition at line 178 of file App.cpp.
References _, Kwave::Parser::command(), Kwave::Parser::hasParams(), m_recent_files, newWindow(), Kwave::Parser::params(), recentFilesChanged(), and saveRecentFiles().
Referenced by Kwave::TopWidget::executeCommand().


|
inline |
returns the GUI type (e.g. SDI, MDI etc.)
Definition at line 119 of file App.h.
References m_gui_type, and switchGuiType().
Referenced by Kwave::FileContext::closeFile(), Kwave::TopWidget::executeCommand(), Kwave::TopWidget::init(), Kwave::TopWidget::insertContext(), Kwave::FileContext::metaDataChanged(), Kwave::FileContext::modifiedChanged(), Kwave::TopWidget::newWindow(), Kwave::MainWidget::resizeEvent(), Kwave::TopWidget::updateMenu(), and Kwave::FileContext::windowCaption().


|
virtual |
Returns true if this instance was successfully initialized, or false if something went wrong during initialization.
Definition at line 172 of file App.cpp.
References m_top_widgets.
|
slot |
Connected to the DBus service to open a new window.
| 0 | if the new instance was successfully created and the application should run |
| ECANCELED | if the application should shut down (e.g. when a script was loaded and the script has called quit() ) |
Definition at line 129 of file App.cpp.
References _, Kwave::connect(), m_cmdline, name, newWindow(), Kwave::Logger::open(), readConfig(), and Kwave::Splash::showMessage().
Referenced by cmdline(), and main().


| int Kwave::App::newWindow | ( | const QUrl & | url | ) |
Opens a new toplevel window. If a filename is specified the file will be opened.
| url | URL of the file to be loaded, (optional, might be empty) |
| 0 | if succeeded |
| ECANCELED | if the application should shut down (e.g. when a script was loaded and the script has called quit() ) |
Definition at line 224 of file App.cpp.
References Kwave::connect(), GUI_MDI, GUI_SDI, GUI_TAB, Kwave::TopWidget::init(), Kwave::TopWidget::loadFile(), m_gui_type, m_top_widgets, recentFilesChanged(), Kwave::Splash::showMessage(), and Kwave::urlScheme().
Referenced by executeCommand(), newInstance(), and Kwave::TopWidget::newWindow().


| QList< Kwave::App::FileAndInstance > Kwave::App::openFiles | ( | ) | const |
Returns a list of currently opened files and their instance
Definition at line 294 of file App.cpp.
References m_top_widgets, and Kwave::TopWidget::openFiles().
Referenced by Kwave::FileContext::metaDataChanged(), and recentFiles().


| void Kwave::App::processCmdline | ( | QCommandLineParser * | cmdline | ) |
process the command line settings, after setting up the application, command line parser and about data
| cmdline | command line parser |
Definition at line 75 of file App.cpp.
References _, cmdline(), GUI_MDI, GUI_SDI, GUI_TAB, m_cmdline, and m_gui_type.
Referenced by main().


|
private |
Reads the configuration settings and the list of recent files
Definition at line 409 of file App.cpp.
References m_recent_files, and MAX_RECENT_FILES.
Referenced by newInstance().

|
inline |
Returns a reference to the list of recent files
Definition at line 113 of file App.h.
References m_recent_files, and openFiles().
Referenced by Kwave::TopWidget::updateRecentFiles().


|
signal |
Will be emitted if the list of recent files has changed. Can be used by toplevel widgets to update their menus.
Referenced by addRecentFile(), cmdline(), executeCommand(), newWindow(), and switchGuiType().

|
private |
Saves the list of recent files to the kwave configuration file
Definition at line 392 of file App.cpp.
References m_recent_files, and MAX_RECENT_FILES.
Referenced by addRecentFile(), executeCommand(), toplevelWindowHasClosed(), and ~App().

| void Kwave::App::switchGuiType | ( | Kwave::TopWidget * | top, |
| GuiType | new_type | ||
| ) |
Switches the GUI type to a new style, using the current toplevel widget as start.
| top | the current toplevel widget |
| new_type | the new GUI type |
Definition at line 307 of file App.cpp.
References Kwave::connect(), Kwave::TopWidget::detachAllContexts(), GUI_MDI, GUI_SDI, GUI_TAB, Kwave::TopWidget::init(), Kwave::TopWidget::insertContext(), Kwave::FileContext::isEmpty(), m_gui_type, m_top_widgets, recentFilesChanged(), Kwave::FileContext::release(), and Kwave::FileContext::setParent().
Referenced by Kwave::TopWidget::executeCommand(), and guiType().


| bool Kwave::App::toplevelWindowHasClosed | ( | Kwave::TopWidget * | todel | ) |
Called when a toplevel window has closed.
| todel | the toplevel window that has closed |
Definition at line 280 of file App.cpp.
References m_top_widgets, and saveRecentFiles().
Referenced by Kwave::TopWidget::~TopWidget().


|
friend |
|
private |
reference to a (static) command line parser
Definition at line 179 of file App.h.
Referenced by cmdline(), newInstance(), and processCmdline().
|
private |
the GUI type, e.g. SDI or MDI
Definition at line 192 of file App.h.
Referenced by guiType(), newWindow(), processCmdline(), and switchGuiType().
|
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.
Definition at line 186 of file App.h.
Referenced by addRecentFile(), executeCommand(), readConfig(), recentFiles(), saveRecentFiles(), and ~App().
|
private |
list of toplevel widgets
Definition at line 189 of file App.h.
Referenced by isOK(), newWindow(), openFiles(), switchGuiType(), and toplevelWindowHasClosed().