feat: move policy state to separate widget

This commit is contained in:
august-alt 2021-07-29 13:49:10 +04:00
parent fc103f2579
commit d4b6e1f887
2 changed files with 112 additions and 72 deletions

View File

@ -85,7 +85,23 @@ void ContentWidget::onListItemClicked(const QModelIndex &index)
{
auto layout = ::gui::PresentationBuilder::build(*presentation);
ui->contentScrollArea->widget()->setLayout(layout);
ui->contentScrollArea->widget()->setLayout(layout);
}
auto state = item->data(Qt::UserRole + 7).value<unsigned int>();
switch (state) {
case 0:
ui->notConfiguredRadioButton->setChecked(true);
break;
case 1:
ui->enabledRadioButton->setChecked(true);
break;
case 2:
ui->disabledRadioButton->setChecked(true);
break;
case 3:
default:
break;
}
}
else
@ -107,6 +123,8 @@ void gpui::ContentWidget::setPolicyWidgetsVisible(bool visible)
ui->contentScrollArea->setVisible(visible);
ui->contentListView->setVisible(!visible);
ui->policyStateButtonBox->setVisible(visible);
ui->contentWidget->setVisible(visible);
}
}

View File

@ -28,9 +28,6 @@
<property name="text">
<string>Local Policies</string>
</property>
<property name="buddy">
<cstring>contentScrollArea</cstring>
</property>
</widget>
</item>
<item row="1" column="0">
@ -42,83 +39,21 @@
<widget class="QListView" name="contentListView"/>
</item>
<item>
<widget class="QScrollArea" name="contentScrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>236</width>
<height>452</height>
</rect>
</property>
</widget>
</widget>
</item>
<item>
<widget class="QWidget" name="rightContainer" native="true">
<widget class="QWidget" name="contentWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>215</width>
<height>442</height>
<width>225</width>
<height>0</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="4" column="0">
<widget class="QTextEdit" name="descriptionTextEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>4</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>215</width>
<height>0</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QTextEdit" name="supportedOnTextEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="helpLabel">
<property name="text">
<string>Help:</string>
</property>
<property name="buddy">
<cstring>descriptionTextEdit</cstring>
</property>
</widget>
</item>
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Policy State</string>
@ -151,6 +86,86 @@
</layout>
</widget>
</item>
<item>
<widget class="QScrollArea" name="contentScrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>220</width>
<height>318</height>
</rect>
</property>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="rightContainer" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>215</width>
<height>442</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="3" column="0">
<widget class="QLabel" name="helpLabel">
<property name="text">
<string>Help:</string>
</property>
<property name="buddy">
<cstring>descriptionTextEdit</cstring>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QTextEdit" name="supportedOnTextEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QTextEdit" name="descriptionTextEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>4</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>215</width>
<height>0</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="supportedOnLabel">
<property name="text">
@ -161,6 +176,13 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QDialogButtonBox" name="policyStateButtonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>