Browse Source

confirmshutdowndlg.ui cleanup

shutdownconfirm.cpp cleanup
adaptive-webui-19844
Chocobo1 9 years ago committed by sledgehammer999
parent
commit
5c5b007618
  1. 157
      src/gui/confirmshutdowndlg.ui
  2. 14
      src/gui/shutdownconfirm.cpp

157
src/gui/confirmshutdowndlg.ui

@ -6,105 +6,86 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>463</width> <width>407</width>
<height>128</height> <height>103</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
<property name="topMargin">
<number>15</number>
</property>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QGridLayout" name="gridLayout">
<property name="spacing"> <item row="0" column="0" rowspan="2">
<number>20</number> <widget class="QLabel" name="warningLabel">
</property> <property name="text">
<item> <string notr="true">warning icon</string>
<layout class="QVBoxLayout" name="verticalLayout"> </property>
<property name="topMargin"> <property name="alignment">
<number>6</number> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QLabel" name="shutdownText">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">shutdown message goes here</string>
</property> </property>
<item> <property name="wordWrap">
<widget class="QLabel" name="warningLabel"> <bool>true</bool>
<property name="sizePolicy"> </property>
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> </widget>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">warning icon goes here</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item> </item>
<item> <item row="1" column="2">
<layout class="QVBoxLayout" name="verticalLayout_2"> <widget class="QCheckBox" name="neverShowAgainCheckbox">
<property name="topMargin"> <property name="text">
<number>6</number> <string>Don't show again</string>
</property> </property>
<item> </widget>
<widget class="QLabel" name="shutdownText">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">shutdown message goes here</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="neverShowAgainCheckbox">
<property name="text">
<string>Don't show again</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item> </item>
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QDialogButtonBox" name="buttonBox"/> <spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>

14
src/gui/shutdownconfirm.cpp

@ -52,30 +52,30 @@ ShutdownConfirmDlg::ShutdownConfirmDlg(const ShutdownAction &action)
{ {
ui->setupUi(this); ui->setupUi(this);
QIcon warningIcon(style()->standardIcon(QStyle::SP_MessageBoxWarning, 0, this)); QIcon warningIcon(style()->standardIcon(QStyle::SP_MessageBoxWarning));
ui->warningLabel->setPixmap(warningIcon.pixmap(warningIcon.actualSize(QSize(32, 32)))); ui->warningLabel->setPixmap(warningIcon.pixmap(32));
updateText(); updateText();
// Never show again checkbox, Title, and button // Never show again checkbox, Title, and button
QPushButton *okButton = ui->buttonBox->button(QDialogButtonBox::Ok);
if (m_action == ShutdownAction::None) { if (m_action == ShutdownAction::None) {
setWindowTitle(tr("Exit confirmation")); setWindowTitle(tr("Exit confirmation"));
ui->buttonBox->addButton(new QPushButton(tr("Exit Now"), this), QDialogButtonBox::AcceptRole); okButton->setText(tr("E&xit Now"));
} }
else { else {
setWindowTitle(tr("Shutdown confirmation")); setWindowTitle(tr("Shutdown confirmation"));
ui->buttonBox->addButton(new QPushButton(tr("Shutdown Now"), this), QDialogButtonBox::AcceptRole); okButton->setText(tr("&Shutdown Now"));
ui->neverShowAgainCheckbox->setVisible(false); ui->neverShowAgainCheckbox->setVisible(false);
} }
// Cancel Button // Cancel Button
QPushButton *cancelButton = ui->buttonBox->addButton(QDialogButtonBox::Cancel); QPushButton *cancelButton = ui->buttonBox->button(QDialogButtonBox::Cancel);
cancelButton->setFocus();
cancelButton->setDefault(true); cancelButton->setDefault(true);
// Always on top // Always on top
setWindowFlags(windowFlags()|Qt::WindowStaysOnTopHint); setWindowFlags(windowFlags()|Qt::WindowStaysOnTopHint);
// Set 'Cancel' as default button.
m_timer.setInterval(1000); // 1sec m_timer.setInterval(1000); // 1sec
connect(&m_timer, SIGNAL(timeout()), this, SLOT(updateSeconds())); connect(&m_timer, SIGNAL(timeout()), this, SLOT(updateSeconds()));
// Move to center // Move to center
move(Utils::Misc::screenCenter(this)); move(Utils::Misc::screenCenter(this));
cancelButton->setFocus();
} }
void ShutdownConfirmDlg::showEvent(QShowEvent *event) void ShutdownConfirmDlg::showEvent(QShowEvent *event)

Loading…
Cancel
Save