Commit 2beeaeda authored by Halla Rempt's avatar Halla Rempt
Browse files

Make the bundle creation dialog a KDialog with default button layout

parent 22b88445
......@@ -8,16 +8,22 @@
KoBundleCreationWidget::KoBundleCreationWidget(KoXmlResourceBundleMeta* newMeta, QWidget *parent)
: QDialog(parent)
: KDialog(parent)
, m_ui(new Ui::KoBundleCreationWidget)
{
m_ui->setupUi(this);
this->m_newMeta = newMeta;
this->m_kritaPath = QProcessEnvironment::systemEnvironment().value("KDEDIRS").section(':', 0, 0)
m_page = new QWidget();
m_ui->setupUi(m_page);
setMainWidget(m_page);
resize(m_page->sizeHint());
setButtons(Ok | Cancel);
setDefaultButton(Ok);
connect(this, SIGNAL(okClicked()), SLOT(createBundle()));
connect(this, SIGNAL(cancelClicked()), SLOT(reject()));
m_newMeta = newMeta;
m_kritaPath = QProcessEnvironment::systemEnvironment().value("KDEDIRS").section(':', 0, 0)
+ QString("/share/apps/krita/");
initializeUI();
}
KoBundleCreationWidget::~KoBundleCreationWidget()
......@@ -25,35 +31,6 @@ KoBundleCreationWidget::~KoBundleCreationWidget()
delete m_ui;
}
void KoBundleCreationWidget::initializeUI()
{
QString detailsStyleSheet = QString("QCheckBox { spacing: 5px; } QCheckBox::indicator { width: 13px; height: 13px; } ")
+ QString("QCheckBox::indicator:unchecked { image: url(") + m_kritaPath + QString("pics/arrow-down.png); } ")
+ QString("QCheckBox::indicator:checked { image: url(") + m_kritaPath + QString("pics/arrow-right.png); } ");
m_ui->detailsBox->setStyleSheet(detailsStyleSheet);
this->resize(450, 10);
m_ui->metaData->setVisible(false);
m_ui->detailsBox->setVisible(true);
connect(m_ui->detailsBox, SIGNAL(clicked()), this, SLOT(showHide()));
connect(m_ui->okButton, SIGNAL(clicked()), this, SLOT(createBundle()));
connect(m_ui->cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
}
void KoBundleCreationWidget::showHide()
{
m_ui->metaData->setVisible(!m_ui->metaData->isVisible());
if (!m_ui->metaData->isVisible()) {
this->adjustSize();
this->resize(450, this->sizeHint().height());
} else {
this->resize(450, 200);
}
}
//TODO Vérifier la présence de caractères invalides dans le nom du paquet (exemple : *"')
//Même s'ils semblent acceptés par le système
void KoBundleCreationWidget::createBundle()
......@@ -71,7 +48,8 @@ void KoBundleCreationWidget::createBundle()
emit status("Bundle already exists : choose another name...");
} else {
m_newMeta->setMeta(name, m_ui->editAuthor->text(), m_ui->editLicense->text(),
m_ui->editWebsite->text(), m_ui->editDescription->text());
m_ui->editWebsite->text(),
m_ui->editDescription->document()->toPlainText());
accept();
}
}
......
#ifndef KOBUNDLECREATIONWIDGET_H
#define KOBUNDLECREATIONWIDGET_H
#include <QDialog>
#include <kdialog.h>
class KoXmlResourceBundleMeta;
class KoResourceManagerControl;
......@@ -11,7 +11,7 @@ namespace Ui
class KoBundleCreationWidget;
}
class KoBundleCreationWidget : public QDialog
class KoBundleCreationWidget : public KDialog
{
Q_OBJECT
......@@ -19,16 +19,14 @@ public:
explicit KoBundleCreationWidget(KoXmlResourceBundleMeta* m_newMeta, QWidget *parent = 0);
~KoBundleCreationWidget();
void initializeUI();
signals:
void status(QString text, int timeout = 0);
private slots:
void createBundle();
void showHide();
private:
QWidget *m_page;
Ui::KoBundleCreationWidget *m_ui;
KoXmlResourceBundleMeta *m_newMeta;
QString m_kritaPath;
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KoBundleCreationWidget</class>
<widget class="QDialog" name="KoBundleCreationWidget">
<widget class="QWidget" name="KoBundleCreationWidget">
<property name="geometry">
<rect>
<x>0</x>
......@@ -22,177 +22,74 @@
<property name="windowOpacity">
<double>1.000000000000000</double>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="verticalSpacing">
<number>10</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="bundleName">
<property name="text">
<string>Bundle Name </string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="editBundleName"/>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="detailsBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Ubuntu</family>
<italic>false</italic>
</font>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Details</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QWidget" name="metaData" native="true">
<layout class="QFormLayout" name="formLayout_6">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="horizontalSpacing">
<number>12</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="author">
<property name="text">
<string>Author</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="website">
<property name="text">
<string>Website</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="license">
<property name="text">
<string>License</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="description">
<property name="text">
<string>Description</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="editDescription"/>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="editAuthor">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="editWebsite">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="editLicense">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="bundleName">
<property name="text">
<string>Bundle Name </string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="editBundleName"/>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
<item row="1" column="0">
<widget class="QLabel" name="author">
<property name="text">
<string>Author</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<item>
<widget class="QPushButton" name="okButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
</layout>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="editAuthor">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="website">
<property name="text">
<string>Website</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="editWebsite">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="license">
<property name="text">
<string>License</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="editLicense">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="description">
<property name="text">
<string>Description</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPlainTextEdit" name="editDescription"/>
</item>
</layout>
</widget>
......
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