cmake: use KMessageWidget in build dir choose dialog instead custom code

parent ff03ebfc
Pipeline #14284 passed with stage
in 59 minutes and 53 seconds
......@@ -29,7 +29,6 @@
#include <interfaces/iruntime.h>
#include <interfaces/iruntimecontroller.h>
#include <KColorScheme>
#include <KLocalizedString>
#include <QDir>
......@@ -283,14 +282,8 @@ void CMakeBuildDirChooser::setExtraArguments(const QString& args)
void CMakeBuildDirChooser::setStatus(const QString& message, bool canApply)
{
KColorScheme scheme(QPalette::Normal);
KColorScheme::ForegroundRole role;
if (canApply) {
role = KColorScheme::PositiveText;
} else {
role = KColorScheme::NegativeText;
}
m_chooserUi->status->setText(QStringLiteral("<i><font color='%1'>%2</font></i>").arg(scheme.foreground(role).color().name(), message));
m_chooserUi->status->setMessageType(canApply ? KMessageWidget::Positive : KMessageWidget::Warning);
m_chooserUi->status->setText(message);
auto okButton = m_buttonBox->button(QDialogButtonBox::Ok);
okButton->setEnabled(canApply);
......
......@@ -65,7 +65,20 @@
</property>
</widget>
</item>
<item row="3" column="0">
<item row="3" column="1">
<widget class="KMessageWidget" name="status">
<property name="closeButtonVisible">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>&amp;Installation prefix:</string>
......@@ -78,7 +91,7 @@
</property>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="1">
<widget class="KUrlRequester" name="installPrefix">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
......@@ -100,7 +113,7 @@
</property>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Build &amp;type:</string>
......@@ -113,7 +126,7 @@
</property>
</widget>
</item>
<item row="4" column="1">
<item row="5" column="1">
<widget class="QComboBox" name="buildType">
<property name="editable">
<bool>true</bool>
......@@ -143,14 +156,14 @@
</item>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Extra arguments:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="6" column="1">
<widget class="KComboBox" name="extraArguments">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
......@@ -163,7 +176,7 @@
</property>
</widget>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>CMake &amp;executable:</string>
......@@ -176,7 +189,7 @@
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="KUrlRequester" name="cmakeExecutable">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
......@@ -186,16 +199,6 @@
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="QLabel" name="status">
<property name="text">
<string notr="true">Status Message...</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
......@@ -209,6 +212,11 @@
<extends>QWidget</extends>
<header>KUrlRequester</header>
</customwidget>
<customwidget>
<class>KMessageWidget</class>
<extends>QFrame</extends>
<header>KMessageWidget</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
......
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