aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/desktop-plugins
diff options
context:
space:
mode:
authorKen Moore <ken@pcbsd.org>2015-01-21 10:34:16 -0500
committerKen Moore <ken@pcbsd.org>2015-01-21 10:34:16 -0500
commit9c20a0fa59d8d08ed9af8ccc3a89f90aab3b7616 (patch)
treeeda45ecedde1c6b80b67f95a075bb83ff992151c /lumina-desktop/desktop-plugins
parentAdd the ability to change the user's icon via session->general options (will ... (diff)
downloadlumina-9c20a0fa59d8d08ed9af8ccc3a89f90aab3b7616.tar.gz
lumina-9c20a0fa59d8d08ed9af8ccc3a89f90aab3b7616.tar.bz2
lumina-9c20a0fa59d8d08ed9af8ccc3a89f90aab3b7616.zip
Clean up all the dialog usage in the notepad and audioplay desktop plugins. Now the dialogs should not prevent the desktop from updating appropriately (not modal).
Diffstat (limited to 'lumina-desktop/desktop-plugins')
-rw-r--r--lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.cpp59
-rw-r--r--lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp4
2 files changed, 56 insertions, 7 deletions
diff --git a/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.cpp b/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.cpp
index ffd5df93..cc1136f1 100644
--- a/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.cpp
+++ b/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.cpp
@@ -13,6 +13,7 @@
#include <QFileDialog>
#include <LuminaXDG.h>
#include <QDebug>
+#include <QDesktopWidget>
PlayerWidget::PlayerWidget(QWidget *parent) : QWidget(parent), ui(new Ui::PlayerWidget()){
ui->setupUi(this); //load the designer form
@@ -93,9 +94,24 @@ void PlayerWidget::prevClicked(){
void PlayerWidget::AddFilesToPlaylist(){
//Prompt the user to select multimedia files
+ QFileDialog dlg(0, Qt::Dialog | Qt::WindowStaysOnTopHint );
+ dlg.setFileMode(QFileDialog::ExistingFiles);
+ dlg.setAcceptMode(QFileDialog::AcceptOpen);
+ dlg.setNameFilter( tr("Multimedia Files")+" ("+LXDG::findAVFileExtensions().join(" ")+")");
+ dlg.setWindowTitle(tr("Select Multimedia Files"));
+ dlg.setWindowIcon( LXDG::findIcon("file-open","") );
+ dlg.setDirectory(QDir::homePath()); //start in the home directory
+ //ensure it is centered on the current screen
+ QPoint center = QApplication::desktop()->screenGeometry(this).center();
+ dlg.move( center.x()-(dlg.width()/2), center.y()-(dlg.height()/2) );
+ dlg.show();
+ while( dlg.isVisible() ){
+ QApplication::processEvents();
+ }
+ QList<QUrl> files = dlg.selectedUrls();
+ if(files.isEmpty() || dlg.result()!=QDialog::Accepted){ return; } //cancelled
//Make this use show/processEvents later
- QList<QUrl> files = QFileDialog::getOpenFileUrls(0, tr("Select Multimedia Files"), QDir::homePath(), "Multimedia Files ("+LXDG::findAVFileExtensions().join(" ")+")");
- if(files.isEmpty()){ return; } //cancelled
+ //QList<QUrl> files = QFileDialog::getOpenFileUrls(0, tr("Select Multimedia Files"), QDir::homePath(), "Multimedia Files ("+LXDG::findAVFileExtensions().join(" ")+")");
QList<QMediaContent> urls;
for(int i=0; i<files.length(); i++){
urls << QMediaContent(files[i]);
@@ -105,7 +121,24 @@ void PlayerWidget::AddFilesToPlaylist(){
}
void PlayerWidget::AddDirToPlaylist(){
- QString dirpath = QFileDialog::getExistingDirectory(0, tr("Select a Multimedia Directory"), QDir::homePath() );
+ QFileDialog dlg(0, Qt::Dialog | Qt::WindowStaysOnTopHint );
+ dlg.setFileMode(QFileDialog::Directory);
+ dlg.setOption(QFileDialog::ShowDirsOnly, true);
+ dlg.setAcceptMode(QFileDialog::AcceptOpen);
+ dlg.setWindowTitle(tr("Select Multimedia Directory"));
+ dlg.setWindowIcon( LXDG::findIcon("folder-open","") );
+ dlg.setDirectory(QDir::homePath()); //start in the home directory
+ //ensure it is centered on the current screen
+ QPoint center = QApplication::desktop()->screenGeometry(this).center();
+ dlg.move( center.x()-(dlg.width()/2), center.y()-(dlg.height()/2) );
+ dlg.show();
+ while( dlg.isVisible() ){
+ QApplication::processEvents();
+ }
+ if(dlg.result() != QDialog::Accepted){ return; } //cancelled
+ QStringList sel = dlg.selectedFiles();
+ if(sel.isEmpty()){ return; } //cancelled
+ QString dirpath = sel.first(); //QFileDialog::getExistingDirectory(0, tr("Select a Multimedia Directory"), QDir::homePath() );
if(dirpath.isEmpty()){ return; } //cancelled
QDir dir(dirpath);
QFileInfoList files = dir.entryInfoList(LXDG::findAVFileExtensions(), QDir::Files | QDir::NoDotAndDotDot, QDir::Name);
@@ -119,8 +152,24 @@ void PlayerWidget::AddDirToPlaylist(){
}
void PlayerWidget::AddURLToPlaylist(){
- QString url = QInputDialog::getText(0, tr("Multimedia URL"), tr("Enter a valid URL for a multimedia file or stream"), QLineEdit::Normal);
- if(url.isEmpty()){ return; }
+ QInputDialog dlg(0, Qt::Dialog | Qt::WindowStaysOnTopHint );
+ dlg.setInputMode(QInputDialog::TextInput);
+ dlg.setLabelText(tr("Enter a valid URL for a multimedia file or stream:"));
+ dlg.setTextEchoMode(QLineEdit::Normal);
+ dlg.setWindowTitle(tr("Multimedia URL"));
+ dlg.setWindowIcon( LXDG::findIcon("download","") );
+ //ensure it is centered on the current screen
+ QPoint center = QApplication::desktop()->screenGeometry(this).center();
+ dlg.move( center.x()-(dlg.width()/2), center.y()-(dlg.height()/2) );
+ dlg.show();
+ while( dlg.isVisible() ){
+ QApplication::processEvents();
+ }
+ QString url = dlg.textValue();
+ if(url.isEmpty() || dlg.result()!=QDialog::Accepted){ return; } //cancelled
+
+ //QString url = QInputDialog::getText(0, tr("Multimedia URL"), tr("Enter a valid URL for a multimedia file or stream"), QLineEdit::Normal);
+ //if(url.isEmpty()){ return; }
QUrl newurl(url);
if(!newurl.isValid()){ return; } //invalid URL
PLAYLIST->addMedia(newurl);
diff --git a/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp b/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp
index 17372202..af1c78f5 100644
--- a/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp
+++ b/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp
@@ -118,7 +118,7 @@ void NotePadPlugin::openNote(){
QApplication::processEvents();
}
QStringList sel = dlg.selectedFiles();
- if(sel.isEmpty()){ return; } //cancelled
+ if(sel.isEmpty() || dlg.result()!=QDialog::Accepted){ return; } //cancelled
QString fullpath = sel.first();
QString name = fullpath.section("/",-1);
//qDebug() << " - Found Note:" << name << fullpath;
@@ -156,7 +156,7 @@ void NotePadPlugin::newNote(){
QApplication::processEvents();
}
QString name = dlg.textValue();
- if(name.isEmpty()){ return; } //cancelled
+ if(name.isEmpty() || dlg.result()!=QDialog::Accepted){ return; } //cancelled
QString fullpath = QDir::homePath()+"/Notes/"+name;
if(!fullpath.endsWith(".note")){ fullpath.append(".note"); }
//qDebug() << " - New Note:" << name << fullpath;
bgstack15