Browse Source

confirmshutdowndlg.ui cleanup

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

77
src/gui/confirmshutdowndlg.ui

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