Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit c4c0da04 authored by Michael Pyne's avatar Michael Pyne

Port from KVBox and KDialog in the file renamer U/I.

parent 9844462a
...@@ -31,12 +31,13 @@ ...@@ -31,12 +31,13 @@
#include <klineedit.h> #include <klineedit.h>
#include <klocale.h> #include <klocale.h>
#include <kmessagebox.h> #include <kmessagebox.h>
#include <kvbox.h>
#include <QFile> #include <QFile>
#include <QTimer> #include <QTimer>
#include <QCheckBox> #include <QCheckBox>
#include <QDir> #include <QDir>
#include <QDialog>
#include <QDialogButtonBox>
#include <QUrl> #include <QUrl>
#include <QLabel> #include <QLabel>
#include <QSignalMapper> #include <QSignalMapper>
...@@ -55,30 +56,30 @@ ...@@ -55,30 +56,30 @@
#include "coverinfo.h" #include "coverinfo.h"
#include "juk_debug.h" #include "juk_debug.h"
class ConfirmationDialog : public KDialog class ConfirmationDialog : public QDialog
{ {
public: public:
ConfirmationDialog(const QMap<QString, QString> &files, ConfirmationDialog(const QMap<QString, QString> &files,
QWidget *parent = 0, const char *name = 0) QWidget *parent = nullptr)
: KDialog(parent) : QDialog(parent)
{ {
setObjectName( QLatin1String( name ) );
setModal(true); setModal(true);
setCaption(i18nc("warning about mass file rename", "Warning")); setWindowTitle(i18nc("warning about mass file rename", "Warning"));
setButtons(Ok | Cancel);
KVBox *vbox = new KVBox(this); auto vboxLayout = new QVBoxLayout(this);
setMainWidget(vbox); auto hbox = new QWidget(this);
KVBox *hbox = new KVBox(vbox); auto hboxVLayout = new QVBoxLayout(hbox);
vboxLayout->addWidget(hbox);
QLabel *l = new QLabel(hbox); QLabel *l = new QLabel(hbox);
l->setPixmap(SmallIcon("dialog-warning", 32)); l->setPixmap(SmallIcon("dialog-warning", 32));
hboxVLayout->addWidget(l);
l = new QLabel(i18n("You are about to rename the following files. " l = new QLabel(i18n("You are about to rename the following files. "
"Are you sure you want to continue?"), hbox); "Are you sure you want to continue?"), hbox);
hbox->setStretchFactor(l, 1); hboxVLayout->addWidget(l, 1);
QTreeWidget *lv = new QTreeWidget(vbox); QTreeWidget *lv = new QTreeWidget(this);
QStringList headers; QStringList headers;
headers << i18n("Original Name"); headers << i18n("Original Name");
...@@ -86,6 +87,12 @@ public: ...@@ -86,6 +87,12 @@ public:
lv->setHeaderLabels(headers); lv->setHeaderLabels(headers);
lv->setRootIsDecorated(false); lv->setRootIsDecorated(false);
vboxLayout->addWidget(lv);
auto buttonBox = new QDialogButtonBox(this);
vboxLayout->addWidget(buttonBox);
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
int lvHeight = 0; int lvHeight = 0;
...@@ -107,6 +114,7 @@ public: ...@@ -107,6 +114,7 @@ public:
lvHeight += lv->horizontalScrollBar()->height() + lv->header()->height(); lvHeight += lv->horizontalScrollBar()->height() + lv->header()->height();
lv->setMinimumHeight(qMin(lvHeight, 400)); lv->setMinimumHeight(qMin(lvHeight, 400));
resize(qMin(width(), 500), qMin(minimumHeight(), 400)); resize(qMin(width(), 500), qMin(minimumHeight(), 400));
show(); show();
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
* this program. If not, see <http://www.gnu.org/licenses/>. * this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef FILERENAMER_H #ifndef JUK_FILERENAMER_H
#define FILERENAMER_H #define JUK_FILERENAMER_H
#include <QString> #include <QString>
#include <QVector> #include <QVector>
...@@ -543,6 +543,6 @@ private: ...@@ -543,6 +543,6 @@ private:
bool moveFile(const QString &src, const QString &dest); bool moveFile(const QString &src, const QString &dest);
}; };
#endif /* FILERENAMER_H */ #endif /* JUK_FILERENAMER_H */
// vim: set et sw=4 tw=0 sta: // vim: set et sw=4 tw=0 sta:
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
#include "juk_debug.h" #include "juk_debug.h"
FileRenamerTagOptions::FileRenamerTagOptions(QWidget *parent, FileRenamerTagOptions::FileRenamerTagOptions(QWidget *parent,
const TagRenamerOptions &options) : const TagRenamerOptions &options)
QWidget(parent), : QWidget(parent)
Ui::FileRenamerTagOptionsBase(), , Ui::FileRenamerTagOptionsBase()
m_options(options) , m_options(options)
{ {
setupUi(this); setupUi(this);
...@@ -96,7 +96,6 @@ void FileRenamerTagOptions::slotTrackWidthChanged() ...@@ -96,7 +96,6 @@ void FileRenamerTagOptions::slotTrackWidthChanged()
void FileRenamerTagOptions::slotEmptyActionChanged() void FileRenamerTagOptions::slotEmptyActionChanged()
{ {
m_options.setEmptyText(m_emptyTagValue->text()); m_options.setEmptyText(m_emptyTagValue->text());
m_options.setEmptyAction(TagRenamerOptions::IgnoreEmptyTag); m_options.setEmptyAction(TagRenamerOptions::IgnoreEmptyTag);
if(m_useValueButton->isChecked()) if(m_useValueButton->isChecked())
...@@ -107,21 +106,26 @@ void FileRenamerTagOptions::slotEmptyActionChanged() ...@@ -107,21 +106,26 @@ void FileRenamerTagOptions::slotEmptyActionChanged()
TagOptionsDialog::TagOptionsDialog(QWidget *parent, TagOptionsDialog::TagOptionsDialog(QWidget *parent,
const TagRenamerOptions &options, const TagRenamerOptions &options,
unsigned categoryNumber) : unsigned categoryNumber)
KDialog(parent, 0), : QDialog(parent)
m_options(options), , m_options(options)
m_categoryNumber(categoryNumber) , m_categoryNumber(categoryNumber)
{ {
setModal(true); setModal(true);
setCaption(i18n("File Renamer")); setWindowTitle(i18n("File Renamer"));
setButtons(Ok|Cancel);
loadConfig(); loadConfig();
m_widget = new FileRenamerTagOptions(this, m_options); m_widget = new FileRenamerTagOptions(this, m_options);
m_widget->setMinimumSize(400, 200); m_widget->setMinimumSize(400, 200);
setMainWidget(m_widget); connect(m_widget->dlgButtonBox, &QDialogButtonBox::accepted,
this, &QDialog::accept);
connect(m_widget->dlgButtonBox, &QDialogButtonBox::rejected,
this, &QDialog::reject);
auto boxLayout = new QVBoxLayout(this);
boxLayout->addWidget(m_widget);
} }
void TagOptionsDialog::accept() void TagOptionsDialog::accept()
...@@ -129,7 +133,7 @@ void TagOptionsDialog::accept() ...@@ -129,7 +133,7 @@ void TagOptionsDialog::accept()
m_options = m_widget->options(); m_options = m_widget->options();
saveConfig(); saveConfig();
KDialog::accept(); QDialog::accept();
} }
void TagOptionsDialog::loadConfig() void TagOptionsDialog::loadConfig()
......
...@@ -14,10 +14,11 @@ ...@@ -14,10 +14,11 @@
* this program. If not, see <http://www.gnu.org/licenses/>. * this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef FILERENAMEROPTIONS_H #ifndef JUK_FILERENAMEROPTIONS_H
#define FILERENAMEROPTIONS_H #define JUK_FILERENAMEROPTIONS_H
#include <QDialog>
#include <kdialog.h>
#include "ui_filerenameroptionsbase.h" #include "ui_filerenameroptionsbase.h"
#include "tagrenameroptions.h" #include "tagrenameroptions.h"
...@@ -31,7 +32,6 @@ class FileRenamerTagOptions : public QWidget, public Ui::FileRenamerTagOptionsBa ...@@ -31,7 +32,6 @@ class FileRenamerTagOptions : public QWidget, public Ui::FileRenamerTagOptionsBa
Q_OBJECT Q_OBJECT
public: public:
FileRenamerTagOptions(QWidget *parent, const TagRenamerOptions &options); FileRenamerTagOptions(QWidget *parent, const TagRenamerOptions &options);
virtual ~FileRenamerTagOptions() {}
const TagRenamerOptions &options() const { return m_options; } const TagRenamerOptions &options() const { return m_options; }
...@@ -49,7 +49,7 @@ private: ...@@ -49,7 +49,7 @@ private:
* *
* @author Michael Pyne <mpyne@kde.org> * @author Michael Pyne <mpyne@kde.org>
*/ */
class TagOptionsDialog : public KDialog class TagOptionsDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
...@@ -75,6 +75,6 @@ private: ...@@ -75,6 +75,6 @@ private:
unsigned m_categoryNumber; unsigned m_categoryNumber;
}; };
#endif /* FILERENAMEROPTIONS_H */ #endif /* JUK_FILERENAMEROPTIONS_H */
// vim: set et sw=4 tw=0 sta: // vim: set et sw=4 tw=0 sta:
...@@ -328,6 +328,13 @@ ...@@ -328,6 +328,13 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<widget class="QDialogButtonBox" name="dlgButtonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment