demystify detection dialog for window rules

REVIEW: 103095
This commit is contained in:
Thomas Lübking 2011-11-09 21:23:14 +01:00
parent bdc3cc5564
commit b0e4bcb984
2 changed files with 177 additions and 176 deletions

View file

@ -105,11 +105,7 @@ void DetectDialog::executeDialog()
};
widget->class_label->setText(wmclass_class + " (" + wmclass_name + ' ' + wmclass_class + ')');
widget->role_label->setText(role);
widget->use_role->setEnabled(!role.isEmpty());
if (widget->use_role->isEnabled())
widget->use_role->setChecked(true);
else
widget->use_whole_class->setChecked(true);
widget->match_role->setEnabled(!role.isEmpty());
if (type == NET::Unknown)
widget->type_label->setText(i18n("Unknown - will be treated as Normal Window"));
else
@ -125,19 +121,19 @@ void DetectDialog::executeDialog()
QByteArray DetectDialog::selectedClass() const
{
if (widget->use_class->isChecked() || widget->use_role->isChecked())
return wmclass_class;
return wmclass_name + ' ' + wmclass_class;
if (widget->match_whole_class->isChecked())
return wmclass_name + ' ' + wmclass_class;
return wmclass_class;
}
bool DetectDialog::selectedWholeClass() const
{
return widget->use_whole_class->isChecked();
return widget->match_whole_class->isChecked();
}
QByteArray DetectDialog::selectedRole() const
{
if (widget->use_role->isChecked())
if (widget->match_role->isChecked())
return role;
return "";
}
@ -154,7 +150,7 @@ Rules::StringMatch DetectDialog::titleMatch() const
bool DetectDialog::selectedWholeApp() const
{
return widget->use_class->isChecked();
return !widget->match_type->isChecked();
}
NET::WindowType DetectDialog::selectedType() const

View file

@ -6,199 +6,204 @@
<rect>
<x>0</x>
<y>0</y>
<width>428</width>
<height>318</height>
<width>450</width>
<height>300</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="textLabel9">
<property name="text">
<string>Information About Selected Window</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="Line" name="line1">
<property name="frameShape">
<enum>QFrame::HLine</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="textLabel1">
<property name="text">
<string>Class:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLabel" name="class_label">
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="textLabel3">
<property name="text">
<string>Role:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QLabel" name="role_label">
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="textLabel4">
<property name="text">
<string>Type:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QLabel" name="type_label">
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="textLabel8">
<property name="text">
<string>Title:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<widget class="QLabel" name="title_label">
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="textLabel13">
<property name="text">
<string>Machine:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="6" column="1" colspan="2">
<widget class="QLabel" name="machine_label">
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="7" column="0" colspan="3">
<widget class="QGroupBox" name="groupBox">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Match Strategy</string>
<string>Information About Selected Window</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="use_class">
<property name="whatsThis">
<string>For selecting all windows belonging to a specific application, selecting only window class should usually work.</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="textLabel1">
<property name="text">
<string>Use window &amp;class (whole application)</string>
<string>Class:</string>
</property>
<property name="checked">
<bool>true</bool>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="use_role">
<property name="whatsThis">
<string>For selecting a specific window in an application, both window class and window role should be selected. Window class will determine the application, and window role the specific window in the application; many applications do not provide useful window roles though.</string>
<item row="0" column="1">
<widget class="QLabel" name="class_label">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Use window class and window &amp;role (specific window)</string>
<string/>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="use_whole_class">
<property name="whatsThis">
<string>With some (non-KDE) applications whole window class can be sufficient for selecting a specific window in an application, as they set whole window class to contain both application and window role.</string>
</property>
<item row="1" column="0">
<widget class="QLabel" name="textLabel3">
<property name="text">
<string>Use &amp;whole window class (specific window)</string>
<string>Role:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="match_title">
<item row="1" column="1">
<widget class="QLabel" name="role_label">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Match also window &amp;title</string>
<string/>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="textLabel4">
<property name="text">
<string>Type:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="type_label">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="textLabel8">
<property name="text">
<string>Title:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="title_label">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="textLabel13">
<property name="text">
<string>Machine:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="machine_label">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="8" column="1">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Match by primary class name and</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="match_whole_class">
<property name="text">
<string>Secondary class name (resulting in term in brackets)</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="match_role">
<property name="text">
<string>Window role (can be used to select windows by function)</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="match_type">
<property name="text">
<string>Window type (eg. all dialogs, but not the main windows)</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="match_title">
<property name="text">
<string>Window title (very specific, can fail due to content changes or translation)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>