|
kwave
18.07.70
|
#include <FileDialog.h>


Public Types | |
| enum | OperationMode { SaveFile = 0, OpenFile, SelectDir } |
Signals | |
| void | filterChanged (const QString &filter) |
Public Member Functions | |
| FileDialog (const QString &startDir, OperationMode mode, const QString &filter, QWidget *parent, const QUrl last_url=QUrl(), const QString last_ext=QString()) | |
| virtual | ~FileDialog () Q_DECL_OVERRIDE |
| QString | selectedExtension () |
| QUrl | selectedUrl () const |
| QUrl | baseUrl () const |
| void | setDirectory (const QString &directory) |
| void | selectUrl (const QUrl &url) |
| void | setCustomWidget (QWidget *widget) |
| KUrlComboBox * | locationEdit () const |
Protected Slots | |
| virtual void | accept () Q_DECL_OVERRIDE |
| void | saveConfig () |
Protected Member Functions | |
| void | loadConfig (const QString §ion) |
Private Member Functions | |
| QString | guessFilterFromFileExt (const QString &pattern, OperationMode mode) |
Private Attributes | |
| QVBoxLayout | m_layout |
| KFileWidget | m_file_widget |
| QString | m_config_group |
| QUrl | m_last_url |
| QString | m_last_ext |
An improved version of KFileWidget that does not forget the previous directory and pre-selects the previous file extension.
Definition at line 41 of file FileDialog.h.
| Enumerator | |
|---|---|
| SaveFile | save a file |
| OpenFile | open a file |
| SelectDir | select a directory |
Definition at line 45 of file FileDialog.h.
| Kwave::FileDialog::FileDialog | ( | const QString & | startDir, |
| OperationMode | mode, | ||
| const QString & | filter, | ||
| QWidget * | parent, | ||
| const QUrl | last_url = QUrl(), |
||
| const QString | last_ext = QString() |
||
| ) |
Constructor.
| startDir | directory to start with, can start with the scheme "kfiledialog://scope/path" |
| mode | determines the mode in which the dialog is used, either to open a file, save a file or select a directory |
| filter | a "\n" separated list of file filters, each filter consists of a space separated list of file patterns (including "*.") and a "|" as separator followed by a verbose description of the file type |
| parent | the parent widget of the dialog |
| last_url | URL used for the last call, optional |
| last_ext | file extension (pattern) used for the last call (optional), including a "*." |
Definition at line 41 of file FileDialog.cpp.
References _, accept(), Kwave::connect(), DBG, filterChanged(), guessFilterFromFileExt(), loadConfig(), m_file_widget, m_last_ext, m_last_url, m_layout, OpenFile, SaveFile, and SelectDir.

|
inlinevirtual |
|
protectedvirtualslot |
overwritten to call accept() of the KFileWidget and saveConfig()
Definition at line 277 of file FileDialog.cpp.
References m_file_widget, and saveConfig().
Referenced by FileDialog().


| QUrl Kwave::FileDialog::baseUrl | ( | ) | const |
Returns the URL of the currently visible directory
Definition at line 259 of file FileDialog.cpp.
References m_file_widget.
Referenced by Kwave::SaveBlocksDialog::emitUpdate().

|
signal |
Referenced by FileDialog(), and Kwave::SaveBlocksDialog::SaveBlocksDialog().

|
private |
Try to guess a file filter from a given file extension
| pattern | a file extension, e.g. "*.wav *.snd" |
| mode | determines the mode in which the dialog is used, see constructor |
Definition at line 288 of file FileDialog.cpp.
References _, Kwave::CodecManager::decodingFilter(), Kwave::CodecManager::encodingFilter(), and SaveFile.
Referenced by FileDialog().


|
protected |
load previous settings
Definition at line 169 of file FileDialog.cpp.
References m_config_group, m_last_ext, and m_last_url.
Referenced by FileDialog().

| KUrlComboBox * Kwave::FileDialog::locationEdit | ( | ) | const |
Returns the combobox used to type the filename or full location of the file.
Definition at line 346 of file FileDialog.cpp.
References m_file_widget.
Referenced by Kwave::SaveBlocksDialog::emitUpdate(), and Kwave::SaveBlocksDialog::SaveBlocksDialog().

|
protectedslot |
save current settings
Definition at line 199 of file FileDialog.cpp.
References _, m_config_group, m_file_widget, m_last_ext, m_last_url, and selectedUrl().
Referenced by accept().


| QString Kwave::FileDialog::selectedExtension | ( | ) |
Returns the previously used extension, including "*."
Definition at line 246 of file FileDialog.cpp.
References _, and m_file_widget.
Referenced by Kwave::SaveBlocksDialog::emitUpdate().

| QUrl Kwave::FileDialog::selectedUrl | ( | ) | const |
Returns the first selected URL (if any)
Definition at line 253 of file FileDialog.cpp.
References m_file_widget.
Referenced by Kwave::MainWidget::loadLabels(), Kwave::TopWidget::openFile(), Kwave::SonagramWindow::save(), saveConfig(), Kwave::FileContext::saveFileAs(), Kwave::MainWidget::saveLabels(), and Kwave::MemoryDialog::searchSwapDir().

| void Kwave::FileDialog::selectUrl | ( | const QUrl & | url | ) |
Sets the currently selected URL
| url | the new URL to show |
Definition at line 271 of file FileDialog.cpp.
References m_file_widget.
Referenced by Kwave::PlayBackDialog::selectPlaybackDevice(), and Kwave::RecordDialog::selectRecordDevice().

| void Kwave::FileDialog::setCustomWidget | ( | QWidget * | widget | ) |
Add a custom widget to the dialog
Definition at line 340 of file FileDialog.cpp.
References m_file_widget.
Referenced by Kwave::K3BExportDialog::K3BExportDialog(), and Kwave::SaveBlocksDialog::SaveBlocksDialog().

| void Kwave::FileDialog::setDirectory | ( | const QString & | directory | ) |
Sets the current directory
| directory | the new directory to show |
Definition at line 265 of file FileDialog.cpp.
References m_file_widget.
Referenced by Kwave::MP3EncoderDialog::browseFile().

|
private |
name of the group in the config file
Definition at line 157 of file FileDialog.h.
Referenced by loadConfig(), and saveConfig().
|
private |
the KFileWidget that we wrap
Definition at line 154 of file FileDialog.h.
Referenced by accept(), baseUrl(), FileDialog(), locationEdit(), saveConfig(), selectedExtension(), selectedUrl(), selectUrl(), setCustomWidget(), and setDirectory().
|
private |
extension of the last selected single URL or file
Definition at line 163 of file FileDialog.h.
Referenced by FileDialog(), loadConfig(), and saveConfig().
|
private |
URL of the previously opened file or directory
Definition at line 160 of file FileDialog.h.
Referenced by FileDialog(), loadConfig(), and saveConfig().
|
private |
layout for holding the KFileWidget
Definition at line 151 of file FileDialog.h.
Referenced by FileDialog().