Commit b9bd44b9 authored by Michael Pyne's avatar Michael Pyne

Port the tag guesser code away from KDialog.

parent 87cf04a1
......@@ -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:
......@@ -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:
......@@ -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/>
......
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