Commit b9bd44b9 authored by Michael Pyne's avatar Michael Pyne

Port the tag guesser code away from KDialog.

parent 87cf04a1
...@@ -17,34 +17,33 @@ ...@@ -17,34 +17,33 @@
#include "tagguesserconfigdlg.h" #include "tagguesserconfigdlg.h"
#include "tagguesser.h" #include "tagguesser.h"
#include <QIcon>
#include <klocale.h> #include <klocale.h>
#include <klineedit.h> #include <klineedit.h>
#include <QIcon>
#include <QKeyEvent> #include <QKeyEvent>
#include <QStringListModel> #include <QStringListModel>
#include <QVBoxLayout>
#include <QPushButton> #include <QPushButton>
#include <QDialogButtonBox>
TagGuesserConfigDlg::TagGuesserConfigDlg(QWidget *parent, const char *name) 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); setModal(true);
setCaption(i18n("Tag Guesser Configuration")); setWindowTitle(i18n("Tag Guesser Configuration"));
setButtons(Ok | Cancel);
setDefaultButton(Ok);
showButtonSeparator(true);
m_child = new TagGuesserConfigDlgWidget(this); auto vboxLayout = new QVBoxLayout(this);
setMainWidget(m_child); vboxLayout->addWidget(m_child);
m_child->bMoveUp->setIcon(QIcon::fromTheme( QLatin1String( "arrow-up" ))); m_child->bMoveUp->setIcon(QIcon::fromTheme( QLatin1String( "arrow-up" )));
m_child->bMoveDown->setIcon(QIcon::fromTheme( QLatin1String( "arrow-down" ))); 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->setModel(m_tagSchemeModel);
m_child->lvSchemes->setHeaderHidden(true); m_child->lvSchemes->setHeaderHidden(true);
m_tagSchemeModel->setStringList(TagGuesser::schemeStrings());
connect(m_child->lvSchemes, SIGNAL(clicked(QModelIndex)), this, SLOT(slotCurrentChanged(QModelIndex))); connect(m_child->lvSchemes, SIGNAL(clicked(QModelIndex)), this, SLOT(slotCurrentChanged(QModelIndex)));
connect(m_child->bMoveUp, SIGNAL(clicked()), this, SLOT(slotMoveUpClicked())); connect(m_child->bMoveUp, SIGNAL(clicked()), this, SLOT(slotMoveUpClicked()));
...@@ -52,6 +51,8 @@ TagGuesserConfigDlg::TagGuesserConfigDlg(QWidget *parent, const char *name) ...@@ -52,6 +51,8 @@ TagGuesserConfigDlg::TagGuesserConfigDlg(QWidget *parent, const char *name)
connect(m_child->bAdd, SIGNAL(clicked()), this, SLOT(slotAddClicked())); connect(m_child->bAdd, SIGNAL(clicked()), this, SLOT(slotAddClicked()));
connect(m_child->bModify, SIGNAL(clicked()), this, SLOT(slotModifyClicked())); connect(m_child->bModify, SIGNAL(clicked()), this, SLOT(slotModifyClicked()));
connect(m_child->bRemove, SIGNAL(clicked()), this, SLOT(slotRemoveClicked())); 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 ); resize( 400, 300 );
} }
...@@ -133,7 +134,7 @@ void TagGuesserConfigDlg::slotRemoveClicked() ...@@ -133,7 +134,7 @@ void TagGuesserConfigDlg::slotRemoveClicked()
void TagGuesserConfigDlg::accept() void TagGuesserConfigDlg::accept()
{ {
TagGuesser::setSchemeStrings(m_tagSchemeModel->stringList()); TagGuesser::setSchemeStrings(m_tagSchemeModel->stringList());
KDialog::accept(); QDialog::accept();
} }
// vim: set et sw=4 tw=0 sta: // vim: set et sw=4 tw=0 sta:
...@@ -14,45 +14,50 @@ ...@@ -14,45 +14,50 @@
* this program. If not, see <http://www.gnu.org/licenses/>. * this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef TAGGUESSERCONFIGDLG_H #ifndef JUK_TAGGUESSERCONFIGDLG_H
#define TAGGUESSERCONFIGDLG_H #define JUK_TAGGUESSERCONFIGDLG_H
#include <QDialog>
#include <kdialog.h>
#include "ui_tagguesserconfigdlgwidget.h" #include "ui_tagguesserconfigdlgwidget.h"
class QStringListModel; class QStringListModel;
class TagGuesserConfigDlgWidget : public QWidget, public Ui::TagGuesserConfigDlgWidget class TagGuesserConfigDlgWidget : public QWidget, public Ui::TagGuesserConfigDlgWidget
{ {
Q_OBJECT
public: public:
TagGuesserConfigDlgWidget( QWidget *parent ) : QWidget( parent ) { TagGuesserConfigDlgWidget(QWidget *parent)
setupUi( this ); : QWidget(parent)
} {
setupUi(this);
}
}; };
class TagGuesserConfigDlg : public KDialog class TagGuesserConfigDlg : public QDialog
{ {
Q_OBJECT Q_OBJECT
public:
explicit TagGuesserConfigDlg(QWidget *parent, const char *name = 0); public:
explicit TagGuesserConfigDlg(QWidget *parent, const char *name = nullptr);
protected slots:
virtual void accept(); protected slots:
virtual void accept();
private slots:
void slotCurrentChanged(QModelIndex item); private slots:
void slotMoveUpClicked(); void slotCurrentChanged(QModelIndex item);
void slotMoveDownClicked(); void slotMoveUpClicked();
void slotAddClicked(); void slotMoveDownClicked();
void slotModifyClicked(); void slotAddClicked();
void slotRemoveClicked(); void slotModifyClicked();
void slotRemoveClicked();
private:
TagGuesserConfigDlgWidget *m_child; private:
QStringListModel *m_tagSchemeModel; TagGuesserConfigDlgWidget *m_child;
QStringListModel *m_tagSchemeModel;
}; };
#endif // TAGGUESSERCONFIGDLG_H #endif // JUK_TAGGUESSERCONFIGDLG_H
// vim: set et sw=4 tw=0 sta: // vim: set et sw=4 tw=0 sta:
...@@ -129,6 +129,13 @@ Note that the order in which the schemes appear in the list is relevant, since t ...@@ -129,6 +129,13 @@ Note that the order in which the schemes appear in the list is relevant, since t
</property> </property>
</widget> </widget>
</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