summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Maudsley <richard.maudsley@isode.com>2014-07-23 15:07:47 (GMT)
committerSwift Review <review@swift.im>2014-10-01 10:42:52 (GMT)
commita24d8c0e93d70312fc90d5fdf6214ade9a475e92 (patch)
tree8de1ed6624b5c2b12de890af7836b3e0a0dd2331 /Swift/QtUI
parent494ee542b0b7cb9a2eb9997865b9ba89a16715bc (diff)
downloadswift-contrib-a24d8c0e93d70312fc90d5fdf6214ade9a475e92.zip
swift-contrib-a24d8c0e93d70312fc90d5fdf6214ade9a475e92.tar.bz2
Render selected highlight item rule in italic
Test-Information: Verify that this is just a cosmetic change and does not effect operation of highlight dialog. Change-Id: Ie0fd14bb5d90a3cfae1797bbe3daa7e724987584
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtHighlightEditor.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Swift/QtUI/QtHighlightEditor.cpp b/Swift/QtUI/QtHighlightEditor.cpp
index a5f49c2..5aa4560 100644
--- a/Swift/QtUI/QtHighlightEditor.cpp
+++ b/Swift/QtUI/QtHighlightEditor.cpp
@@ -140,125 +140,134 @@ void QtHighlightEditor::setContactSuggestions(const std::vector<Contact::ref>& s
}
void QtHighlightEditor::colorOtherSelect()
{
ui_.foregroundColor->setEnabled(false);
ui_.backgroundColor->setEnabled(false);
}
void QtHighlightEditor::colorCustomSelect()
{
ui_.foregroundColor->setEnabled(true);
ui_.backgroundColor->setEnabled(true);
}
void QtHighlightEditor::soundOtherSelect()
{
ui_.soundFile->setEnabled(false);
ui_.soundFileButton->setEnabled(false);
}
void QtHighlightEditor::soundCustomSelect()
{
ui_.soundFile->setEnabled(true);
ui_.soundFileButton->setEnabled(true);
}
void QtHighlightEditor::onNewButtonClicked()
{
int row = getSelectedRow() + 1;
populateList();
HighlightRule newRule;
newRule.setMatchMUC(true);
highlightManager_->insertRule(row, newRule);
QListWidgetItem *item = new QListWidgetItem();
item->setText(P2QSTRING(formatShortDescription(newRule)));
+ QFont font;
+ font.setItalic(true);
+ item->setFont(font);
ui_.listWidget->insertItem(row, item);
selectRow(row);
}
void QtHighlightEditor::onDeleteButtonClicked()
{
int selectedRow = getSelectedRow();
assert(selectedRow>=0 && selectedRow<ui_.listWidget->count());
delete ui_.listWidget->takeItem(selectedRow);
highlightManager_->removeRule(selectedRow);
if (!ui_.listWidget->count()) {
disableDialog();
ui_.deleteButton->setEnabled(false);
} else {
if (selectedRow == ui_.listWidget->count()) {
selectRow(ui_.listWidget->count() - 1);
} else {
selectRow(selectedRow);
}
}
}
void QtHighlightEditor::onUpButtonClicked() {
const size_t moveFrom = ui_.listWidget->currentRow();
const size_t moveTo = moveFrom - 1;
highlightManager_->swapRules(moveFrom, moveTo);
populateList();
selectRow(moveTo);
}
void QtHighlightEditor::onDownButtonClicked() {
const size_t moveFrom = ui_.listWidget->currentRow();
const size_t moveTo = moveFrom + 1;
highlightManager_->swapRules(moveFrom, moveTo);
populateList();
selectRow(moveTo);
}
void QtHighlightEditor::onCurrentRowChanged(int currentRow)
{
ui_.deleteButton->setEnabled(currentRow != -1);
ui_.moveUpButton->setEnabled(currentRow != -1 && currentRow != 0);
ui_.moveDownButton->setEnabled(currentRow != -1 && currentRow != (ui_.listWidget->count()-1));
if (previousRow_ != -1) {
if (ui_.listWidget->count() > previousRow_) {
+ QFont font;
+ font.setItalic(false);
+ ui_.listWidget->item(previousRow_)->setFont(font);
highlightManager_->setRule(previousRow_, ruleFromDialog());
}
}
if (currentRow != -1) {
HighlightRule rule = highlightManager_->getRule(currentRow);
ruleToDialog(rule);
if (ui_.listWidget->currentItem()) {
+ QFont font;
+ font.setItalic(true);
+ ui_.listWidget->currentItem()->setFont(font);
ui_.listWidget->currentItem()->setText(P2QSTRING(formatShortDescription(rule)));
}
}
/* grey the dialog if we have nothing selected */
if (currentRow == -1) {
disableDialog();
}
previousRow_ = currentRow;
}
void QtHighlightEditor::onApplyButtonClick()
{
selectRow(getSelectedRow()); /* force save */
highlightManager_->storeSettings();
}
void QtHighlightEditor::onCancelButtonClick()
{
close();
}
void QtHighlightEditor::onOkButtonClick()
{
onApplyButtonClick();
close();
}
void QtHighlightEditor::setChildWidgetStates()
{
/* disable appropriate radio button child widgets */
if (ui_.chatRadio->isChecked()) {
if (ui_.nickIsKeyword->isChecked()) {