aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipe Saraiva <[email protected]>2015-09-17 10:49:20 -0300
committerFilipe Saraiva <[email protected]>2015-09-17 10:49:20 -0300
commit0a4a7e6dc05d165c2ea7d72ba4e25b2200be60b5 (patch)
tree82c97e250fa268be0b4305cb61add478e381b47a
parentaef797e96ed7b000f00c0f5cbcbce23a6966bba3 (diff)
Port KDialog to QDialog
-rw-r--r--src/assistants/linearalgebra/creatematrix/creatematrixassistant.cpp3
-rw-r--r--src/assistants/linearalgebra/creatematrix/creatematrixdlg.cpp13
-rw-r--r--src/assistants/linearalgebra/creatematrix/creatematrixdlg.h4
-rw-r--r--src/assistants/linearalgebra/creatematrix/creatematrixdlg.ui27
-rw-r--r--src/assistants/runscript/runscriptassistant.cpp2
-rw-r--r--src/backendchoosedialog.cpp18
-rw-r--r--src/backendchoosedialog.h4
-rw-r--r--src/backendchooser.ui14
-rw-r--r--src/imagesettings.ui19
-rw-r--r--src/imagesettingsdialog.cpp14
-rw-r--r--src/imagesettingsdialog.h4
11 files changed, 79 insertions, 43 deletions
diff --git a/src/assistants/linearalgebra/creatematrix/creatematrixassistant.cpp b/src/assistants/linearalgebra/creatematrix/creatematrixassistant.cpp
index 0e6dbdc..4d36ea3 100644
--- a/src/assistants/linearalgebra/creatematrix/creatematrixassistant.cpp
+++ b/src/assistants/linearalgebra/creatematrix/creatematrixassistant.cpp
@@ -22,7 +22,8 @@
#include <QAction>
-#include <KDialog>
+#include <QDialog>
+#include <QPushButton>
#include <KActionCollection>
#include "cantor_macros.h"
#include "backend.h"
diff --git a/src/assistants/linearalgebra/creatematrix/creatematrixdlg.cpp b/src/assistants/linearalgebra/creatematrix/creatematrixdlg.cpp
index ca916b7..c3914f4 100644
--- a/src/assistants/linearalgebra/creatematrix/creatematrixdlg.cpp
+++ b/src/assistants/linearalgebra/creatematrix/creatematrixdlg.cpp
@@ -19,13 +19,22 @@
*/
#include "creatematrixdlg.h"
+#include <QPushButton>
-CreateMatrixDlg::CreateMatrixDlg(QWidget* parent) : KDialog(parent)
+CreateMatrixDlg::CreateMatrixDlg(QWidget* parent) : QDialog(parent)
{
m_base=new Ui::CreateMatrixAssistantBase;
QWidget* mainW=new QWidget(this);
m_base->setupUi(mainW);
- setMainWidget(mainW);
+
+ QVBoxLayout *layout = new QVBoxLayout;
+ setLayout(layout);
+ layout->addWidget(mainW);
+
+ m_base->buttonBox->button(QDialogButtonBox::Ok)->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogOkButton));
+ m_base->buttonBox->button(QDialogButtonBox::Cancel)->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton));
+ connect(m_base->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+ connect(m_base->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(m_base->rows, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &CreateMatrixDlg::changeNumRows);
connect(m_base->columns, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &CreateMatrixDlg::changeNumCols);
diff --git a/src/assistants/linearalgebra/creatematrix/creatematrixdlg.h b/src/assistants/linearalgebra/creatematrix/creatematrixdlg.h
index c03cd25..7b81536 100644
--- a/src/assistants/linearalgebra/creatematrix/creatematrixdlg.h
+++ b/src/assistants/linearalgebra/creatematrix/creatematrixdlg.h
@@ -21,10 +21,10 @@
#ifndef _CREATEMATRIXDLG_H
#define _CREATEMATRIXDLG_H
-#include <KDialog>
+#include <QDialog>
#include "ui_creatematrixdlg.h"
-class CreateMatrixDlg : public KDialog
+class CreateMatrixDlg : public QDialog
{
Q_OBJECT
public:
diff --git a/src/assistants/linearalgebra/creatematrix/creatematrixdlg.ui b/src/assistants/linearalgebra/creatematrix/creatematrixdlg.ui
index 3decfe2..6aa2316 100644
--- a/src/assistants/linearalgebra/creatematrix/creatematrixdlg.ui
+++ b/src/assistants/linearalgebra/creatematrix/creatematrixdlg.ui
@@ -11,17 +11,17 @@
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout">
+ <item row="0" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
- <widget class="QLabel" name="label">
+ <widget class="QLabel" name="label_2">
<property name="text">
- <string>Rows:</string>
+ <string>Columns:</string>
</property>
</widget>
</item>
<item>
- <widget class="QSpinBox" name="rows">
+ <widget class="QSpinBox" name="columns">
<property name="value">
<number>3</number>
</property>
@@ -29,17 +29,17 @@
</item>
</layout>
</item>
- <item row="0" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item row="0" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
<item>
- <widget class="QLabel" name="label_2">
+ <widget class="QLabel" name="label">
<property name="text">
- <string>Columns:</string>
+ <string>Rows:</string>
</property>
</widget>
</item>
<item>
- <widget class="QSpinBox" name="columns">
+ <widget class="QSpinBox" name="rows">
<property name="value">
<number>3</number>
</property>
@@ -63,6 +63,13 @@
<column/>
</widget>
</item>
+ <item row="2" column="0">
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<resources/>
diff --git a/src/assistants/runscript/runscriptassistant.cpp b/src/assistants/runscript/runscriptassistant.cpp
index cbbb1a7..a550120 100644
--- a/src/assistants/runscript/runscriptassistant.cpp
+++ b/src/assistants/runscript/runscriptassistant.cpp
@@ -23,7 +23,7 @@
#include <QAction>
#include <QIcon>
-#include <KDialog>
+#include <QDialog>
#include <KActionCollection>
#include <QFileDialog>
#include <KLocalizedString>
diff --git a/src/backendchoosedialog.cpp b/src/backendchoosedialog.cpp
index 35caaad..67fe935 100644
--- a/src/backendchoosedialog.cpp
+++ b/src/backendchoosedialog.cpp
@@ -22,6 +22,7 @@
#include <KLocalizedString>
#include <QIcon>
+#include <QPushButton>
#include <KIconLoader>
#include "lib/backend.h"
@@ -31,15 +32,24 @@ const char* BackendChooseDialog::descriptionTemplate = I18N_NOOP("<h1>%1</h1>" \
"<div>%2</div><br/>" \
"<div>See <a href=\"%3\">%3</a> for more information</div>");
-BackendChooseDialog::BackendChooseDialog(QWidget* parent) : KDialog(parent)
+BackendChooseDialog::BackendChooseDialog(QWidget* parent) : QDialog(parent)
{
QWidget* w=new QWidget(this);
m_ui.setupUi(w);
+
+ QGridLayout *layout = new QGridLayout;
+ setLayout(layout);
+ layout->addWidget(w);
+
m_ui.backendList->setIconSize(QSize(KIconLoader::SizeMedium, KIconLoader::SizeMedium));
m_ui.backendList->setSortingEnabled(true);
connect(m_ui.backendList, &QListWidget::currentItemChanged, this, &BackendChooseDialog::updateDescription);
connect(m_ui.backendList, &QListWidget::itemDoubleClicked, this, &BackendChooseDialog::accept);
+ m_ui.buttonBox->button(QDialogButtonBox::Ok);
+ m_ui.buttonBox->button(QDialogButtonBox::Ok)->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogOkButton));
+ m_ui.buttonBox->button(QDialogButtonBox::Cancel)->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton));
+
foreach(Cantor::Backend* backend, Cantor::Backend::availableBackends())
{
if(!backend->isEnabled()) //don't show disabled backends
@@ -56,7 +66,9 @@ BackendChooseDialog::BackendChooseDialog(QWidget* parent) : KDialog(parent)
m_ui.backendList->setCurrentItem(item);
}
- setMainWidget(w);
+ connect(m_ui.buttonBox, &QDialogButtonBox::accepted, this, &BackendChooseDialog::accept);
+ connect(m_ui.buttonBox, &QDialogButtonBox::rejected, this, &BackendChooseDialog::close);
+
connect(this, &BackendChooseDialog::accepted, this, &BackendChooseDialog::onAccept);
}
@@ -84,5 +96,3 @@ QString BackendChooseDialog::backendName()
{
return m_backend;
}
-
-
diff --git a/src/backendchoosedialog.h b/src/backendchoosedialog.h
index 1aabf1d..c98d942 100644
--- a/src/backendchoosedialog.h
+++ b/src/backendchoosedialog.h
@@ -21,11 +21,11 @@
#ifndef _BACKENDCHOOSEDIALOG_H
#define _BACKENDCHOOSEDIALOG_H
-#include <KDialog>
+#include <QDialog>
#include <ui_backendchooser.h>
-class BackendChooseDialog : public KDialog
+class BackendChooseDialog : public QDialog
{
Q_OBJECT
public:
diff --git a/src/backendchooser.ui b/src/backendchooser.ui
index fed2415..5da909d 100644
--- a/src/backendchooser.ui
+++ b/src/backendchooser.ui
@@ -60,15 +60,15 @@
</property>
</widget>
</item>
+ <item row="3" column="1">
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
- <customwidgets>
- <customwidget>
- <class>QTextBrowser</class>
- <extends>QTextBrowser</extends>
- <header>ktextbrowser.h</header>
- </customwidget>
- </customwidgets>
<resources/>
<connections/>
</ui>
diff --git a/src/imagesettings.ui b/src/imagesettings.ui
index 58c6e9b..d7e5c4d 100644
--- a/src/imagesettings.ui
+++ b/src/imagesettings.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>649</width>
- <height>301</height>
+ <height>343</height>
</rect>
</property>
<property name="windowTitle">
@@ -111,10 +111,22 @@
</layout>
</widget>
</item>
+ <item row="3" column="0">
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<customwidgets>
<customwidget>
+ <class>KComboBox</class>
+ <extends>QComboBox</extends>
+ <header>kcombobox.h</header>
+ </customwidget>
+ <customwidget>
<class>KImageFilePreview</class>
<extends>QWidget</extends>
<header>kimagefilepreview.h</header>
@@ -124,11 +136,6 @@
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
- <customwidget>
- <class>KComboBox</class>
- <extends>QComboBox</extends>
- <header>kcombobox.h</header>
- </customwidget>
</customwidgets>
<tabstops>
<tabstop>pathEdit</tabstop>
diff --git a/src/imagesettingsdialog.cpp b/src/imagesettingsdialog.cpp
index 42a91e4..9790cc7 100644
--- a/src/imagesettingsdialog.cpp
+++ b/src/imagesettingsdialog.cpp
@@ -27,12 +27,14 @@
#include "qimagereader.h"
#include "qfiledialog.h"
-ImageSettingsDialog::ImageSettingsDialog(QWidget* parent) : KDialog(parent)
+ImageSettingsDialog::ImageSettingsDialog(QWidget* parent) : QDialog(parent)
{
QWidget *w = new QWidget(this);
m_ui.setupUi(w);
- setMainWidget(w);
- setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Apply );
+
+ m_ui.buttonBox->button(QDialogButtonBox::Ok)->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogOkButton));
+ m_ui.buttonBox->button(QDialogButtonBox::Apply)->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogApplyButton));
+ m_ui.buttonBox->button(QDialogButtonBox::Cancel)->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton));
m_unitNames << i18n("(auto)") << i18n("px") << i18n("%");
@@ -55,9 +57,9 @@ ImageSettingsDialog::ImageSettingsDialog(QWidget* parent) : KDialog(parent)
m_ui.printWidthInput->setSingleStep(1);
m_ui.printHeightInput->setSingleStep(1);
- connect(this, &ImageSettingsDialog::okClicked, this, &ImageSettingsDialog::sendChangesAndClose);
- connect(this, &ImageSettingsDialog::applyClicked, this, &ImageSettingsDialog::sendChanges);
- connect(this, &ImageSettingsDialog::cancelClicked, this, &ImageSettingsDialog::close);
+ connect(m_ui.buttonBox, &QDialogButtonBox::accepted, this, &ImageSettingsDialog::sendChangesAndClose);
+ connect(m_ui.buttonBox->button(QDialogButtonBox::Apply), &QPushButton::clicked, this, &ImageSettingsDialog::sendChanges);
+ connect(m_ui.buttonBox, &QDialogButtonBox::rejected, this, &ImageSettingsDialog::close);
connect(m_ui.openDialogButton, &QPushButton::clicked, this, &ImageSettingsDialog::openDialog);
//connect(m_fileDialog, SIGNAL(accepted()), this, SLOT(updatePath()));
diff --git a/src/imagesettingsdialog.h b/src/imagesettingsdialog.h
index 6bd64ca..8de4600 100644
--- a/src/imagesettingsdialog.h
+++ b/src/imagesettingsdialog.h
@@ -21,7 +21,7 @@
#ifndef IMAGESETTINGSDIALOG_H
#define IMAGESETTINGSDIALOG_H
-#include <KDialog>
+#include <QDialog>
#include <ui_imagesettings.h>
@@ -34,7 +34,7 @@ struct ImageSize
int heightUnit;
};
-class ImageSettingsDialog : public KDialog
+class ImageSettingsDialog : public QDialog
{
Q_OBJECT
public: