X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Fcolorsettingspage.cpp;h=2eb20c027aa80b4d9c57690c8467c8250be0eae7;hp=2d5c3ba374a3bc23c5b9c5b5e7a51ffa7db02448;hb=ec2b99363141d3cad003b8533b5462a313ade3c1;hpb=f824db0e31b54969e0b7fa0b5405b1e9173d482c diff --git a/src/qtui/settingspages/colorsettingspage.cpp b/src/qtui/settingspages/colorsettingspage.cpp index 2d5c3ba3..2eb20c02 100644 --- a/src/qtui/settingspages/colorsettingspage.cpp +++ b/src/qtui/settingspages/colorsettingspage.cpp @@ -28,8 +28,6 @@ #include #include -// #define PHONDEV - ColorSettingsPage::ColorSettingsPage(QWidget *parent) : SettingsPage(tr("Appearance"), tr("Color settings"), parent), mapper(new QSignalMapper(this)) @@ -47,27 +45,12 @@ ColorSettingsPage::ColorSettingsPage(QWidget *parent) connect(mapper, SIGNAL(mapped(QWidget *)), this, SLOT(chooseColor(QWidget *))); //disable unused buttons: -#ifndef PHONDEV - ui.inactiveActivityUseBG->setEnabled(false); - ui.noActivityUseBG->setEnabled(false); - ui.highlightActivityUseBG->setEnabled(false); - ui.newMessageActivityUseBG->setEnabled(false); - ui.otherActivityUseBG->setEnabled(false); - - ui.nickFG->setEnabled(false); - ui.nickUseBG->setEnabled(false); - ui.hostmaskFG->setEnabled(false); - ui.hostmaskUseBG->setEnabled(false); - ui.channelnameFG->setEnabled(false); - ui.channelnameUseBG->setEnabled(false); - ui.modeFlagsFG->setEnabled(false); - ui.modeFlagsUseBG->setEnabled(false); - ui.urlFG->setEnabled(false); - ui.urlUseBG->setEnabled(false); - - ui.onlineStatusUseBG->setEnabled(false); - ui.awayStatusUseBG->setEnabled(false); -#endif + foreach(QWidget *widget, findChildren()) { + if(widget->property("NotInUse").toBool()) { + widget->setEnabled(false); + widget->hide(); + } + } } bool ColorSettingsPage::hasDefaults() const { @@ -110,7 +93,7 @@ void ColorSettingsPage::defaultBufferview() { ui.otherActivityUseBG->setChecked(false); } -void ColorSettingsPage::defaultServerActivity() { +void ColorSettingsPage::defaultServerActivity() { /* ui.errorMessageFG->setColor(QtUi::style()->format(UiStyle::ErrorMsg, Settings::Default).foreground().color()); ui.errorMessageBG->setColor(QColor("white")); ui.errorMessageBG->setEnabled(false); @@ -127,10 +110,10 @@ void ColorSettingsPage::defaultServerActivity() { ui.serverMessageBG->setColor(QColor("white")); ui.serverMessageBG->setEnabled(false); ui.serverMessageUseBG->setChecked(false); - ui.highlightColor->setColor(QColor("lightcoral")); + ui.highlightColor->setColor(QColor("lightcoral")); */ } -void ColorSettingsPage::defaultUserActivity() { +void ColorSettingsPage::defaultUserActivity() { /* ui.actionMessageFG->setColor(QtUi::style()->format(UiStyle::ActionMsg, Settings::Default).foreground().color()); ui.actionMessageBG->setColor(QColor("white")); ui.actionMessageBG->setEnabled(false); @@ -158,10 +141,10 @@ void ColorSettingsPage::defaultUserActivity() { ui.renameMessageFG->setColor(QtUi::style()->format(UiStyle::RenameMsg, Settings::Default).foreground().color()); ui.renameMessageBG->setColor(QColor("white")); ui.renameMessageBG->setEnabled(false); - ui.renameMessageUseBG->setChecked(false); + ui.renameMessageUseBG->setChecked(false); */ } -void ColorSettingsPage::defaultMessage() { +void ColorSettingsPage::defaultMessage() { /* ui.timestampFG->setColor(QtUi::style()->format(UiStyle::Timestamp, Settings::Default).foreground().color()); ui.timestampBG->setColor(QColor("white")); ui.timestampBG->setEnabled(false); @@ -170,7 +153,8 @@ void ColorSettingsPage::defaultMessage() { ui.senderBG->setColor(QColor("white")); ui.senderBG->setEnabled(false); ui.senderUseBG->setChecked(false); - ui.newMsgMarkerFG->setColor(Qt::red); + ui.senderAutoColor->setChecked(false); + ui.newMsgMarkerFG->setColor(Qt::red); */ /* ui.nickFG->setColor(QColor("black")); @@ -196,7 +180,7 @@ void ColorSettingsPage::defaultMessage() { */ } -void ColorSettingsPage::defaultMircColorCodes() { +void ColorSettingsPage::defaultMircColorCodes() { /* ui.color0->setColor(QtUi::style()->format(UiStyle::FgCol00, Settings::Default).foreground().color()); ui.color1->setColor(QtUi::style()->format(UiStyle::FgCol01, Settings::Default).foreground().color()); ui.color2->setColor(QtUi::style()->format(UiStyle::FgCol02, Settings::Default).foreground().color()); @@ -212,7 +196,7 @@ void ColorSettingsPage::defaultMircColorCodes() { ui.color12->setColor(QtUi::style()->format(UiStyle::FgCol12, Settings::Default).foreground().color()); ui.color13->setColor(QtUi::style()->format(UiStyle::FgCol13, Settings::Default).foreground().color()); ui.color14->setColor(QtUi::style()->format(UiStyle::FgCol14, Settings::Default).foreground().color()); - ui.color15->setColor(QtUi::style()->format(UiStyle::FgCol15, Settings::Default).foreground().color()); + ui.color15->setColor(QtUi::style()->format(UiStyle::FgCol15, Settings::Default).foreground().color()); */ } void ColorSettingsPage::defaultNickview() { @@ -262,7 +246,7 @@ void ColorSettingsPage::load() { ui.otherActivityBG->setColor(settings["OtherActivityBG"].value()); settings["OtherActivityUseBG"] = s.value("otherActivityUseBG"); ui.otherActivityUseBG->setChecked(settings["OtherActivityUseBG"].toBool()); - +/* ui.actionMessageFG->setColor(QtUi::style()->format(UiStyle::ActionMsg).foreground().color()); ui.errorMessageFG->setColor(QtUi::style()->format(UiStyle::ErrorMsg).foreground().color()); ui.joinMessageFG->setColor(QtUi::style()->format(UiStyle::JoinMsg).foreground().color()); @@ -286,7 +270,7 @@ void ColorSettingsPage::load() { ui.quitMessageBG->setColor(QtUi::style()->format(UiStyle::QuitMsg).background().color()); ui.renameMessageBG->setColor(QtUi::style()->format(UiStyle::RenameMsg).background().color()); ui.serverMessageBG->setColor(QtUi::style()->format(UiStyle::ServerMsg).background().color()); - +*/ // FIXME set to false if appropriate settings["ActionMessageUseBG"] = s.value("actionMessageUseBG", QVariant(false)); if(settings["ActionMessageUseBG"].toBool()) { @@ -343,11 +327,17 @@ void ColorSettingsPage::load() { ui.serverMessageUseBG->setChecked(true); ui.serverMessageBG->setEnabled(true); } - +/* ui.timestampFG->setColor(QtUi::style()->format(UiStyle::Timestamp).foreground().color()); ui.timestampBG->setColor(QtUi::style()->format(UiStyle::Timestamp).background().color()); ui.senderFG->setColor(QtUi::style()->format(UiStyle::Sender).foreground().color()); ui.senderBG->setColor(QtUi::style()->format(UiStyle::Sender).background().color()); + + settings["SenderAutoColor"] = s.value("SenderAutoColor", QVariant(false)); + ui.senderFG->setEnabled(!settings["SenderAutoColor"].toBool()); + + ui.senderAutoColor->setChecked(settings["SenderAutoColor"].toBool()); +*/ settings["NewMsgMarkerFG"] = s.value("newMsgMarkerFG", QColor(Qt::red)); ui.newMsgMarkerFG->setColor(settings["NewMsgMarkerFG"].value()); @@ -361,7 +351,7 @@ void ColorSettingsPage::load() { ui.senderUseBG->setChecked(true); ui.senderBG ->setEnabled(true); } - +/* ui.nickFG->setColor(QtUi::style()->format(UiStyle::Nick).foreground().color()); ui.nickBG->setColor(QtUi::style()->format(UiStyle::Nick).background().color()); ui.hostmaskFG->setColor(QtUi::style()->format(UiStyle::Hostmask).foreground().color()); @@ -372,9 +362,9 @@ void ColorSettingsPage::load() { ui.modeFlagsBG->setColor(QtUi::style()->format(UiStyle::ModeFlags).background().color()); ui.urlFG->setColor(QtUi::style()->format(UiStyle::Url).foreground().color()); ui.urlBG->setColor(QtUi::style()->format(UiStyle::Url).background().color()); - +*/ ui.highlightColor->setColor(QtUi::style()->highlightColor()); - +/* ui.color0->setColor(QtUi::style()->format(UiStyle::FgCol00).foreground().color()); ui.color1->setColor(QtUi::style()->format(UiStyle::FgCol01).foreground().color()); ui.color2->setColor(QtUi::style()->format(UiStyle::FgCol02).foreground().color()); @@ -391,7 +381,7 @@ void ColorSettingsPage::load() { ui.color13->setColor(QtUi::style()->format(UiStyle::FgCol13).foreground().color()); ui.color14->setColor(QtUi::style()->format(UiStyle::FgCol14).foreground().color()); ui.color15->setColor(QtUi::style()->format(UiStyle::FgCol15).foreground().color()); - +*/ settings["OnlineStatusFG"] = s.value("onlineStatusFG", QVariant(QColor(Qt::black))); ui.onlineStatusFG->setColor(settings["OnlineStatusFG"].value()); settings["OnlineStatusBG"] = s.value("onlineStatusBG", QVariant(QColor(Qt::white))); @@ -460,6 +450,8 @@ void ColorSettingsPage::save() { s.setValue("timestampUseBG", ui.timestampUseBG->isChecked()); saveColor(UiStyle::Sender, ui.senderFG->color(), ui.senderBG->color(), ui.senderUseBG->isChecked()); s.setValue("senderUseBG", ui.senderUseBG->isChecked()); + s.setValue("SenderAutoColor", ui.senderAutoColor->isChecked()); + //QtUi::style()->setSenderAutoColor(ui.senderAutoColor->isChecked()); s.setValue("newMsgMarkerFG", ui.newMsgMarkerFG->color()); /* @@ -503,20 +495,20 @@ void ColorSettingsPage::save() { setChangedState(false); } -void ColorSettingsPage::saveColor(UiStyle::FormatType formatType, const QColor &foreground, const QColor &background, bool enableBG) { +void ColorSettingsPage::saveColor(UiStyle::FormatType /*formatType*/, const QColor &/*foreground*/, const QColor &/*background*/, bool /*enableBG*/) { /* QTextCharFormat format = QtUi::style()->format(formatType); format.setForeground(QBrush(foreground)); if(enableBG) format.setBackground(QBrush(background)); else format.clearBackground(); - QtUi::style()->setFormat(formatType, format, Settings::Custom); + QtUi::style()->setFormat(formatType, format, Settings::Custom); */ } -void ColorSettingsPage::saveMircColor(int num, const QColor &col) { +void ColorSettingsPage::saveMircColor(int /*num*/, const QColor &/*col*/) { /* QTextCharFormat fgf, bgf; fgf.setForeground(QBrush(col)); QtUi::style()->setFormat((UiStyle::FormatType)(UiStyle::FgCol00 | num<<24), fgf, Settings::Custom); - bgf.setBackground(QBrush(col)); QtUi::style()->setFormat((UiStyle::FormatType)(UiStyle::BgCol00 | num<<28), bgf, Settings::Custom); + bgf.setBackground(QBrush(col)); QtUi::style()->setFormat((UiStyle::FormatType)(UiStyle::BgCol00 | num<<28), bgf, Settings::Custom); */ } void ColorSettingsPage::widgetHasChanged() { @@ -544,7 +536,7 @@ bool ColorSettingsPage::testHasChanged() { if(settings["OtherActivityFG"].value() != ui.otherActivityFG->color()) return true; if(settings["OtherActivityBG"].value() != ui.otherActivityBG->color()) return true; if(settings["OtherActivityUseBG"].toBool() != ui.otherActivityUseBG->isChecked()) return true; - +/* if(QtUi::style()->format(UiStyle::ErrorMsg).foreground().color() != ui.errorMessageFG->color()) return true; if(QtUi::style()->format(UiStyle::ErrorMsg).background().color() != ui.errorMessageBG->color()) return true; if(settings["ErrorMessageUseBG"].toBool() != ui.errorMessageUseBG->isChecked()) return true; @@ -581,15 +573,17 @@ bool ColorSettingsPage::testHasChanged() { if(QtUi::style()->format(UiStyle::RenameMsg).foreground().color() != ui.renameMessageFG->color()) return true; if(QtUi::style()->format(UiStyle::RenameMsg).background().color() != ui.renameMessageBG->color()) return true; if(settings["RenameMessageUseBG"].toBool() != ui.renameMessageUseBG->isChecked()) return true; - +*/ if(QtUi::style()->highlightColor() != ui.highlightColor->color()) return true; - +/* if(QtUi::style()->format(UiStyle::Timestamp).foreground().color() != ui.timestampFG->color()) return true; if(QtUi::style()->format(UiStyle::Timestamp).background().color() != ui.timestampBG->color()) return true; if(settings["TimestampUseBG"].toBool() != ui.timestampUseBG->isChecked()) return true; if(QtUi::style()->format(UiStyle::Sender).foreground().color() != ui.senderFG->color()) return true; if(QtUi::style()->format(UiStyle::Sender).background().color() != ui.senderBG->color()) return true; if(settings["SenderUseBG"].toBool() != ui.senderUseBG->isChecked()) return true; + if(settings["SenderAutoColor"].toBool() != ui.senderAutoColor->isChecked()) return true; +*/ if(settings["NewMsgMarkerFG"].value() != ui.newMsgMarkerFG->color()) return true; /* @@ -609,7 +603,7 @@ bool ColorSettingsPage::testHasChanged() { if(QtUi::style()->format(UiStyle::Url).background().color() != ui.urlBG->color()) return true; if(settings["urlUseBG"].toBool() != ui.urlUseBG->isChecked()) return true; */ - +/* if(QtUi::style()->format(UiStyle::FgCol00).foreground().color() != ui.color0->color()) return true; if(QtUi::style()->format(UiStyle::FgCol01).foreground().color() != ui.color1->color()) return true; if(QtUi::style()->format(UiStyle::FgCol02).foreground().color() != ui.color2->color()) return true; @@ -626,7 +620,7 @@ bool ColorSettingsPage::testHasChanged() { if(QtUi::style()->format(UiStyle::FgCol13).foreground().color() != ui.color13->color()) return true; if(QtUi::style()->format(UiStyle::FgCol14).foreground().color() != ui.color14->color()) return true; if(QtUi::style()->format(UiStyle::FgCol15).foreground().color() != ui.color15->color()) return true; - +*/ if(settings["OnlineStatusFG"].value() != ui.onlineStatusFG->color()) return true; if(settings["OnlineStatusBG"].value() != ui.onlineStatusBG->color()) return true; if(settings["OnlineStatusUseBG"].toBool() != ui.onlineStatusUseBG->isChecked()) return true;