author | drw <drw> | 2002-12-30 00:52:51 (UTC) |
---|---|---|
committer | drw <drw> | 2002-12-30 00:52:51 (UTC) |
commit | c7bbdeed0daeda9af5115ffa0f1fb1026a338e2d (patch) (side-by-side diff) | |
tree | 641b0a344cc9e274c39df282c4478dd74644d813 /noncore/net/opieirc/ircsettings.cpp | |
parent | 9ec4adfb12bd5c92427a79c6b63a064a0033a67a (diff) | |
download | opie-c7bbdeed0daeda9af5115ffa0f1fb1026a338e2d.zip opie-c7bbdeed0daeda9af5115ffa0f1fb1026a338e2d.tar.gz opie-c7bbdeed0daeda9af5115ffa0f1fb1026a338e2d.tar.bz2 |
Use OTabWidget & OColorButtons in config dialog for consistency w/other apps (reduces executable size by ~4k as well).
Diffstat (limited to 'noncore/net/opieirc/ircsettings.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/opieirc/ircsettings.cpp | 71 |
1 files changed, 34 insertions, 37 deletions
diff --git a/noncore/net/opieirc/ircsettings.cpp b/noncore/net/opieirc/ircsettings.cpp index 78eaed3..b110a5b 100644 --- a/noncore/net/opieirc/ircsettings.cpp +++ b/noncore/net/opieirc/ircsettings.cpp @@ -1,3 +1,5 @@ +#include <opie/ocolorbutton.h> +#include <opie/otabwidget.h> #include <qlayout.h> #include <qvalidator.h> #include <qscrollview.h> @@ -11,90 +13,85 @@ IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) m_config = new Config("OpieIRC"); m_config->setGroup("OpieIRC"); QHBoxLayout *l = new QHBoxLayout(this, 2, 2); - QTabWidget *tw = new QTabWidget(this); + OTabWidget *tw = new OTabWidget(this); l->addWidget(tw); /* General Configuration */ - QWidget *widget = new QWidget(tw); - QGridLayout *layout = new QGridLayout(widget, 1, 2, 5, 0); - QLabel *label = new QLabel(tr("Lines displayed :"), widget); + QWidget *genwidget = new QWidget(tw); + QGridLayout *layout = new QGridLayout(genwidget, 1, 2, 5, 0); + QLabel *label = new QLabel(tr("Lines displayed :"), genwidget); layout->addWidget(label, 0, 0); - m_lines = new QLineEdit(m_config->readEntry("Lines", "100"), widget); + m_lines = new QLineEdit(m_config->readEntry("Lines", "100"), genwidget); QWhatsThis::add(m_lines, tr("Amount of lines to be displayed in chats before old lines get deleted - this is necessary to restrain memory consumption. Set to 0 if you don't need this")); QIntValidator *validator = new QIntValidator(this); validator->setTop(10000); validator->setBottom(0); m_lines->setValidator(validator); layout->addWidget(m_lines, 0, 1); - tw->addTab(widget, tr("General")); + tw->addTab(genwidget, "opieirc/settings", tr("General")); /* Color configuration */ - QScrollView *view = new QScrollView(tw); + QScrollView *view = new QScrollView(this); view->setResizePolicy(QScrollView::AutoOneFit); - widget = new QWidget(view->viewport()); + view->setFrameStyle( QFrame::NoFrame ); + QWidget *widget = new QWidget(view->viewport()); view->addChild(widget); layout = new QGridLayout(widget, 7, 2, 5, 0); label = new QLabel(tr("Background color :"), widget); layout->addWidget(label, 0, 0); - m_background = new IRCFramedColorLabel(QColor(m_config->readEntry("BackgroundColor", "#FFFFFF")), widget); + m_background = new OColorButton(widget, m_config->readEntry("BackgroundColor", "#FFFFFF")); QWhatsThis::add(m_background, tr("Background color to be used in chats")); layout->addWidget(m_background, 0, 1); label = new QLabel(tr("Normal text color :"), widget); layout->addWidget(label, 1, 0); - m_text = new IRCFramedColorLabel(m_config->readEntry("TextColor", "#000000"), widget); + m_text = new OColorButton(widget, m_config->readEntry("TextColor", "#000000")); QWhatsThis::add(m_text, tr("Text color to be used in chats")); layout->addWidget(m_text, 1, 1); label = new QLabel(tr("Error color :"), widget); layout->addWidget(label, 2, 0); - m_error = new IRCFramedColorLabel(m_config->readEntry("ErrorColor", "#FF0000"), widget); + m_error = new OColorButton(widget, m_config->readEntry("ErrorColor", "#FF0000")); QWhatsThis::add(m_error, tr("Text color to be used to display errors")); layout->addWidget(m_error, 2, 1); label = new QLabel(tr("Text written by yourself :"), widget); layout->addWidget(label, 3, 0); - m_self = new IRCFramedColorLabel(m_config->readEntry("SelfColor", "#CC0000"), widget); + m_self = new OColorButton(widget, m_config->readEntry("SelfColor", "#CC0000")); QWhatsThis::add(m_self, tr("Text color to be used to identify text written by yourself")); layout->addWidget(m_self, 3, 1); label = new QLabel(tr("Text written by others :"), widget); layout->addWidget(label, 4, 0); - m_other = new IRCFramedColorLabel(m_config->readEntry("OtherColor", "#0000BB"), widget); + m_other = new OColorButton(widget, m_config->readEntry("OtherColor", "#0000BB")); QWhatsThis::add(m_other, tr("Text color to be used to identify text written by others")); layout->addWidget(m_other, 4, 1); label = new QLabel(tr("Text written by the server :"), widget); layout->addWidget(label, 5, 0); - m_server = new IRCFramedColorLabel(m_config->readEntry("ServerColor", "#0000FF"), widget); + m_server = new OColorButton(widget, m_config->readEntry("ServerColor", "#0000FF")); QWhatsThis::add(m_server, tr("Text color to be used to identify text written by the server")); layout->addWidget(m_server, 5, 1); label = new QLabel(tr("Notifications :"), widget); layout->addWidget(label, 6, 0); - m_notification = new IRCFramedColorLabel(m_config->readEntry("NotificationColor", "#AAE300"), widget); + m_notification = new OColorButton(widget, m_config->readEntry("NotificationColor", "#AAE300")); QWhatsThis::add(m_notification, tr("Text color to be used to display notifications")); layout->addWidget(m_notification, 6, 1); - tw->addTab(view, tr("Colors")); + tw->addTab(view, "opieirc/colors", tr("Colors")); + tw->setCurrentTab( genwidget ); showMaximized(); } -QString IRCSettings::getColorString(QWidget *widget) { - QColor color = ((IRCFramedColorLabel *)widget)->color(); - QString temp; - temp.sprintf("#%02x%02x%02x", color.red(), color.green(), color.blue()); - return temp; -} - void IRCSettings::accept() { - IRCTab::m_backgroundColor = getColorString(m_background); - IRCTab::m_textColor = getColorString(m_text); - IRCTab::m_errorColor = getColorString(m_error); - IRCTab::m_selfColor = getColorString(m_self); - IRCTab::m_otherColor = getColorString(m_other); - IRCTab::m_serverColor = getColorString(m_server); - IRCTab::m_notificationColor = getColorString(m_notification); + IRCTab::m_backgroundColor = m_background->color().name(); + IRCTab::m_textColor = m_text->color().name(); + IRCTab::m_errorColor = m_error->color().name(); + IRCTab::m_selfColor = m_self->color().name(); + IRCTab::m_otherColor = m_other->color().name(); + IRCTab::m_serverColor = m_server->color().name(); + IRCTab::m_notificationColor = m_notification->color().name(); IRCTab::m_maxLines = m_lines->text().toInt(); - m_config->writeEntry("BackgroundColor", getColorString(m_background)); - m_config->writeEntry("TextColor", getColorString(m_text)); - m_config->writeEntry("ErrorColor", getColorString(m_error)); - m_config->writeEntry("SelfColor", getColorString(m_self)); - m_config->writeEntry("OtherColor", getColorString(m_other)); - m_config->writeEntry("ServerColor", getColorString(m_server)); - m_config->writeEntry("NotificationColor", getColorString(m_notification)); + m_config->writeEntry("BackgroundColor", IRCTab::m_backgroundColor); + m_config->writeEntry("TextColor", IRCTab::m_textColor); + m_config->writeEntry("ErrorColor", IRCTab::m_errorColor); + m_config->writeEntry("SelfColor", IRCTab::m_selfColor); + m_config->writeEntry("OtherColor", IRCTab::m_otherColor); + m_config->writeEntry("ServerColor", IRCTab::m_serverColor); + m_config->writeEntry("NotificationColor", IRCTab::m_notificationColor); m_config->writeEntry("Lines", m_lines->text()); QDialog::accept(); } |