4.7 backportable rules ui fixes

remove uncertain "extra role" match
fix shortcut editor s/s connection

REVIEW: 7001
This commit is contained in:
Thomas Lübking 2011-09-30 12:42:56 +02:00
parent 885e42142f
commit 9ec32d5942
8 changed files with 72 additions and 168 deletions

View file

@ -85,7 +85,6 @@ void DetectDialog::readWindow(WId w)
| NET::ToolbarMask | NET::MenuMask | NET::DialogMask | NET::OverrideMask | NET::TopMenuMask
| NET::UtilityMask | NET::SplashMask);
title = info.name();
extrarole = ""; // TODO
machine = info.clientMachine();
executeDialog();
}
@ -116,7 +115,6 @@ void DetectDialog::executeDialog()
else
widget->type_label->setText(i18n(types[ type ]));
widget->title_label->setText(title);
widget->extrarole_label->setText(extrarole);
widget->machine_label->setText(machine);
widget->adjustSize();
adjustSize();

View file

@ -124,29 +124,6 @@
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="textLabel11">
<property name="text">
<string>Extra 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="6" column="1" colspan="2">
<widget class="QLabel" name="extrarole_label">
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="textLabel13">
<property name="text">
<string>Machine:</string>
@ -159,7 +136,7 @@
</property>
</widget>
</item>
<item row="7" column="1" colspan="2">
<item row="6" column="1" colspan="2">
<widget class="QLabel" name="machine_label">
<property name="text">
<string/>
@ -169,7 +146,7 @@
</property>
</widget>
</item>
<item row="8" column="0" colspan="3">
<item row="7" column="0" colspan="3">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Match Strategy</string>
@ -221,7 +198,7 @@
</layout>
</widget>
</item>
<item row="9" column="1">
<item row="8" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>

View file

