aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pyne <[email protected]>2017-09-30 17:08:02 -0400
committerMichael Pyne <[email protected]>2017-09-30 17:08:02 -0400
commitb9bd44b939eb3d7227c69bb0b06d3ce3ce40a39b (patch)
treeedcfbd151fb9321ef5dd931c9186f8d5daaf6434
parent87cf04a1be5624004394a6c8afca611356be4e4a (diff)
Port the tag guesser code away from KDialog.
-rw-r--r--tagguesserconfigdlg.cpp25
-rw-r--r--tagguesserconfigdlg.h57
-rw-r--r--tagguesserconfigdlgwidget.ui7
3 files changed, 51 insertions, 38 deletions
diff --git a/tagguesserconfigdlg.cpp b/tagguesserconfigdlg.cpp
index 1dd4d74..d39d73b 100644
--- a/tagguesserconfigdlg.cpp
+++ b/tagguesserconfigdlg.cpp
@@ -17,34 +17,33 @@
#include "tagguesserconfigdlg.h"
#include "tagguesser.h"
-#include <QIcon>
#include <klocale.h>
#include <klineedit.h>
+#include <QIcon>
#include <QKeyEvent>
#include <QStringListModel>
+#include <QVBoxLayout>
#include <QPushButton>
+#include <QDialogButtonBox>
TagGuesserConfigDlg::TagGuesserConfigDlg(QWidget *parent, const char *name)
- : KDialog(parent)
+ : QDialog(parent)
+ , m_child(new TagGuesserConfigDlgWidget(this))
+ , m_tagSchemeModel(new QStringListModel(TagGuesser::schemeStrings(), m_child->lvSchemes))
{
- setObjectName( QLatin1String( name ) );
+ setObjectName(QLatin1String(name));
setModal(true);
- setCaption(i18n("Tag Guesser Configuration"));
- setButtons(Ok | Cancel);
- setDefaultButton(Ok);
- showButtonSeparator(true);
+ setWindowTitle(i18n("Tag Guesser Configuration"));
- m_child = new TagGuesserConfigDlgWidget(this);
- setMainWidget(m_child);
+ auto vboxLayout = new QVBoxLayout(this);
+ vboxLayout->addWidget(m_child);
m_child->bMoveUp->setIcon(QIcon::fromTheme( QLatin1String( "arrow-up" )));
m_child->bMoveDown->setIcon(QIcon::fromTheme( QLatin1String( "arrow-down" )));
- m_tagSchemeModel = new QStringListModel(m_child->lvSchemes);
m_child->lvSchemes->setModel(m_tagSchemeModel);
m_child->lvSchemes->setHeaderHidden(true);
- m_tagSchemeModel->setStringList(TagGuesser::schemeStrings());
connect(m_child->lvSchemes, SIGNAL(clicked(QModelIndex)), this, SLOT(slotCurrentChanged(QModelIndex)));
connect(m_child->bMoveUp, SIGNAL(clicked()), this, SLOT(slotMoveUpClicked()));
@@ -52,6 +51,8 @@ TagGuesserConfigDlg::TagGuesserConfigDlg(QWidget *parent, const char *name)
connect(m_child->bAdd, SIGNAL(clicked()), this, SLOT(slotAddClicked()));
connect(m_child->bModify, SIGNAL(clicked()), this, SLOT(slotModifyClicked()));
connect(m_child->bRemove, SIGNAL(clicked()), this, SLOT(slotRemoveClicked()));
+ connect(m_child->dlgButtonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
+ connect(m_child->dlgButtonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
resize( 400, 300 );
}
@@ -133,7 +134,7 @@ void TagGuesserConfigDlg::slotRemoveClicked()
void TagGuesserConfigDlg::accept()
{
TagGuesser::setSchemeStrings(m_tagSchemeModel->stringList());
- KDialog::accept();
+ QDialog::accept();
}
// vim: set et sw=4 tw=0 sta:
diff --git a/tagguesserconfigdlg.h b/tagguesserconfigdlg.h
index 93ebd16..37564a9 100644
--- a/tagguesserconfigdlg.h
+++ b/tagguesserconfigdlg.h
@@ -14,45 +14,50 @@
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef TAGGUESSERCONFIGDLG_H
-#define TAGGUESSERCONFIGDLG_H
+#ifndef JUK_TAGGUESSERCONFIGDLG_H
+#define JUK_TAGGUESSERCONFIGDLG_H
+
+#include <QDialog>
-#include <kdialog.h>
#include "ui_tagguesserconfigdlgwidget.h"
class QStringListModel;
-
class TagGuesserConfigDlgWidget : public QWidget, public Ui::TagGuesserConfigDlgWidget
{
+ Q_OBJECT
+
public:
- TagGuesserConfigDlgWidget( QWidget *parent ) : QWidget( parent ) {
- setupUi( this );
- }
+ TagGuesserConfigDlgWidget(QWidget *parent)
+ : QWidget(parent)
+ {
+ setupUi(this);
+ }
};
-class TagGuesserConfigDlg : public KDialog
+class TagGuesserConfigDlg : public QDialog
{
Q_OBJECT
- public:
- explicit TagGuesserConfigDlg(QWidget *parent, const char *name = 0);
-
- protected slots:
- virtual void accept();
-
- private slots:
- void slotCurrentChanged(QModelIndex item);
- void slotMoveUpClicked();
- void slotMoveDownClicked();
- void slotAddClicked();
- void slotModifyClicked();
- void slotRemoveClicked();
-
- private:
- TagGuesserConfigDlgWidget *m_child;
- QStringListModel *m_tagSchemeModel;
+
+public:
+ explicit TagGuesserConfigDlg(QWidget *parent, const char *name = nullptr);
+
+protected slots:
+ virtual void accept();
+
+private slots:
+ void slotCurrentChanged(QModelIndex item);
+ void slotMoveUpClicked();
+ void slotMoveDownClicked();
+ void slotAddClicked();
+ void slotModifyClicked();
+ void slotRemoveClicked();
+
+private:
+ TagGuesserConfigDlgWidget *m_child;
+ QStringListModel *m_tagSchemeModel;
};
-#endif // TAGGUESSERCONFIGDLG_H
+#endif // JUK_TAGGUESSERCONFIGDLG_H
// vim: set et sw=4 tw=0 sta:
diff --git a/tagguesserconfigdlgwidget.ui b/tagguesserconfigdlgwidget.ui
index 21c44a0..1c68417 100644
--- a/tagguesserconfigdlgwidget.ui
+++ b/tagguesserconfigdlgwidget.ui
@@ -129,6 +129,13 @@ Note that the order in which the schemes appear in the list is relevant, since t
</property>
</widget>
</item>
+ <item>
+ <widget class="QDialogButtonBox" name="dlgButtonBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<resources/>