diff options
author | Ken Moore <moorekou@gmail.com> | 2015-08-27 15:17:25 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2015-08-27 15:17:25 -0400 |
commit | d2fe28acc6a305a8632809916e99ac95cce62871 (patch) | |
tree | 32b44b362e4f0a665d0b53cfdd4358ba05c04dab | |
parent | Get drag and drop functionality completely working (Internal only - will not ... (diff) | |
download | lumina-d2fe28acc6a305a8632809916e99ac95cce62871.tar.gz lumina-d2fe28acc6a305a8632809916e99ac95cce62871.tar.bz2 lumina-d2fe28acc6a305a8632809916e99ac95cce62871.zip |
Add a new "ScrollDialog" to lumina-fm for instances where a lot of text might be getting shown to the user. Use this dialog for checksums as well.
-rw-r--r-- | lumina-fm/FODialog.cpp | 2 | ||||
-rw-r--r-- | lumina-fm/ScrollDialog.h | 55 | ||||
-rw-r--r-- | lumina-fm/lumina-fm.pro | 1 | ||||
-rw-r--r-- | lumina-fm/widgets/DirWidget.cpp | 11 |
4 files changed, 66 insertions, 3 deletions
diff --git a/lumina-fm/FODialog.cpp b/lumina-fm/FODialog.cpp index a4d9afa7..b039166a 100644 --- a/lumina-fm/FODialog.cpp +++ b/lumina-fm/FODialog.cpp @@ -26,7 +26,7 @@ FODialog::FODialog(QWidget *parent) : QDialog(parent), ui(new Ui::FODialog){ //Make sure this dialog is centered on the parent if(parent!=0){ - QPoint ctr = parent->geometry().center(); + QPoint ctr = parent->mapToGlobal(parent->geometry().center()); this->move( ctr.x()-(this->width()/2), ctr.y()-(this->height()/2) ); } this->show(); diff --git a/lumina-fm/ScrollDialog.h b/lumina-fm/ScrollDialog.h new file mode 100644 index 00000000..eefe62f4 --- /dev/null +++ b/lumina-fm/ScrollDialog.h @@ -0,0 +1,55 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2014, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +// This is the dialog for showing a lot of text in a scrollable format (instead of QMessageBox) +//=========================================== +#ifndef _LUMINA_FILE_MANAGER_SCROLL_DIALOG_H +#define _LUMINA_FILE_MANAGER_SCROLL_DIALOG_H + +#include <QDialog> +#include <QVBoxLayout> +#include <QTextEdit> +#include <QDialogButtonBox> + +class ScrollDialog : public QDialog{ + Q_OBJECT + +private: + QDialogButtonBox *buttons; + QTextEdit *label; + QVBoxLayout *layout1; + +public: + ScrollDialog(QWidget *parent = 0) : QDialog(parent){ + //Create the widgets + buttons = new QDialogButtonBox(QDialogButtonBox::Ok, Qt::Horizontal, this); + label = new QTextEdit(this); + label->setReadOnly(true); + label->setWordWrapMode(QTextOption::NoWrap); + layout1 = new QVBoxLayout(this); + //Put them in the dialog + layout1->addWidget(label); + layout1->addWidget(buttons); + this->setLayout(layout1); + //Connect signals/slots + connect(buttons, SIGNAL(accepted()), this, SLOT(accept()) ); + connect(buttons, SIGNAL(rejected()), this, SLOT(reject()) ); + //Set a useful size/position + this->resize(400,200); + if(parent!=0){ + QPoint ctr = parent->mapToGlobal(parent->geometry().center()); + this->move( ctr.x()-(this->width()/2), ctr.y()-(this->height()/2) ); + } + } + ~ScrollDialog(){} + + void setText(QString txt){ + label->setPlainText(txt); + //this->resize( label->fontMetrics().width(txt.section("\n",0,0))+30, this->height()); + } + +}; +#endif
\ No newline at end of file diff --git a/lumina-fm/lumina-fm.pro b/lumina-fm/lumina-fm.pro index de3b84f2..e3c4d164 100644 --- a/lumina-fm/lumina-fm.pro +++ b/lumina-fm/lumina-fm.pro @@ -25,6 +25,7 @@ SOURCES += main.cpp \ HEADERS += MainUI.h \ FODialog.h \ BMMDialog.h \ + ScrollDialog.h \ DirData.h \ widgets/DDListWidgets.h \ widgets/MultimediaWidget.h \ diff --git a/lumina-fm/widgets/DirWidget.cpp b/lumina-fm/widgets/DirWidget.cpp index 1c8df0bd..53fa40c2 100644 --- a/lumina-fm/widgets/DirWidget.cpp +++ b/lumina-fm/widgets/DirWidget.cpp @@ -18,6 +18,8 @@ #include <LuminaXDG.h> #include <LuminaUtils.h> +#include "../ScrollDialog.h" + DirWidget::DirWidget(QString objID, QWidget *parent) : QWidget(parent), ui(new Ui::DirWidget){ ui->setupUi(this); //load the designer file ID = objID; @@ -679,14 +681,19 @@ void DirWidget::fileCheckSums(){ qDebug() << " - Info:" << info; if(info.isEmpty() || (info.length() != files.length()) ){ return; } for(int i=0; i<info.length(); i++){ - info[i] = QString("%2 \t(%1)").arg(files[i].section("/",-1), info[i]); + info[i] = QString("%2\n\t(%1)").arg(files[i].section("/",-1), info[i]); } + ScrollDialog dlg(this); + dlg.setWindowTitle( tr("File Checksums:") ); + dlg.setWindowIcon( LXDG::findIcon("document-encrypted","") ); + dlg.setText(info.join("\n")); + dlg.exec(); /*QMessageBox dlg(this); dlg.setWindowFlags( Qt::Dialog ); dlg.setWindowTitle( tr("File Checksums") ); dlg.setDetailedText(info.join("\n")); dlg.exec();*/ - QMessageBox::information(this, tr("File Checksums"), info.join("\n") ); + //QMessageBox::information(this, tr("File Checksums"), info.join("\n") ); } void DirWidget::fileProperties(){ |