@ -79,7 +79,6 @@ static Rules* findRule(const QList< Rules* >& rules, Window wid, bool whole_app)
| NET::ToolbarMask | NET::MenuMask | NET::DialogMask | NET::OverrideMask | NET::TopMenuMask
| NET::UtilityMask | NET::SplashMask);
QString title = info.name();
// QCString extrarole = ""; // TODO
QByteArray machine = info.clientMachine().toLower();
Rules* best_match = NULL;
int match_quality = 0;
@ -145,7 +144,6 @@ static Rules* findRule(const QList< Rules* >& rules, Window wid, bool whole_app)
ret->titlematch = Rules::UnimportantMatch;
ret->clientmachine = machine; // set, but make unimportant
ret->clientmachinematch = Rules::UnimportantMatch;
ret->extrarolematch = Rules::UnimportantMatch;
ret->windowrolematch = Rules::UnimportantMatch;
if (wmclass_name == wmclass_class) {
ret->wmclasscomplete = false;
@ -168,8 +166,6 @@ static Rules* findRule(const QList< Rules* >& rules, Window wid, bool whole_app)
ret->titlematch = Rules::UnimportantMatch;
ret->clientmachine = machine; // set, but make unimportant
ret->clientmachinematch = Rules::UnimportantMatch;
// ret->extrarole = extra; TODO
ret->extrarolematch = Rules::UnimportantMatch;
if (!role.isEmpty()
&& role != "unknown" && role != "unnamed") { // Qt sets this if not specified
ret->windowrole = role;

View file

@ -117,8 +117,13 @@ RulesWidget::RulesWidget(QWidget* parent)
SETUP(blockcompositing, force);
connect (title_match, SIGNAL(currentIndexChanged(int)), SLOT(titleMatchChanged()));
connect (extra_match, SIGNAL(currentIndexChanged(int)), SLOT(extraMatchChanged()));
connect (machine_match, SIGNAL(currentIndexChanged(int)), SLOT(machineMatchChanged()));
connect (shortcut_edit, SIGNAL(clicked()), SLOT(shortcutEditClicked()));
edit_reg_wmclass->hide();
edit_reg_role->hide();
edit_reg_title->hide();
edit_reg_machine->hide();
int i;
for (i = 1;
@ -412,9 +417,6 @@ void RulesWidget::setRules(Rules* rules)
title->setText(rules->title);
title_match->setCurrentIndex(rules->titlematch);
titleMatchChanged();
extra->setText(rules->extrarole);
extra_match->setCurrentIndex(rules->extrarolematch);
extraMatchChanged();
machine->setText(rules->clientmachine);
machine_match->setCurrentIndex(rules->clientmachinematch);
machineMatchChanged();
@ -510,8 +512,6 @@ Rules* RulesWidget::rules() const
}
rules->title = title->text();
rules->titlematch = static_cast< Rules::StringMatch >(title_match->currentIndex());
rules->extrarole = extra->text().toUtf8();
rules->extrarolematch = static_cast< Rules::StringMatch >(extra_match->currentIndex());
rules->clientmachine = machine->text().toUtf8();
rules->clientmachinematch = static_cast< Rules::StringMatch >(machine_match->currentIndex());
LINEEDIT_SET_RULE(position, strToPosition);
@ -568,7 +568,6 @@ Rules* RulesWidget::rules() const
STRING_MATCH_COMBO(wmclass)
STRING_MATCH_COMBO(role)
STRING_MATCH_COMBO(title)
STRING_MATCH_COMBO(extra)
STRING_MATCH_COMBO(machine)
#undef STRING_MATCH_COMBO

View file

@ -50,7 +50,6 @@ protected slots:
void wmclassMatchChanged();
void roleMatchChanged();
void titleMatchChanged();
void extraMatchChanged();
void machineMatchChanged();
void shortcutEditClicked();
private slots:

View file

@ -226,59 +226,6 @@
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="textLabel6">
<property name="text">
<string>Extra role:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="buddy">
<cstring>extra</cstring>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="KComboBox" name="extra_match">
<item>
<property name="text">
<string>Unimportant</string>
</property>
</item>
<item>
<property name="text">
<string>Exact Match</string>
</property>
</item>
<item>
<property name="text">
<string>Substring Match</string>
</property>
</item>
<item>
<property name="text">
<string>Regular Expression</string>
</property>
</item>
</widget>
</item>
<item row="11" column="4">
<widget class="KPushButton" name="edit_reg_extra">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Edit</string>
</property>
<property name="shortcut">
<string/>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="textLabel7">
<property name="text">
<string>&amp;Machine (hostname):</string>
@ -294,7 +241,7 @@
</property>
</widget>
</item>
<item row="12" column="1">
<item row="11" column="1">
<widget class="KComboBox" name="machine_match">
<item>
<property name="text">
@ -318,7 +265,7 @@
</item>
</widget>
</item>
<item row="12" column="4">
<item row="11" column="4">
<widget class="KPushButton" name="edit_reg_machine">
<property name="enabled">
<bool>false</bool>
@ -331,7 +278,7 @@
</property>
</widget>
</item>
<item row="13" column="0" colspan="5">
<item row="12" column="0" colspan="5">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -344,11 +291,8 @@
</property>
</spacer>
</item>
<item row="12" column="2" colspan="2">
<widget class="KLineEdit" name="machine"/>
</item>
<item row="11" column="2" colspan="2">
<widget class="KLineEdit" name="extra"/>
<widget class="KLineEdit" name="machine"/>
</item>
<item row="10" column="2" colspan="2">
<widget class="KLineEdit" name="title"/>
@ -2048,20 +1992,6 @@ like your complete screen area.</string>
</property>
</widget>
</item>
<item row="6" column="1" rowspan="2" colspan="7">
<widget class="Line" name="line_10">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QCheckBox" name="enable_moveresizemode">
<property name="text">
<string>&amp;Moving/resizing</string>
</property>
</widget>
</item>
<item row="11" column="3">
<spacer name="verticalSpacer_9">
<property name="orientation">
@ -2353,45 +2283,6 @@ while it's active!</string>
</property>
</spacer>
</item>
<item row="8" column="5" colspan="3">
<widget class="KComboBox" name="moveresizemode">
<property name="enabled">
<bool>false</bool>
</property>
<item>
<property name="text">
<string>Opaque</string>
</property>
</item>
<item>
<property name="text">
<string>Transparent</string>
</property>
</item>
</widget>
</item>
<item row="8" column="2" colspan="3">
<widget class="KComboBox" name="rule_moveresizemode">
<property name="enabled">
<bool>false</bool>
</property>
<item>
<property name="text">
<string>Do Not Affect</string>
</property>
</item>
<item>
<property name="text">
<string>Force</string>
</property>
</item>
<item>
<property name="text">
<string>Force Temporarily</string>
</property>
</item>
</widget>
</item>
<item row="0" column="5" colspan="3">
<widget class="YesNoBox" name="noborder" native="true">
<property name="enabled">
@ -2511,6 +2402,59 @@ but this may sometimes fail or superact.
</property>
</widget>
</item>
<item row="6" column="1" rowspan="2" colspan="7">
<widget class="Line" name="line_10">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="8" column="2" colspan="3">
<widget class="KComboBox" name="rule_moveresizemode">
<property name="enabled">
<bool>false</bool>
</property>
<item>
<property name="text">
<string>Do Not Affect</string>
</property>
</item>
<item>
<property name="text">
<string>Force</string>
</property>
</item>
<item>
<property name="text">
<string>Force Temporarily</string>
</property>
</item>
</widget>
</item>
<item row="8" column="5" colspan="3">
<widget class="KComboBox" name="moveresizemode">
<property name="enabled">
<bool>false</bool>
</property>
<item>
<property name="text">
<string>Opaque</string>
</property>
</item>
<item>
<property name="text">
<string>Transparent</string>
</property>
</item>
</widget>
</item>
<item row="8" column="1">
<widget class="QCheckBox" name="enable_moveresizemode">
<property name="text">
<string>&amp;Moving/resizing</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
@ -2519,9 +2463,9 @@ but this may sometimes fail or superact.
</widget>
<customwidgets>
<customwidget>
<class>KPushButton</class>
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
<customwidget>
<class>KLineEdit</class>
@ -2529,9 +2473,9 @@ but this may sometimes fail or superact.
<header>klineedit.h</header>
</customwidget>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
<class>KPushButton</class>
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
</customwidget>
<customwidget>
<class>KRestrictedLine</class>
@ -2558,9 +2502,6 @@ but this may sometimes fail or superact.
<tabstop>title_match</tabstop>
<tabstop>title</tabstop>
<tabstop>edit_reg_title</tabstop>
<tabstop>extra_match</tabstop>
<tabstop>extra</tabstop>
<tabstop>edit_reg_extra</tabstop>
<tabstop>machine_match</tabstop>
<tabstop>machine</tabstop>
<tabstop>edit_reg_machine</tabstop>

View file

@ -41,7 +41,6 @@ Rules::Rules()
, wmclasscomplete(UnimportantMatch)
, windowrolematch(UnimportantMatch)
, titlematch(UnimportantMatch)
, extrarolematch(UnimportantMatch)
, clientmachinematch(UnimportantMatch)
, types(NET::AllTypesMask)
, placementrule(UnusedForceRule)
@ -137,7 +136,6 @@ void Rules::readFromCfg(const KConfigGroup& cfg)
wmclasscomplete = cfg.readEntry("wmclasscomplete" , false);
READ_MATCH_STRING(windowrole, .toLower().toLatin1());
READ_MATCH_STRING(title,);
READ_MATCH_STRING(extrarole, .toLower().toLatin1());
READ_MATCH_STRING(clientmachine, .toLower().toLatin1());
types = cfg.readEntry("types", uint(NET::AllTypesMask));
READ_FORCE_RULE2(placement, QString(), Placement::policyFromString, false);
@ -234,7 +232,6 @@ void Rules::write(KConfigGroup& cfg) const
cfg.writeEntry("wmclasscomplete", wmclasscomplete);
WRITE_MATCH_STRING(windowrole, (const char*), false);
WRITE_MATCH_STRING(title, , false);
WRITE_MATCH_STRING(extrarole, (const char*), false);
WRITE_MATCH_STRING(clientmachine, (const char*), false);
if (types != NET::AllTypesMask)
cfg.writeEntry("types", uint(types));
@ -423,7 +420,6 @@ bool Rules::match(const Client* c) const
return false;
if (!matchTitle(c->caption(false)))
return false;
// TODO extrarole
if (!matchClientMachine(c->wmClientMachine(false)))
return false;
return true;

View file

@ -195,8 +195,6 @@ private:
StringMatch windowrolematch;
QString title;
StringMatch titlematch;
QByteArray extrarole;
StringMatch extrarolematch;
QByteArray clientmachine;
StringMatch clientmachinematch;
unsigned long types; // types for matching