diff options
Diffstat (limited to 'ksirc/KSPrefs')
32 files changed, 6584 insertions, 0 deletions
diff --git a/ksirc/KSPrefs/Makefile.am b/ksirc/KSPrefs/Makefile.am new file mode 100644 index 00000000..64d38261 --- /dev/null +++ b/ksirc/KSPrefs/Makefile.am @@ -0,0 +1,50 @@ + +INCLUDES= -I$(srcdir)/.. $(all_includes) + +noinst_LTLIBRARIES = libksprefs.la + +libksprefs_la_SOURCES = \ + ksprefs.cpp \ + page_colorsbase.ui\ + page_generalbase.ui\ + page_rmbmenubase.ui \ + page_servchanbase.ui \ + page_startupbase.ui \ + page_colors.cpp \ + page_general.cpp \ + page_rmbmenu.cpp \ + page_servchan.cpp \ + page_startup.cpp \ + page_font.cpp \ + page_autoconnectbase.ui \ + page_autoconnect.cpp \ + page_irccolorsbase.ui\ + page_irccolors.cpp \ + page_looknfeelbase.ui \ + page_looknfeel.cpp \ + page_shortcutsbase.ui \ + page_shortcuts.cpp + +METASOURCES = AUTO + +noinst_HEADERS = ksprefs.h \ + page_colorsbase.h \ + page_generalbase.h \ + page_rmbmenubase.h \ + page_servchanbase.h \ + page_startupbase.h \ + page_colors.h \ + page_general.h \ + page_rmbmenu.h \ + page_servchan.h \ + page_startup.h \ + page_font.h \ + page_autoconnectbase.h \ + page_autoconnect.h \ + page_irccolors.h \ + page_irccolorsbase.h \ + page_looknfeel.h \ + page_looknfeelbase.h \ + page_shortcutsbase.h \ + page_shortcuts.h + diff --git a/ksirc/KSPrefs/ksprefs.cpp b/ksirc/KSPrefs/ksprefs.cpp new file mode 100644 index 00000000..2bf97e84 --- /dev/null +++ b/ksirc/KSPrefs/ksprefs.cpp @@ -0,0 +1,244 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <qlayout.h> + +#include <klocale.h> +#include <kiconloader.h> + +#include <kdebug.h> + +#include "ksprefs.moc" +#include "page_general.h" +#include "page_colors.h" +#include "page_startup.h" +#include "page_rmbmenu.h" +#include "page_servchan.h" +#include "page_font.h" +#include "page_autoconnect.h" +#include "page_irccolors.h" +#include "page_looknfeel.h" +#include "page_shortcuts.h" + +KSPrefs::KSPrefs(QWidget * parent, const char * name): + KDialogBase(KDialogBase::IconList, i18n("Configure KSirc"), + KDialogBase::Help | KDialogBase::Ok | KDialogBase::Apply | KDialogBase::Cancel | KDialogBase::Default, + KDialogBase::Ok, parent, name) +{ + setWFlags( getWFlags() | WDestructiveClose ); + QFrame *itemLooknFeel= addPage( i18n( "Look and Feel" ), i18n( "Controls how kSirc looks" ), BarIcon( "ksirc", KIcon::SizeMedium ) ); + QFrame *itemGeneral = addPage( i18n( "General" ), i18n( "General KSirc Settings" ), BarIcon( "ksirc", KIcon::SizeMedium ) ); + QFrame *itemStartup = addPage( i18n( "Startup" ), i18n( "KSirc Startup Settings" ), BarIcon( "gear", KIcon::SizeMedium ) ); + QFrame *itemColors = addPage( i18n( "Colors" ), i18n( "KSirc Color Settings" ), BarIcon( "colors", KIcon::SizeMedium ) ); + QFrame *itemIRCColors = addPage( i18n( "IRC Colors" ), i18n( "KSirc IRC Color Settings" ), BarIcon( "colors", KIcon::SizeMedium ) ); + + QFrame *itemRMBMenu = addPage( i18n( "User Menu" ), i18n( "User Menu Configuration" ), BarIcon( "", KIcon::SizeMedium ) ); + QFrame *itemServChan = addPage( i18n( "Server/Channel" ), i18n( "Server/Channel Configuration" ), BarIcon( "", KIcon::SizeMedium ) ); + QFrame *itemAutoConnect = addPage( i18n( "Auto Connect" ), i18n( "Auto Connect Configuration" ), BarIcon( "", KIcon::SizeMedium ) ); + QFrame *itemFont = addPage( i18n( "Fonts" ), i18n( "Font Settings" ), BarIcon( "fonts", KIcon::SizeMedium ) ); + QFrame *itemShortcuts = addPage( i18n( "Shortcuts" ), i18n( "Shortcut Configuration" ), BarIcon( "", KIcon::SizeMedium ) ); + + QVBoxLayout *fontTopLayout = new QVBoxLayout( itemFont, 0, 6 ); + + + QVBoxLayout *looknfeelTopLayout= new QVBoxLayout( itemLooknFeel, 0, 6 ); + QVBoxLayout *generalTopLayout = new QVBoxLayout( itemGeneral, 0, 6 ); + QVBoxLayout *startupTopLayout = new QVBoxLayout( itemStartup, 0, 6 ); + QVBoxLayout *colorsTopLayout = new QVBoxLayout( itemColors, 0, 6 ); + QVBoxLayout *ircColorsTopLayout = new QVBoxLayout( itemIRCColors, 0, 6 ); + + QVBoxLayout *rmbMenuTopLayout = new QVBoxLayout( itemRMBMenu, 0, 6 ); + QVBoxLayout *servChanTopLayout = new QVBoxLayout( itemServChan, 0, 6 ); + QVBoxLayout *autoConnectTopLayout = new QVBoxLayout( itemAutoConnect, 0, 6 ); + QVBoxLayout *autoShortcutsTopLayout = new QVBoxLayout( itemShortcuts, 0, 6 ); + + pageLooknFeel= new PageLooknFeel( itemLooknFeel ); + pageGeneral = new PageGeneral( itemGeneral ); + pageStartup = new PageStartup( itemStartup ); + pageColors = new PageColors( itemColors ); + pageIRCColors = new PageIRCColors( itemIRCColors ); + pageFont = new PageFont( itemFont ); + pageRMBMenu = new PageRMBMenu( itemRMBMenu ); + pageServChan = new PageServChan( itemServChan ); + pageAutoConnect = new PageAutoConnect( itemAutoConnect ); + pageShortcuts = new PageShortcuts( itemShortcuts ); + + connect(pageLooknFeel, SIGNAL( modified() ), SLOT( modified() ) ); + connect(pageGeneral, SIGNAL( modified() ), SLOT( modified() ) ); + connect(pageStartup, SIGNAL( modified() ), SLOT( modified() ) ); + connect(pageColors, SIGNAL( modified() ), SLOT( modified() ) ); + connect(pageIRCColors, SIGNAL( modified() ), SLOT( modified() ) ); + connect(pageFont, SIGNAL( modified() ), SLOT( modified() ) ); + connect(pageRMBMenu, SIGNAL( modified() ), SLOT( modified() ) ); + connect(pageServChan, SIGNAL( modified() ), SLOT( modified() ) ); + connect(pageAutoConnect, SIGNAL( modified() ), SLOT( modified() ) ); + connect(pageShortcuts, SIGNAL( modified() ), SLOT( modified() ) ); + + connect(this, SIGNAL( applyClicked() ), this, SLOT( saveConfig() ) ); + connect(this, SIGNAL( okClicked() ), this, SLOT( saveConfig() ) ); + connect(this, SIGNAL( defaultClicked() ), this, SLOT(defaultConfig() ) ); + + looknfeelTopLayout->addWidget( pageLooknFeel ); + generalTopLayout->addWidget( pageGeneral ); + startupTopLayout->addWidget( pageStartup ); + colorsTopLayout->addWidget( pageColors ); + ircColorsTopLayout->addWidget( pageIRCColors ); + fontTopLayout->addWidget( pageFont ); + rmbMenuTopLayout->addWidget( pageRMBMenu ); + servChanTopLayout->addWidget( pageServChan ); + autoConnectTopLayout->addWidget( pageAutoConnect ); + autoShortcutsTopLayout->addWidget( pageShortcuts ); + //enableButtonSeperator( true ); + + readConfig(); + enableButtonApply( false ); + + pSCDirty = 0; + pACDirty = 0; +} + +KSPrefs::~KSPrefs() +{ +} + +void KSPrefs::readConfig() +{ + // apply by calling readConfig in each page + + pageLooknFeel->readConfig(); + pageGeneral->readConfig(); + pageColors->readConfig(); + pageIRCColors->readConfig(); + pageStartup->readConfig(); + pageFont->readConfig(); + pageRMBMenu->readConfig(); + pageServChan->readConfig(); + pageAutoConnect->readConfig(); + pageShortcuts->readConfig(); + +} + +void KSPrefs::saveConfig() +{ + // apply by calling saveConfig in each page + // use setDirty flag for each page and + // emit update() appropriate + + if ( dirty & KSOptions::General ) + pageGeneral->saveConfig(); + if ( dirty & KSOptions::Startup ) + pageStartup->saveConfig(); + if ( dirty & KSOptions::Colors ) + pageColors->saveConfig(); + if ( dirty & KSOptions::Colors ) + pageIRCColors->saveConfig(); + if ( dirty & KSOptions::Colors ) + pageFont->saveConfig(); + if ( dirty & KSOptions::RMBMenu ) + pageRMBMenu->saveConfig(); + if ( dirty & pSCDirty ) + pageServChan->saveConfig(); + if ( dirty & pACDirty ) + pageAutoConnect->saveConfig(); + if ( dirty & pLFDirty ) + pageLooknFeel->saveConfig(); + if ( dirty & pShortDirty ) + pageShortcuts->saveConfig(); + + + ksopts->save( dirty ); + emit update( dirty ); + enableButtonApply( false ); +} + + +void KSPrefs::defaultConfig() +{ + // apply by calling defaultConfig in current page + + switch (activePageIndex()) + { + case 0: + kdDebug(5008) << "Doing looknfeel" << endl; + pageLooknFeel->defaultConfig(); + break; + case 1: + kdDebug(5008) << "Doing general" << endl; + pageGeneral->defaultConfig(); + break; + case 2: + kdDebug(5008) << "Doing startup" << endl; + pageStartup->defaultConfig(); + break; + case 3: + kdDebug(5008) << "Doing colors" << endl; + pageColors->defaultConfig(); + break; + case 4: + kdDebug(5008) << "Doing IRC colors" << endl; + pageIRCColors->defaultConfig(); + break; + case 5: + kdDebug(5008) << "Doing RMBMenu" << endl; + pageRMBMenu->defaultConfig(); + break; + case 6: + kdDebug(5008) << "Doing ServerChan" << endl; + pageServChan->defaultConfig(); + break; + case 7: + kdDebug(5008) << "Doing AutoConnect" << endl; + pageAutoConnect->defaultConfig(); + case 8: + kdDebug(5008) << "Doing font" << endl; + pageFont->defaultConfig(); + break; + case 9: + kdDebug(5008) << "Doing shortcuts" << endl; + pageShortcuts->defaultConfig(); + break; + + } +} + +void KSPrefs::modified() +{ + if ( sender() == pageGeneral ) + dirty |= static_cast<int>( KSOptions::General ); + if ( sender() == pageStartup ) { + dirty |= static_cast<int>( KSOptions::Startup ); + dirty |= static_cast<int>( KSOptions::Servers ); + } + if ( sender() == pageColors ) + dirty |= static_cast<int>( KSOptions::Colors ); + if ( sender() == pageIRCColors ) + dirty |= static_cast<int>( KSOptions::Colors ); + if ( sender() == pageFont ) + dirty |= static_cast<int>( KSOptions::Colors ); + if ( sender() == pageRMBMenu ) + dirty |= static_cast<int>( KSOptions::RMBMenu ); + if ( sender() == pageServChan ) { + dirty |= 1; + pSCDirty = 1; + } + if ( sender() == pageAutoConnect ) { + dirty |= 1; + pACDirty = 1; + } + if ( sender() == pageLooknFeel ) { + dirty |= 1; + pLFDirty = 1; + } + if ( sender() == pageShortcuts ) { + dirty |= 1; + pShortDirty = 1; + } + + enableButtonApply( dirty ); +} diff --git a/ksirc/KSPrefs/ksprefs.h b/ksirc/KSPrefs/ksprefs.h new file mode 100644 index 00000000..6c41fd9a --- /dev/null +++ b/ksirc/KSPrefs/ksprefs.h @@ -0,0 +1,65 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSPREFS_H +#define KSPREFS_H + +#include <kdialogbase.h> + +class PageGeneral; +class PageColors; +class PageIRCColors; +class PageStartup; +class PageRMBMenu; +class PageServChan; +class PageAutoConnect; +class PageLooknFeel; +class PageShortcuts; + +class PageFont; /* For the font settings */ + + +class KSPrefs : public KDialogBase +{ + +Q_OBJECT +public: + KSPrefs(QWidget * parent = 0, const char * name = 0); + ~KSPrefs(); + +public slots: + void saveConfig(); + void defaultConfig(); + void readConfig(); + void modified(); + +signals: + void update(int); + +private: + PageColors *pageColors; + PageIRCColors *pageIRCColors; + PageGeneral *pageGeneral; + PageRMBMenu *pageRMBMenu; + PageStartup *pageStartup; + PageServChan *pageServChan; + PageAutoConnect *pageAutoConnect; + PageLooknFeel *pageLooknFeel; + PageShortcuts *pageShortcuts; + + int pSCDirty; + int pACDirty; + int pLFDirty; + int pShortDirty; + + PageFont *pageFont; /* Font settings page */ + int dirty; +}; + +#endif diff --git a/ksirc/KSPrefs/page_autoconnect.cpp b/ksirc/KSPrefs/page_autoconnect.cpp new file mode 100644 index 00000000..a6532915 --- /dev/null +++ b/ksirc/KSPrefs/page_autoconnect.cpp @@ -0,0 +1,309 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "page_autoconnect.h" + + +#include <qregexp.h> +#include <klocale.h> +#include <klistview.h> +#include <qlineedit.h> +#include <qpushbutton.h> +#include <qcheckbox.h> +#include <kapplication.h> +#include <kconfig.h> +#include <kdebug.h> +#include <knuminput.h> + +#define NAME 0 +#define PK 1 +#define PASS 2 +#define SSL 3 + +PageAutoConnect::PageAutoConnect( QWidget *parent, const char *name ) : PageAutoConnectBase( parent, name) +{ + KLVAutoConnect->setSorting( 0 ); + //KLVAutoConnect->header()->hide(); + + AddPB->setEnabled(FALSE); + DeletePB->setEnabled(FALSE); + PortKI->setValue(6667); +} + +PageAutoConnect::~PageAutoConnect() +{ +} + +void PageAutoConnect::saveConfig() +{ + + KConfig *conf = kapp->config(); + conf->setGroup("AutoConnect"); + + QStringList servers; + + for(QListViewItem *it = KLVAutoConnect->firstChild(); + it != 0; + it = it->nextSibling()){ + + QString server = it->text(NAME); + + if(it->text(PK).length() > 0) + server += ":" + it->text(1); + if(it->text(SSL).length() > 0) + server += " (SSL)"; + if(it->text(PASS).length() > 0) + server += QString(" (pass: %1)").arg(it->text(PASS)); + + servers << server; + + QStringList channels; + + for(QListViewItem *ch = it->firstChild(); + ch != 0; + ch = ch->nextSibling()){ + QString channel; + + channel = ch->text(NAME); + + if(ch->text(PK).length() > 0) + channel += QString(" (key: %1)").arg(ch->text(PK)); + + channels << channel; + + } + + channels.sort(); + conf->writeEntry(server, channels); + + } + + servers.sort(); + + conf->writeEntry("Servers", servers); + +} + +void PageAutoConnect::readConfig() +{ + KConfig *conf = kapp->config(); + conf->setGroup("AutoConnect"); + QStringList servers = conf->readListEntry("Servers"); + servers.sort(); + QStringList::ConstIterator ser = servers.begin(); + for( ; ser != servers.end(); ser++){ + QStringList channels = conf->readListEntry(*ser); + QString server = *ser; + QString port = "6667"; + QString ssl = QString::null; + QString pass = QString::null; + + QRegExp rx("(.+) \\(SSL\\)(.*)"); + if(rx.search(server) >= 0){ + server = rx.cap(1) + rx.cap(3); + ssl = i18n("SSL"); + } + rx.setPattern("(.+) \\(pass: (\\S+)\\)(.*)"); + if(rx.search(server) >= 0){ + server = rx.cap(1) + rx.cap(3); + pass = rx.cap(2); + } + rx.setPattern("([^: ]+):(\\d+)"); + if(rx.search(server) >= 0){ + kdDebug(5008) << server << ": Has port:" << rx.cap(2) << endl; + server = rx.cap(1); + port = rx.cap(2); + } + kdDebug(5008) << server << ": Done " << port << " " << ssl << " " << pass << endl; + QListViewItem *s = new QListViewItem(KLVAutoConnect, server, port, pass, ssl); + s->setOpen(TRUE); + channels.sort(); + QStringList::ConstIterator chan = channels.begin(); + for(; chan != channels.end(); chan++){ + QString channel = *chan; + QString key = QString::null; + QRegExp crx("(.+) \\(key: (\\S+)\\)"); + if(crx.search(channel) >= 0){ + channel = crx.cap(1); + key = crx.cap(2); + } + new QListViewItem(s, channel, key); + } + } +} + +void PageAutoConnect::defaultConfig() +{ + KLVAutoConnect->clear(); + readConfig( ); +} + +void PageAutoConnect::changed() +{ + emit modified(); +} + +void PageAutoConnect::add_pressed() +{ + int fnd = 0; + QListViewItem *s = 0; + + s = KLVAutoConnect->selectedItem(); + if(!s){ /* new item */ + QString server = ServerLE->text(); + QString ssl = QString::null; + QString port; + + port.setNum(PortKI->value()); + if(sslCB->isChecked()) + ssl = i18n("SSL"); + + s = new QListViewItem(KLVAutoConnect, server, port, PassLE->text(), ssl); + s->setOpen(TRUE); + s = new QListViewItem(s, ChannelLE->text(), KeyLE->text()); + KLVAutoConnect->setCurrentItem(s); + } + else { /* update the existing one */ + QListViewItem *parent; + QListViewItem *child; + + if(s->parent()){ + parent = s->parent(); + child = s; + } + else { + parent = s; + child = 0x0; + } + + parent->setText(NAME, ServerLE->text()); + parent->setText(PK, QString("%1").arg(PortKI->value())); + parent->setText(PASS, PassLE->text()); + if(sslCB->isChecked()) + parent->setText(SSL, i18n("SSL")); + else + parent->setText(SSL, QString::null); + + if(child){ + child->setText(NAME, ChannelLE->text()); + child->setText(PK, KeyLE->text()); + } + else { + if(ChannelLE->text().length() > 0){ + fnd = 0; + QListViewItem *c = parent->firstChild(); + for( ; c != 0 && fnd == 0; c = c->nextSibling()){ + if(c->text(NAME) == ChannelLE->text()){ + c->setText(PK, KeyLE->text()); + fnd = 1; + } + } + if(fnd == 0){ + new QListViewItem(parent, ChannelLE->text(), KeyLE->text()); + } + } + } + + } + changed(); +} + +void PageAutoConnect::new_pressed() +{ + AddPB->setText(i18n("&Add")); + ServerLE->clear(); + ChannelLE->clear(); + sslCB->setChecked(false); + PassLE->clear(); + KeyLE->clear(); + KLVAutoConnect->clearSelection(); + PortKI->setValue(6667) ; +} + +void PageAutoConnect::delete_pressed() +{ + for(QListViewItem *it = KLVAutoConnect->firstChild(); + it != 0; + it = it->nextSibling()){ + + if(it->text(NAME) == ServerLE->text()){ + if(ChannelLE->text().isEmpty() == FALSE){ + for(QListViewItem *ch = it->firstChild(); + ch != 0; + ch = ch->nextSibling()){ + if(ch->text(NAME) == ChannelLE->text()){ + delete ch; + changed(); + ChannelLE->clear(); + ServerLE->clear(); + return; + } + } + } + else { + delete it; + changed(); + ServerLE->clear(); + return; + } + } + } + changed(); +} + +void PageAutoConnect::kvl_clicked(QListViewItem *it) +{ + if(it != 0){ + if(it->parent() != 0){ + ChannelLE->setText(it->text(NAME)); + KeyLE->setText(it->text(PK)); + AddPB->setText(i18n("&Update")); + /* + * Move it to the parent to setup parent/server + * values. This save writing this code + * in two places. + */ + it = it->parent(); + } + else { + AddPB->setText(i18n("&Update/Add")); + ChannelLE->clear(); + KeyLE->clear(); + } + + if(it->parent() == 0){ + ServerLE->setText(it->text(NAME)); + PortKI->setValue(it->text(PK).toInt()); + PassLE->setText(it->text(PASS)); + if(it->text(SSL).length() > 0) + sslCB->setChecked(true); + else + sslCB->setChecked(false); + } + /* + * Make sure to do this after changing all the fields + */ + AddPB->setEnabled(false); + DeletePB->setEnabled(true); + + + } + else { + AddPB->setEnabled(false); + DeletePB->setEnabled(false); + } + changed(); +} + +void PageAutoConnect::item_changed() { + AddPB->setEnabled(true); +} + +#include "page_autoconnect.moc" + diff --git a/ksirc/KSPrefs/page_autoconnect.h b/ksirc/KSPrefs/page_autoconnect.h new file mode 100644 index 00000000..efd9a4ed --- /dev/null +++ b/ksirc/KSPrefs/page_autoconnect.h @@ -0,0 +1,36 @@ +#ifndef PAGEAUTOCONNECT_H +#define PAGEAUTOCONNECT_H +#include "page_autoconnectbase.h" + +#include "ksopts.h" + +class PageAutoConnect : public PageAutoConnectBase +{ + Q_OBJECT + +public: + PageAutoConnect( QWidget* parent = 0, const char* name = 0); + ~PageAutoConnect(); + + void saveConfig(); + void defaultConfig(); + void readConfig(); + +signals: + void modified(); + +public slots: + virtual void changed(); + +protected slots: + virtual void item_changed(); + + virtual void add_pressed(); + virtual void new_pressed(); + virtual void delete_pressed(); + + virtual void kvl_clicked(QListViewItem *); + +}; + +#endif // PAGEAUTOCONNECT_H diff --git a/ksirc/KSPrefs/page_autoconnectbase.ui b/ksirc/KSPrefs/page_autoconnectbase.ui new file mode 100644 index 00000000..71aafb49 --- /dev/null +++ b/ksirc/KSPrefs/page_autoconnectbase.ui @@ -0,0 +1,391 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>PageAutoConnectBase</class> +<widget class="QWidget"> + <property name="name"> + <cstring>PageAutoConnectBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>551</width> + <height>460</height> + </rect> + </property> + <property name="caption"> + <string>Auto Connect</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="KListView"> + <column> + <property name="text"> + <string>Auto Connect List</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Port/Key</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Server Password</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>SSL</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>KLVAutoConnect</cstring> + </property> + <property name="rootIsDecorated"> + <bool>true</bool> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox12</cstring> + </property> + <property name="title"> + <string>Auto Connect Setup</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout13</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout9</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabelSever</cstring> + </property> + <property name="text"> + <string>Server:</string> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>ServerLE</cstring> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout12</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabelPort</cstring> + </property> + <property name="text"> + <string>&Port:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>PortKI</cstring> + </property> + </widget> + <widget class="KIntNumInput"> + <property name="name"> + <cstring>PortKI</cstring> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout11</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabelPass</cstring> + </property> + <property name="text"> + <string>Server password:</string> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>PassLE</cstring> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout15</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabelSSL</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="buddy" stdset="0"> + <cstring>PortKI</cstring> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>sslCB</cstring> + </property> + <property name="text"> + <string>Use SS&L</string> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout12</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabelChan</cstring> + </property> + <property name="text"> + <string>&Channel:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>ChannelLE</cstring> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>ChannelLE</cstring> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout9</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabelKey</cstring> + </property> + <property name="text"> + <string>&Key:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>KeyLE</cstring> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>KeyLE</cstring> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout17</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>NewPB</cstring> + </property> + <property name="text"> + <string>&New</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>AddPB</cstring> + </property> + <property name="text"> + <string>&Add</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>DeletePB</cstring> + </property> + <property name="text"> + <string>&Delete</string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>ServerLE</sender> + <signal>textChanged(const QString&)</signal> + <receiver>PageAutoConnectBase</receiver> + <slot>item_changed()</slot> + </connection> + <connection> + <sender>PortKI</sender> + <signal>valueChanged(int)</signal> + <receiver>PageAutoConnectBase</receiver> + <slot>item_changed()</slot> + </connection> + <connection> + <sender>PassLE</sender> + <signal>textChanged(const QString&)</signal> + <receiver>PageAutoConnectBase</receiver> + <slot>item_changed()</slot> + </connection> + <connection> + <sender>sslCB</sender> + <signal>toggled(bool)</signal> + <receiver>PageAutoConnectBase</receiver> + <slot>item_changed()</slot> + </connection> + <connection> + <sender>ChannelLE</sender> + <signal>textChanged(const QString&)</signal> + <receiver>PageAutoConnectBase</receiver> + <slot>item_changed()</slot> + </connection> + <connection> + <sender>KeyLE</sender> + <signal>textChanged(const QString&)</signal> + <receiver>PageAutoConnectBase</receiver> + <slot>item_changed()</slot> + </connection> + <connection> + <sender>NewPB</sender> + <signal>pressed()</signal> + <receiver>PageAutoConnectBase</receiver> + <slot>new_pressed()</slot> + </connection> + <connection> + <sender>AddPB</sender> + <signal>pressed()</signal> + <receiver>PageAutoConnectBase</receiver> + <slot>add_pressed()</slot> + </connection> + <connection> + <sender>DeletePB</sender> + <signal>pressed()</signal> + <receiver>PageAutoConnectBase</receiver> + <slot>delete_pressed()</slot> + </connection> + <connection> + <sender>KLVAutoConnect</sender> + <signal>clicked(QListViewItem*)</signal> + <receiver>PageAutoConnectBase</receiver> + <slot>kvl_clicked(QListViewItem*)</slot> + </connection> +</connections> +<tabstops> + <tabstop>KLVAutoConnect</tabstop> + <tabstop>ServerLE</tabstop> + <tabstop>PortKI</tabstop> + <tabstop>PassLE</tabstop> + <tabstop>sslCB</tabstop> + <tabstop>ChannelLE</tabstop> + <tabstop>KeyLE</tabstop> + <tabstop>NewPB</tabstop> + <tabstop>AddPB</tabstop> + <tabstop>DeletePB</tabstop> +</tabstops> +<slots> + <slot>item_changed()</slot> + <slot>new_pressed()</slot> + <slot>add_pressed()</slot> + <slot>delete_pressed()</slot> + <slot>KLVAutoConnect_clicked(QListViewItem*)</slot> + <slot>kcl_clicked(QListViewItem *)</slot> + <slot>kvl_clicked(QListViewItem*)</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klistview.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> +</includehints> +</UI> diff --git a/ksirc/KSPrefs/page_colors.cpp b/ksirc/KSPrefs/page_colors.cpp new file mode 100644 index 00000000..f6d68a52 --- /dev/null +++ b/ksirc/KSPrefs/page_colors.cpp @@ -0,0 +1,295 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "page_colors.h" + +#include <qcheckbox.h> +#include <qlineedit.h> +#include <qradiobutton.h> +#include <qlabel.h> + +#include <kconfig.h> +#include <kapplication.h> +#include <kcolorbutton.h> +#include <kdebug.h> + +PageColors::PageColors( QWidget *parent, const char *name ) : PageColorsBase( parent, name) +{ + changing = 0; + m_dcol.setAutoDelete(true); +} + +PageColors::~PageColors() +{ +} + +void PageColors::saveConfig() +{ + ksopts->backgroundColor = backCBtn->color(); + ksopts->selBackgroundColor = selBackCBtn->color(); + ksopts->selForegroundColor = selForeCBtn->color(); + ksopts->errorColor = errorCBtn->color(); + ksopts->infoColor = infoCBtn->color(); + ksopts->textColor = genericTextCBtn->color(); + ksopts->channelColor = chanMsgCBtn->color(); + ksopts->linkColor = linkCBtn->color(); + + ksopts->ownNickColor = ownNickCBtn->color(); + ksopts->ownNickBold = ownNickBoldCB->isChecked(); + ksopts->ownNickRev = ownNickRevCB->isChecked(); + ksopts->ownNickUl = ownNickUlCB->isChecked(); + + if(fixedOtherColRB->isChecked()){ + ksopts->nickColourization = false; + ksopts->nickForeground = nickFGCBtn->color(); + ksopts->nickBackground = nickBGCBtn->color(); + } + else if(autoOtherColRB->isChecked()){ + ksopts->nickColourization = true; + ksopts->nickForeground = QColor(); + ksopts->nickBackground = QColor(); + } + else { + ksopts->nickColourization = false; + ksopts->nickForeground = QColor(); + ksopts->nickBackground = QColor(); + } + + ksopts->msgContainNick = ownContainNickCBtn->color(); + if(msg1LE->text().length() > 0){ + ksopts->msg1Contain = msg1CBtn->color(); + ksopts->msg1String = msg1LE->text(); + ksopts->msg1Regex = msg1Regex->isChecked(); + } + else { + ksopts->msg1Contain = QColor(); + ksopts->msg1String = msg1LE->text(); + ksopts->msg1Regex = false; + } + if(msg2LE->text().length() > 0){ + ksopts->msg2Contain = msg2CBtn->color(); + ksopts->msg2String = msg2LE->text(); + ksopts->msg2Regex = msg2Regex->isChecked(); + } + else { + ksopts->msg2Contain = QColor(); + ksopts->msg2String = msg2LE->text(); + ksopts->msg2Regex = false; + } + + ksopts->ksircColors = allowKSircColorsCB->isChecked(); + ksopts->mircColors = allowMIRCColorsCB->isChecked(); + ksopts->colourTheme = themeLB->currentText(); + + KConfig *conf = kapp->config(); + QDictIterator<KSOColors> it(m_dcol); + QStringList names; + for(; it.current(); ++it){ + names << it.currentKey(); + conf->setGroup("ColourSchemes-"+ it.currentKey()); + conf->writeEntry("Background", it.current()->backgroundColor); + conf->writeEntry("SelBackground", it.current()->selBackgroundColor); + conf->writeEntry("SelForeground", it.current()->selForegroundColor); + conf->writeEntry("Error", it.current()->errorColor); + conf->writeEntry("Info", it.current()->infoColor); + conf->writeEntry("Text", it.current()->textColor); + conf->writeEntry("Channel", it.current()->channelColor); + conf->writeEntry("Link", it.current()->linkColor); + conf->writeEntry("OwnNick", it.current()->ownNickColor); + conf->writeEntry("NickForeground", it.current()->nickForeground); + conf->writeEntry("NickBackground", it.current()->nickBackground); + } + conf->setGroup("ColourSchemes"); + conf->writeEntry("Names", names); + +} + +void PageColors::readConfig( const KSOColors *opts ) +{ + backCBtn->setColor( opts->backgroundColor ); + selBackCBtn->setColor( opts->selBackgroundColor ); + selForeCBtn->setColor( opts->selForegroundColor ); + errorCBtn->setColor( opts->errorColor ); + infoCBtn->setColor( opts->infoColor ); + genericTextCBtn->setColor( opts->textColor ); + chanMsgCBtn->setColor( opts->channelColor ); + linkCBtn->setColor( opts->linkColor ); + + ownNickCBtn->setColor( opts->ownNickColor ); + ownNickBoldCB->setChecked( opts->ownNickBold ); + ownNickRevCB->setChecked( opts->ownNickRev ); + ownNickUlCB->setChecked( opts->ownNickUl ); + + if( opts->nickColourization ){ + autoOtherColRB->setChecked( true ); + nickFGCBtn->setColor( QColor() ); + nickBGCBtn->setColor( QColor() ); + + } + else if( opts->nickForeground.isValid() || + opts->nickBackground.isValid() ){ + fixedOtherColRB->setChecked( true ); + nickFGCBtn->setColor( opts->nickForeground ); + nickBGCBtn->setColor( opts->nickBackground ); + } + else { + noOtherColRB->setChecked( true ); + nickFGCBtn->setColor( QColor() ); + nickBGCBtn->setColor( QColor() ); + + } + + ownContainNickCBtn->setColor( opts->msgContainNick ); + msg1CBtn->setColor( opts->msg1Contain ); + msg1LE->setText( opts->msg1String ); + msg1Regex->setChecked( opts->msg1Regex ); + msg2CBtn->setColor( opts->msg2Contain ); + msg2LE->setText( opts->msg2String ); + msg2Regex->setChecked( opts->msg2Regex ); + + coloursSetEnable(); + + allowKSircColorsCB->setChecked( opts->ksircColors ); + allowMIRCColorsCB->setChecked( opts->mircColors ); + + KConfig *conf = kapp->config(); + conf->setGroup("ColourSchemes"); + themeLB->clear(); + QStringList names = conf->readListEntry("Names"); + if(names.contains("Custom")){ + names.remove(names.find("Custom")); + } + names.prepend("Custom"); + themeLB->insertStringList(names); + if(themeLB->findItem(ksopts->colourTheme, Qt::ExactMatch)) + themeLB->setCurrentItem(themeLB->findItem(ksopts->colourTheme, Qt::ExactMatch)); + else + themeLB->setCurrentItem(0); + themeLE->setText(themeLB->currentText()); + + m_dcol.clear(); + + QStringList::Iterator it = names.begin(); + for( ; it != names.end(); ++it){ + conf->setGroup("ColourSchemes-"+ *it); + m_dcol.insert(*it, new KSOColors); + m_dcol[*it]->backgroundColor = conf->readColorEntry( "Background"); + m_dcol[*it]->selBackgroundColor = conf->readColorEntry( "SelBackground"); + m_dcol[*it]->selForegroundColor = conf->readColorEntry( "SelForeground"); + m_dcol[*it]->errorColor = conf->readColorEntry( "Error"); + m_dcol[*it]->infoColor = conf->readColorEntry( "Info"); + m_dcol[*it]->textColor = conf->readColorEntry( "Text"); + m_dcol[*it]->channelColor = conf->readColorEntry( "Channel"); + m_dcol[*it]->ownNickColor = conf->readColorEntry( "OwnNick"); + m_dcol[*it]->nickForeground = conf->readColorEntry( "NickForeground"); + m_dcol[*it]->nickBackground = conf->readColorEntry( "NickBackground"); + m_dcol[*it]->linkColor = conf->readColorEntry("Link"); + } +} + +void PageColors::defaultConfig() +{ + KSOColors opts; + readConfig( &opts ); +} + +void PageColors::changed() +{ + if(changing == 0) + themeLB->setSelected(0, TRUE); + coloursSetEnable(); + emit modified(); +} + +void PageColors::theme_clicked(QListBoxItem *li) +{ + if(li == 0x0) + return; + + QString name = li->text(); + + changing = 1; + backCBtn->setColor( m_dcol[name]->backgroundColor ); + selBackCBtn->setColor( m_dcol[name]->selBackgroundColor ); + selForeCBtn->setColor( m_dcol[name]->selForegroundColor ); + errorCBtn->setColor( m_dcol[name]->errorColor ); + infoCBtn->setColor( m_dcol[name]->infoColor ); + genericTextCBtn->setColor( m_dcol[name]->textColor ); + chanMsgCBtn->setColor( m_dcol[name]->channelColor ); + linkCBtn->setColor( m_dcol[name]->linkColor ); + + ownNickCBtn->setColor( m_dcol[name]->ownNickColor ); + nickFGCBtn->setColor( m_dcol[name]->nickForeground ); + nickBGCBtn->setColor( m_dcol[name]->nickBackground ); + changing = 0; + + themeLE->setText(li->text()); +} + +void PageColors::themeNewPB_clicked() +{ + themeLE->clear(); +} + +void PageColors::themeAddPB_clicked() +{ + QString name = themeLE->text(); + + kdDebug(5008) << "Got add: " << themeLB->currentText() << endl; + + m_dcol.replace(name, new KSOColors()); + + m_dcol[name]->backgroundColor = backCBtn->color(); + m_dcol[name]->selBackgroundColor = selBackCBtn->color(); + m_dcol[name]->selForegroundColor = selForeCBtn->color(); + m_dcol[name]->errorColor = errorCBtn->color(); + m_dcol[name]->infoColor = infoCBtn->color(); + m_dcol[name]->textColor = genericTextCBtn->color(); + m_dcol[name]->channelColor = chanMsgCBtn->color(); + m_dcol[name]->linkColor = linkCBtn->color(); + m_dcol[name]->ownNickColor = ownNickCBtn->color(); + m_dcol[name]->nickForeground = nickFGCBtn->color(); + m_dcol[name]->nickBackground = nickBGCBtn->color(); + + if(themeLB->findItem(name, Qt::ExactMatch) == 0){ + themeLB->insertItem(name); + } + + themeLB->setCurrentItem(themeLB->findItem(name, Qt::ExactMatch)); + +} + +void PageColors::themeDelPB_clicked() +{ + m_dcol.remove(themeLB->currentText()); + themeLB->removeItem(themeLB->currentItem()); +} + +void PageColors::theme_sel() +{ + themeLE->setText(themeLB->currentText()); +} + +void PageColors::coloursSetEnable() +{ + nickFGCBtn->setEnabled( fixedOtherColRB->isChecked() ); + nickBGCBtn->setEnabled( fixedOtherColRB->isChecked() ); + nickFGColorLabel->setEnabled( fixedOtherColRB->isChecked() ); + nickBGColorLabel->setEnabled( fixedOtherColRB->isChecked() ); + + bool msgEn = msg1LE->text().length() > 0; + msg1CBtn->setEnabled(msgEn); + msg1Regex->setEnabled(msgEn); + msgEn = msg2LE->text().length() > 0; + msg2CBtn->setEnabled(msgEn); + msg2Regex->setEnabled(msgEn); + +} + +#include "page_colors.moc" diff --git a/ksirc/KSPrefs/page_colors.h b/ksirc/KSPrefs/page_colors.h new file mode 100644 index 00000000..188fe0a8 --- /dev/null +++ b/ksirc/KSPrefs/page_colors.h @@ -0,0 +1,53 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef PAGE_COLORS_H +#define PAGE_COLORS_H + +#include "page_colorsbase.h" +#include "ksopts.h" + +#include <qlistbox.h> +#include <qstringlist.h> +#include <qdict.h> + +class PageColors : public PageColorsBase +{ +Q_OBJECT + +public: + PageColors( QWidget *parent = 0, const char *name = 0 ); + ~PageColors(); + + void saveConfig(); + void defaultConfig(); + void readConfig( const KSOColors * = ksopts ); + +protected slots: + void changed(); + +public slots: + virtual void theme_clicked(QListBoxItem*); + virtual void themeNewPB_clicked(); + virtual void themeAddPB_clicked(); + virtual void themeDelPB_clicked(); + virtual void theme_sel(); + +signals: + void modified(); + +private: + void coloursSetEnable(); + +private: + int changing; + QDict<KSOColors> m_dcol; +}; + +#endif diff --git a/ksirc/KSPrefs/page_colorsbase.ui b/ksirc/KSPrefs/page_colorsbase.ui new file mode 100644 index 00000000..498c9c23 --- /dev/null +++ b/ksirc/KSPrefs/page_colorsbase.ui @@ -0,0 +1,1063 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>PageColorsBase</class> +<widget class="QWidget"> + <property name="name"> + <cstring>PageColorsBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>617</width> + <height>545</height> + </rect> + </property> + <property name="caption"> + <string>Colors</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QTabWidget"> + <property name="name"> + <cstring>tabWidget2</cstring> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>&Scheme</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>chatColorsGB</cstring> + </property> + <property name="title"> + <string>Chat Colors</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>chanMsgLabel</cstring> + </property> + <property name="text"> + <string>C&hannel messages:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>chanMsgCBtn</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>genericTextLabel</cstring> + </property> + <property name="text"> + <string>&Generic text:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="2"> + <property name="name"> + <cstring>errorLabel</cstring> + </property> + <property name="text"> + <string>&Errors:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>errorCBtn</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>infoLabel</cstring> + </property> + <property name="text"> + <string>&Info:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>infoCBtn</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="2"> + <property name="name"> + <cstring>backgrndLabel</cstring> + </property> + <property name="text"> + <string>&Background:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>backCBtn</cstring> + </property> + </widget> + <widget class="KColorButton" row="0" column="1"> + <property name="name"> + <cstring>genericTextCBtn</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QLabel" row="2" column="2"> + <property name="name"> + <cstring>backgrndLabel_2</cstring> + </property> + <property name="text"> + <string>&Links:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>backCBtn</cstring> + </property> + </widget> + <spacer row="1" column="4"> + <property name="name"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KColorButton" row="2" column="3"> + <property name="name"> + <cstring>linkCBtn</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton" row="1" column="3"> + <property name="name"> + <cstring>backCBtn</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton" row="0" column="3"> + <property name="name"> + <cstring>errorCBtn</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>backgrndLabel_2_2</cstring> + </property> + <property name="text"> + <string>Selection backgr&ound:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>backCBtn</cstring> + </property> + </widget> + <widget class="KColorButton" row="1" column="1"> + <property name="name"> + <cstring>infoCBtn</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton" row="2" column="1"> + <property name="name"> + <cstring>chanMsgCBtn</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton" row="3" column="1"> + <property name="name"> + <cstring>selBackCBtn</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton" row="3" column="3"> + <property name="name"> + <cstring>selForeCBtn</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QLabel" row="3" column="2"> + <property name="name"> + <cstring>backgrndLabel_2_2_2</cstring> + </property> + <property name="text"> + <string>Sele&ction foreground:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>backCBtn</cstring> + </property> + </widget> + <widget class="QCheckBox" row="4" column="0" rowspan="1" colspan="5"> + <property name="name"> + <cstring>nickFGColorCB</cstring> + </property> + <property name="text"> + <string>&Use background color for links</string> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox11</cstring> + </property> + <property name="title"> + <string>Sample Color Themes</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLineEdit" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>themeLE</cstring> + </property> + </widget> + <widget class="QListBox" row="1" column="0" rowspan="4" colspan="1"> + <property name="name"> + <cstring>themeLB</cstring> + </property> + </widget> + <widget class="QPushButton" row="1" column="1"> + <property name="name"> + <cstring>themeNewPB</cstring> + </property> + <property name="text"> + <string>&New</string> + </property> + </widget> + <widget class="QPushButton" row="2" column="1"> + <property name="name"> + <cstring>themeAddPB</cstring> + </property> + <property name="text"> + <string>&Add</string> + </property> + </widget> + <widget class="QPushButton" row="3" column="1"> + <property name="name"> + <cstring>themeDelPB</cstring> + </property> + <property name="text"> + <string>&Delete</string> + </property> + </widget> + <spacer row="4" column="1"> + <property name="name"> + <cstring>spacer5</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>40</height> + </size> + </property> + </spacer> + </grid> + </widget> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>&Highlighting</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox5</cstring> + </property> + <property name="title"> + <string>Your Nick</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>nickMatchLabel_2_2</cstring> + </property> + <property name="text"> + <string>Color: </string> + </property> + <property name="buddy" stdset="0"> + <cstring>ownNickCBtn</cstring> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>ownNickCBtn</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>ownNickBoldCB</cstring> + </property> + <property name="text"> + <string>Bold</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>ownNickRevCB</cstring> + </property> + <property name="text"> + <string>Reverse</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>ownNickUlCB</cstring> + </property> + <property name="text"> + <string>Underline</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer10_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>202</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>buttonGroup1</cstring> + </property> + <property name="title"> + <string>Other Nicks</string> + </property> + <property name="exclusive"> + <bool>true</bool> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton" row="0" column="0" rowspan="1" colspan="6"> + <property name="name"> + <cstring>noOtherColRB</cstring> + </property> + <property name="text"> + <string>N&o nick colors</string> + </property> + </widget> + <widget class="QRadioButton" row="1" column="0" rowspan="1" colspan="6"> + <property name="name"> + <cstring>autoOtherColRB</cstring> + </property> + <property name="text"> + <string>Au&to nick colorization</string> + </property> + </widget> + <widget class="QRadioButton" row="2" column="0"> + <property name="name"> + <cstring>fixedOtherColRB</cstring> + </property> + <property name="text"> + <string>Fi&xed</string> + </property> + </widget> + <widget class="QLabel" row="2" column="1"> + <property name="name"> + <cstring>nickFGColorLabel</cstring> + </property> + <property name="text"> + <string>&Foreground:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>nickFGCBtn</cstring> + </property> + </widget> + <widget class="KColorButton" row="2" column="2"> + <property name="name"> + <cstring>nickFGCBtn</cstring> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QLabel" row="2" column="3"> + <property name="name"> + <cstring>nickBGColorLabel</cstring> + </property> + <property name="text"> + <string>Backg&round:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>nickBGCBtn</cstring> + </property> + </widget> + <widget class="KColorButton" row="2" column="4"> + <property name="name"> + <cstring>nickBGCBtn</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <spacer row="2" column="5"> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>83</width> + <height>21</height> + </size> + </property> + </spacer> + </grid> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>nickGB</cstring> + </property> + <property name="title"> + <string>Highlight Messages</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout12</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>nickMatchLabel_2</cstring> + </property> + <property name="text"> + <string>Containing &your nick:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>ownNickCBtn</cstring> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>ownContainNickCBtn</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer8</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>169</width> + <height>21</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout11</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>nickMatchLabel_2_3</cstring> + </property> + <property name="text"> + <string>Containing:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>ownNickCBtn</cstring> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>msg1LE</cstring> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>msg1CBtn</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>msg1Regex</cstring> + </property> + <property name="text"> + <string>Regex</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer10</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>104</width> + <height>21</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout10</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>nickMatchLabel_2_3_2</cstring> + </property> + <property name="text"> + <string>Containing:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>ownNickCBtn</cstring> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>msg2LE</cstring> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>msg2CBtn</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>msg2Regex</cstring> + </property> + <property name="text"> + <string>Regex</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer10_3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>104</width> + <height>21</height> + </size> + </property> + </spacer> + </hbox> + </widget> + </vbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>colorCodesGB</cstring> + </property> + <property name="title"> + <string>Color Codes</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>allowKSircColorsCB</cstring> + </property> + <property name="text"> + <string>Strip &kSirc color codes</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>allowMIRCColorsCB</cstring> + </property> + <property name="text"> + <string>Strip &mIRC color codes</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer8_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>31</width> + <height>16</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>allowKSircColorsCB</sender> + <signal>clicked()</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>allowMIRCColorsCB</sender> + <signal>clicked()</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>backCBtn</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>chanMsgCBtn</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>errorCBtn</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>genericTextCBtn</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>infoCBtn</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>linkCBtn</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>nickBGCBtn</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>nickFGCBtn</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>nickFGColorCB</sender> + <signal>clicked()</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>ownContainNickCBtn</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>themeAddPB</sender> + <signal>clicked()</signal> + <receiver>PageColorsBase</receiver> + <slot>themeAddPB_clicked()</slot> + </connection> + <connection> + <sender>themeDelPB</sender> + <signal>clicked()</signal> + <receiver>PageColorsBase</receiver> + <slot>themeDelPB_clicked()</slot> + </connection> + <connection> + <sender>themeLB</sender> + <signal>clicked(QListBoxItem*)</signal> + <receiver>PageColorsBase</receiver> + <slot>theme_clicked(QListBoxItem*)</slot> + </connection> + <connection> + <sender>themeLB</sender> + <signal>selectionChanged()</signal> + <receiver>PageColorsBase</receiver> + <slot>theme_sel()</slot> + </connection> + <connection> + <sender>themeLE</sender> + <signal>returnPressed()</signal> + <receiver>PageColorsBase</receiver> + <slot>themeAddPB_clicked()</slot> + </connection> + <connection> + <sender>themeNewPB</sender> + <signal>clicked()</signal> + <receiver>PageColorsBase</receiver> + <slot>themeNewPB_clicked()</slot> + </connection> + <connection> + <sender>selBackCBtn</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>selForeCBtn</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>ownNickCBtn</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>ownNickBoldCB</sender> + <signal>stateChanged(int)</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>ownNickRevCB</sender> + <signal>stateChanged(int)</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>ownNickUlCB</sender> + <signal>stateChanged(int)</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>noOtherColRB</sender> + <signal>stateChanged(int)</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>autoOtherColRB</sender> + <signal>stateChanged(int)</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>fixedOtherColRB</sender> + <signal>stateChanged(int)</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>msg1CBtn</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>msg1LE</sender> + <signal>textChanged(const QString&)</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>msg1Regex</sender> + <signal>stateChanged(int)</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>msg2CBtn</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>msg2Regex</sender> + <signal>stateChanged(int)</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>msg2LE</sender> + <signal>textChanged(const QString&)</signal> + <receiver>PageColorsBase</receiver> + <slot>changed()</slot> + </connection> +</connections> +<tabstops> + <tabstop>genericTextCBtn</tabstop> + <tabstop>errorCBtn</tabstop> + <tabstop>infoCBtn</tabstop> + <tabstop>backCBtn</tabstop> + <tabstop>chanMsgCBtn</tabstop> + <tabstop>linkCBtn</tabstop> + <tabstop>selBackCBtn</tabstop> + <tabstop>selForeCBtn</tabstop> + <tabstop>nickFGCBtn</tabstop> + <tabstop>nickBGCBtn</tabstop> + <tabstop>nickFGColorCB</tabstop> + <tabstop>ownContainNickCBtn</tabstop> + <tabstop>allowKSircColorsCB</tabstop> + <tabstop>allowMIRCColorsCB</tabstop> + <tabstop>themeLE</tabstop> + <tabstop>themeLB</tabstop> + <tabstop>themeNewPB</tabstop> + <tabstop>themeAddPB</tabstop> + <tabstop>themeDelPB</tabstop> +</tabstops> +<slots> + <slot>theme_clicked(QListBoxItem*)</slot> + <slot>themeNewPB_clicked()</slot> + <slot>themeDelPB_clicked()</slot> + <slot>themeAddPB_clicked()</slot> + <slot>theme_sel()</slot> + <slot>setColourEnabled()</slot> + <slot>coloursSetEnable()</slot> + <slot>changed()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/ksirc/KSPrefs/page_font.cpp b/ksirc/KSPrefs/page_font.cpp new file mode 100644 index 00000000..e9f9e0e6 --- /dev/null +++ b/ksirc/KSPrefs/page_font.cpp @@ -0,0 +1,38 @@ +#include "page_font.h" +#include "qapplication.h" +PageFont::PageFont( QWidget *parent, const char *name ) : + QWidget( parent, name) +{ + layout = new QHBoxLayout(this); + fontchooser = new KFontChooser(this); + layout->addWidget(fontchooser); + connect(fontchooser,SIGNAL(fontSelected ( const QFont&)), this, SLOT(update())); +} + +PageFont::~PageFont( ) +{ + +} + +void PageFont::update( void ){ + emit modified(); +} + +void PageFont::saveConfig( void ) +{ + ksopts->defaultFont = fontchooser->font(); + QApplication::setFont(fontchooser->font(), true, "KSirc::TextView" ); +} + +void PageFont::readConfig( const KSOColors * opts ) +{ + /* Just set the font from the preferences */ + fontchooser->setFont( opts->defaultFont ); +} + +void PageFont::defaultConfig( void ) +{ + fontchooser->setFont( ksopts->defaultFont ); +} + +#include "page_font.moc" diff --git a/ksirc/KSPrefs/page_font.h b/ksirc/KSPrefs/page_font.h new file mode 100644 index 00000000..0d2fa673 --- /dev/null +++ b/ksirc/KSPrefs/page_font.h @@ -0,0 +1,62 @@ +#ifndef _PAGE_FONT +#define _PAGE_FONT +#include <kfontdialog.h> // For the font selection widget +#include <qlayout.h> // For the layout +#include "ksopts.h" // For storing the info. + +/** + * A page for the preferences dialog to set the standard font + * + * @author Markus Weimer <markus.weimer@web.de> + */ +class PageFont : public QWidget +{ + Q_OBJECT + + public: + /** + * Create the Widget + */ + PageFont( QWidget *parent = 0, const char *name = 0 ); + + + /* + * Standard destructor + */ + ~PageFont(); + + + /** + * Save the config set by the user to the global ksopts object. + * + */ + void saveConfig( void ); + + + /** + * Reset the current user config to the one stored in the global + * ksopts object. + * + */ + void defaultConfig( void ); + + + /** + * Read the configuration from the given KSOptions object + * + * @param opts the KSOptions object to modify + */ + void readConfig( const KSOColors* opts=ksopts ); + + public slots: + void update( void ); + + signals: + void modified(); + + private: + KFontChooser* fontchooser; /** The font choosing widget from kdelib */ + QHBoxLayout* layout; +}; + +#endif diff --git a/ksirc/KSPrefs/page_general.cpp b/ksirc/KSPrefs/page_general.cpp new file mode 100644 index 00000000..d6256e2c --- /dev/null +++ b/ksirc/KSPrefs/page_general.cpp @@ -0,0 +1,117 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <qcheckbox.h> +#include <qspinbox.h> + +#include <klocale.h> +#include <kcharsets.h> +#include "page_general.h" +#include "../servercontroller.h" + +PageGeneral::PageGeneral( QWidget *parent, const char *name ) : PageGeneralBase( parent, name) +{ +} + +PageGeneral::~PageGeneral() +{ +} + +void PageGeneral::saveConfig() +{ + ksopts->runDocked = dockedOnlyCB->isChecked(); + servercontroller::self()->checkDocking(); + ksopts->autoCreateWin = autoCreateWindowCB->isChecked(); + ksopts->autoCreateWinForNotice = autoCreateWindowForNoticeCB->isChecked(); + ksopts->nickCompletion = nickCompletionCB->isChecked(); + ksopts->displayTopic = displayTopicCB->isChecked(); + ksopts->colorPicker = colorPickerPopupCB->isChecked(); + ksopts->autoRejoin = autoRejoinCB->isChecked(); + ksopts->oneLineEntry = oneLineEditCB->isChecked(); + ksopts->useColourNickList = useColourNickListCB->isChecked(); + ksopts->dockPopups = dockPopupsCB->isChecked(); + ksopts->autoSaveHistory = autoSaveHistoryCB->isChecked(); + ksopts->windowLength = historySB->value(); + + ksopts->channel["global"]["global"].timeStamp = timeStampCB->isChecked(); + ksopts->channel["global"]["global"].beepOnMsg = beepCB->isChecked(); + ksopts->channel["global"]["global"].topicShow = showTopicCB->isChecked(); + ksopts->channel["global"]["global"].logging = enLoggingCB->isChecked(); + ksopts->channel["global"]["global"].encoding = encodingsCB->currentText(); + ksopts->channel["global"]["global"].filterJoinPart = joinPartCB->isChecked(); + + if(applyGloballyCB->isChecked()){ + ksopts->applyChannelGlobal(); + } + + ksopts->publicAway = publicAway->isChecked(); +} + +void PageGeneral::readConfig( const KSOGeneral *opts ) +{ + dockedOnlyCB->setChecked( opts->runDocked ); + autoCreateWindowCB->setChecked( opts->autoCreateWin ); + autoCreateWindowForNoticeCB->setChecked( opts->autoCreateWinForNotice ); + nickCompletionCB->setChecked( opts->nickCompletion ); + displayTopicCB->setChecked( opts->displayTopic ); + colorPickerPopupCB->setChecked( opts->colorPicker ); + autoRejoinCB->setChecked( opts->autoRejoin ); + oneLineEditCB->setChecked( opts->oneLineEntry ); + useColourNickListCB->setChecked( opts->useColourNickList ); + dockPopupsCB->setChecked( opts->dockPopups ); + dockPopupsCB->setEnabled(dockedOnlyCB->isChecked()); + + autoSaveHistoryCB->setChecked( opts->autoSaveHistory ); + + historySB->setValue( opts->windowLength ); + + timeStampCB->setChecked( ksopts->channel["global"]["global"].timeStamp ); + beepCB->setChecked( ksopts->channel["global"]["global"].beepOnMsg ); + showTopicCB->setChecked( ksopts->channel["global"]["global"].topicShow ); + enLoggingCB->setChecked( ksopts->channel["global"]["global"].logging ); + joinPartCB->setChecked( ksopts->channel["global"]["global"].filterJoinPart ); + + publicAway->setChecked( ksopts->publicAway ); + + encodingsCB->clear(); + + + QStringList encodings = KGlobal::charsets()->descriptiveEncodingNames(); + + // remove utf16/ucs2 as it just doesn't work for IRC + QStringList::Iterator encodingIt = encodings.begin(); + while ( encodingIt != encodings.end() ) { + if ( ( *encodingIt ).find( "utf16" ) != -1 || + ( *encodingIt ).find( "iso-10646" ) != -1 ) + encodingIt = encodings.remove( encodingIt ); + else + ++encodingIt; + } + encodings.prepend( i18n( "Default" ) ); + encodingsCB->insertStringList(encodings); + int eindex = encodings.findIndex(ksopts->channel["global"]["global"].encoding); + if(eindex == -1) + encodingsCB->setCurrentItem(0); + else + encodingsCB->setCurrentItem(eindex); +} + +void PageGeneral::defaultConfig() +{ + KSOGeneral opts; + readConfig( &opts ); +} + +void PageGeneral::changed() +{ + dockPopupsCB->setEnabled(dockedOnlyCB->isChecked()); + emit modified(); +} + +#include "page_general.moc" diff --git a/ksirc/KSPrefs/page_general.h b/ksirc/KSPrefs/page_general.h new file mode 100644 index 00000000..ecf515ca --- /dev/null +++ b/ksirc/KSPrefs/page_general.h @@ -0,0 +1,35 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef PAGE_GENERAL_H +#define PAGE_GENERAL_H + +#include "page_generalbase.h" +#include "ksopts.h" + +class PageGeneral : public PageGeneralBase +{ +Q_OBJECT + +public: + PageGeneral( QWidget *parent = 0, const char *name = 0 ); + ~PageGeneral(); + + void saveConfig(); + void defaultConfig(); + void readConfig( const KSOGeneral * = ksopts ); + +signals: + void modified(); + +public slots: + virtual void changed(); +}; + +#endif diff --git a/ksirc/KSPrefs/page_generalbase.ui b/ksirc/KSPrefs/page_generalbase.ui new file mode 100644 index 00000000..d3b4db06 --- /dev/null +++ b/ksirc/KSPrefs/page_generalbase.ui @@ -0,0 +1,540 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>PageGeneralBase</class> +<widget class="QFrame"> + <property name="name"> + <cstring>PageGeneralBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>443</width> + <height>489</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>425</width> + <height>0</height> + </size> + </property> + <property name="caption"> + <string>General</string> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Plain</enum> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>miscGB</cstring> + </property> + <property name="frameShape"> + <enum>GroupBoxPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="title"> + <string>Global Options</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="5" column="1"> + <property name="name"> + <cstring>Layout11</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>historyItemsLabel</cstring> + </property> + <property name="maximumSize"> + <size> + <width>120</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string>Histor&y length:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>historySB</cstring> + </property> + </widget> + <widget class="QSpinBox"> + <property name="name"> + <cstring>historySB</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="suffix"> + <string> lines</string> + </property> + <property name="specialValueText"> + <string>unlimited</string> + </property> + <property name="maxValue"> + <number>1000</number> + </property> + <property name="toolTip" stdset="0"> + <string>Stores up to this many lines of chat from each window as history</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Stores up to this many lines of chat from each window, allowing you to scroll upwards and see what has already been said.</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QCheckBox" row="2" column="1"> + <property name="name"> + <cstring>publicAway</cstring> + </property> + <property name="text"> + <string>&Announce away messages</string> + </property> + <property name="toolTip" stdset="0"> + <string>See the messages when a user selects the away option</string> + </property> + <property name="whatsThis" stdset="0"> + <string>If this is checked, you will see the messages when a user selects the away option. By default this option is not checked.</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="0"> + <property name="name"> + <cstring>autoCreateWindowCB</cstring> + </property> + <property name="text"> + <string>A&uto create window</string> + </property> + <property name="toolTip" stdset="0"> + <string>Will auto create a window for each user who sends a /msg to you</string> + </property> + <property name="whatsThis" stdset="0"> + <string>If selected, KSirc will automatically create a new window for each user who sends a /msg command to you. If not selected, any text sent to you with /msg is displayed in the current window and you can use /query username to create a window to chat to that user.</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="0"> + <property name="name"> + <cstring>autoCreateWindowForNoticeCB</cstring> + </property> + <property name="text"> + <string>Auto create &on notice</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="1"> + <property name="name"> + <cstring>autoRejoinCB</cstring> + </property> + <property name="text"> + <string>Auto-re&join</string> + </property> + <property name="toolTip" stdset="0"> + <string>Rejoin channels automatically if you are disconnected.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>If selected, it allows you to rejoin channels automatically if you are disconnected.</string> + </property> + </widget> + <widget class="QCheckBox" row="4" column="1"> + <property name="name"> + <cstring>dockPopupsCB</cstring> + </property> + <property name="text"> + <string>Dock &passive popups</string> + </property> + </widget> + <widget class="QCheckBox" row="4" column="0"> + <property name="name"> + <cstring>displayTopicCB</cstring> + </property> + <property name="text"> + <string>D&isplay topic in caption</string> + </property> + <property name="toolTip" stdset="0"> + <string>Display the topic of the current channel in the window caption</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Displays the topic of the current channel in the window caption. If not selected, the topic is only displayed inside the window.</string> + </property> + </widget> + <widget class="QCheckBox" row="0" column="1"> + <property name="name"> + <cstring>colorPickerPopupCB</cstring> + </property> + <property name="text"> + <string>Color pi&cker popup</string> + </property> + <property name="toolTip" stdset="0"> + <string>Allow you to get the color pickup dialog with Ctrl K</string> + </property> + <property name="whatsThis" stdset="0"> + <string>If selected, a popup window from which to select the color of your text is presented when you press Ctrl K. If not, you have to type the color codes manually.</string> + </property> + </widget> + <widget class="QCheckBox" row="5" column="0"> + <property name="name"> + <cstring>oneLineEditCB</cstring> + </property> + <property name="text"> + <string>One line te&xt entry box</string> + </property> + </widget> + <widget class="QCheckBox" row="3" column="1"> + <property name="name"> + <cstring>useColourNickListCB</cstring> + </property> + <property name="text"> + <string>Us&e color nick list</string> + </property> + <property name="toolTip" stdset="0"> + <string>Use the colors set in the Colors tab of the Configure KSirc dialog for coloring the nicknames</string> + </property> + <property name="whatsThis" stdset="0"> + <string>If selected, it will use the colors set in the Colors tab of the Configure KSirc dialog for coloring the nicknames.</string> + </property> + </widget> + <spacer row="2" column="2"> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="QCheckBox" row="3" column="0"> + <property name="name"> + <cstring>nickCompletionCB</cstring> + </property> + <property name="text"> + <string>&Nick completion</string> + </property> + <property name="toolTip" stdset="0"> + <string>Switch nickname completion on</string> + </property> + <property name="whatsThis" stdset="0"> + <string>If selected, switches nickname completion on. Nickname completion works as follows: Type the first letters of a user's nickname, press the Tab key, the text you typed will be completed to match the username, including changes in capitalization if necessary.</string> + </property> + </widget> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>dockedOnlyCB</cstring> + </property> + <property name="text"> + <string>&Dock in system tray</string> + </property> + <property name="toolTip" stdset="0"> + <string>Put the KSirc icon in the system tray</string> + </property> + <property name="whatsThis" stdset="0"> + <string>This allows KSirc to be docked in the system tray. By default this is not enabled. When KSirc is docked in the system tray, you are able to access several options by clicking on the KSirc icon. When you close KSirc window, the icon stays in the systray until you quit KSirc.</string> + </property> + </widget> + <widget class="QCheckBox" row="6" column="0"> + <property name="name"> + <cstring>autoSaveHistoryCB</cstring> + </property> + <property name="text"> + <string>Auto save history</string> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox4</cstring> + </property> + <property name="title"> + <string>Per Channel Options</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="1" column="0"> + <property name="name"> + <cstring>timeStampCB</cstring> + </property> + <property name="text"> + <string>&Time stamp</string> + </property> + <property name="toolTip" stdset="0"> + <string>Add the time and date on the left of each message</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Prepends each thing said in the channel with the time it was said, in the form [HH:MM:SS].</string> + </property> + </widget> + <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>applyGloballyCB</cstring> + </property> + <property name="text"> + <string>O&verride existing channel options</string> + </property> + <property name="toolTip" stdset="0"> + <string>The settings in this tab will be applied and each channel settings will be ignored</string> + </property> + <property name="whatsThis" stdset="0"> + <string>If this is selected, the settings in this tab will override each channel's options so these settings will be applied in each channel, independently of your channel settings in the Channel menu. This setting will only work until next time you open the configuration dialog and it will be reset unchecked then; this is because you probably do not want to override the existing channels options all the time.</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="1"> + <property name="name"> + <cstring>showTopicCB</cstring> + </property> + <property name="text"> + <string>Sho&w topic</string> + </property> + <property name="toolTip" stdset="0"> + <string>Displays the channel topic on top</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Displays the channel topic on top of each channel window.</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="0"> + <property name="name"> + <cstring>beepCB</cstring> + </property> + <property name="text"> + <string>&Beep on change</string> + </property> + </widget> + <widget class="QCheckBox" row="3" column="0"> + <property name="name"> + <cstring>joinPartCB</cstring> + </property> + <property name="text"> + <string>Hide part/join messages</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="1"> + <property name="name"> + <cstring>enLoggingCB</cstring> + </property> + <property name="text"> + <string>Enable lo&gging</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + <widget class="QLayoutWidget" row="4" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>encodingsL</cstring> + </property> + <property name="text"> + <string>Default en&coding:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>encodingsCB</cstring> + </property> + </widget> + <widget class="QComboBox"> + <property name="name"> + <cstring>encodingsCB</cstring> + </property> + </widget> + </hbox> + </widget> + </grid> + </widget> + <spacer> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>31</width> + <height>71</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<connections> + <connection> + <sender>autoCreateWindowCB</sender> + <signal>clicked()</signal> + <receiver>PageGeneralBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>nickCompletionCB</sender> + <signal>clicked()</signal> + <receiver>PageGeneralBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>displayTopicCB</sender> + <signal>clicked()</signal> + <receiver>PageGeneralBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>beepCB</sender> + <signal>clicked()</signal> + <receiver>PageGeneralBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>colorPickerPopupCB</sender> + <signal>clicked()</signal> + <receiver>PageGeneralBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>autoRejoinCB</sender> + <signal>clicked()</signal> + <receiver>PageGeneralBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>historySB</sender> + <signal>valueChanged(int)</signal> + <receiver>PageGeneralBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>publicAway</sender> + <signal>toggled(bool)</signal> + <receiver>PageGeneralBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>showTopicCB</sender> + <signal>clicked()</signal> + <receiver>PageGeneralBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>enLoggingCB</sender> + <signal>clicked()</signal> + <receiver>PageGeneralBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>timeStampCB</sender> + <signal>clicked()</signal> + <receiver>PageGeneralBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>applyGloballyCB</sender> + <signal>clicked()</signal> + <receiver>PageGeneralBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>oneLineEditCB</sender> + <signal>clicked()</signal> + <receiver>PageGeneralBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>useColourNickListCB</sender> + <signal>clicked()</signal> + <receiver>PageGeneralBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>autoCreateWindowForNoticeCB</sender> + <signal>clicked()</signal> + <receiver>PageGeneralBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>dockedOnlyCB</sender> + <signal>clicked()</signal> + <receiver>PageGeneralBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>dockPopupsCB</sender> + <signal>clicked()</signal> + <receiver>PageGeneralBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>encodingsCB</sender> + <signal>activated(int)</signal> + <receiver>PageGeneralBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>joinPartCB</sender> + <signal>clicked()</signal> + <receiver>PageGeneralBase</receiver> + <slot>changed()</slot> + </connection> +</connections> +<tabstops> + <tabstop>autoCreateWindowCB</tabstop> + <tabstop>nickCompletionCB</tabstop> + <tabstop>displayTopicCB</tabstop> + <tabstop>colorPickerPopupCB</tabstop> + <tabstop>autoRejoinCB</tabstop> + <tabstop>publicAway</tabstop> + <tabstop>historySB</tabstop> + <tabstop>timeStampCB</tabstop> + <tabstop>beepCB</tabstop> + <tabstop>showTopicCB</tabstop> + <tabstop>enLoggingCB</tabstop> +</tabstops> +<slots> + <slot access="protected">setPreviewPixmap(bool)</slot> + <slot access="protected">showWallpaperPixmap(const QString &)</slot> + <slot>changed()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/ksirc/KSPrefs/page_irccolors.cpp b/ksirc/KSPrefs/page_irccolors.cpp new file mode 100644 index 00000000..aa6ff351 --- /dev/null +++ b/ksirc/KSPrefs/page_irccolors.cpp @@ -0,0 +1,181 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "page_irccolors.h" + +#include <qcheckbox.h> +#include <qlabel.h> +#include <kconfig.h> +#include <kcolorbutton.h> + +PageIRCColors::PageIRCColors( QWidget *parent, const char *name ) : PageIRCColorsBase( parent, name) +{ +} + +PageIRCColors::~PageIRCColors() +{ +} + +void PageIRCColors::saveConfig() +{ + ksopts->ircColors[0] = CBtn_0->color(); + ksopts->ircColors[1] = CBtn_1->color(); + ksopts->ircColors[2] = CBtn_2->color(); + ksopts->ircColors[3] = CBtn_3->color(); + ksopts->ircColors[4] = CBtn_4->color(); + ksopts->ircColors[5] = CBtn_5->color(); + ksopts->ircColors[6] = CBtn_6->color(); + ksopts->ircColors[7] = CBtn_7->color(); + ksopts->ircColors[8] = CBtn_8->color(); + ksopts->ircColors[9] = CBtn_9->color(); + ksopts->ircColors[10] = CBtn_10->color(); + ksopts->ircColors[11] = CBtn_11->color(); + ksopts->ircColors[12] = CBtn_12->color(); + ksopts->ircColors[13] = CBtn_13->color(); + ksopts->ircColors[14] = CBtn_14->color(); + ksopts->ircColors[15] = CBtn_15->color(); + + ksopts->nickHighlight[0] = CBox_0->isChecked(); + ksopts->nickHighlight[1] = CBox_1->isChecked(); + ksopts->nickHighlight[2] = CBox_2->isChecked(); + ksopts->nickHighlight[3] = CBox_3->isChecked(); + ksopts->nickHighlight[4] = CBox_4->isChecked(); + ksopts->nickHighlight[5] = CBox_5->isChecked(); + ksopts->nickHighlight[6] = CBox_6->isChecked(); + ksopts->nickHighlight[7] = CBox_7->isChecked(); + ksopts->nickHighlight[8] = CBox_8->isChecked(); + ksopts->nickHighlight[9] = CBox_9->isChecked(); + ksopts->nickHighlight[10] = CBox_10->isChecked(); + ksopts->nickHighlight[11] = CBox_11->isChecked(); + ksopts->nickHighlight[12] = CBox_12->isChecked(); + ksopts->nickHighlight[13] = CBox_13->isChecked(); + ksopts->nickHighlight[14] = CBox_14->isChecked(); + ksopts->nickHighlight[15] = CBox_15->isChecked(); + + +} + +void PageIRCColors::readConfig( const KSOColors *opts ) +{ + CBtn_0->setColor(opts->ircColors[0]); + CBtn_1->setColor(opts->ircColors[1]); + CBtn_2->setColor(opts->ircColors[2]); + CBtn_3->setColor(opts->ircColors[3]); + CBtn_4->setColor(opts->ircColors[4]); + CBtn_5->setColor(opts->ircColors[5]); + CBtn_6->setColor(opts->ircColors[6]); + CBtn_7->setColor(opts->ircColors[7]); + CBtn_8->setColor(opts->ircColors[8]); + CBtn_9->setColor(opts->ircColors[9]); + CBtn_10->setColor(opts->ircColors[10]); + CBtn_11->setColor(opts->ircColors[11]); + CBtn_12->setColor(opts->ircColors[12]); + CBtn_13->setColor(opts->ircColors[13]); + CBtn_14->setColor(opts->ircColors[14]); + CBtn_15->setColor(opts->ircColors[15]); + + CBox_0->setChecked(opts->nickHighlight[0]); + CBox_1->setChecked(opts->nickHighlight[1]); + CBox_2->setChecked(opts->nickHighlight[2]); + CBox_3->setChecked(opts->nickHighlight[3]); + CBox_4->setChecked(opts->nickHighlight[4]); + CBox_5->setChecked(opts->nickHighlight[5]); + CBox_6->setChecked(opts->nickHighlight[6]); + CBox_7->setChecked(opts->nickHighlight[7]); + CBox_8->setChecked(opts->nickHighlight[8]); + CBox_9->setChecked(opts->nickHighlight[9]); + CBox_10->setChecked(opts->nickHighlight[10]); + CBox_11->setChecked(opts->nickHighlight[11]); + CBox_12->setChecked(opts->nickHighlight[12]); + CBox_13->setChecked(opts->nickHighlight[13]); + CBox_14->setChecked(opts->nickHighlight[14]); + CBox_15->setChecked(opts->nickHighlight[15]); + + TL_0->setPaletteBackgroundColor(opts->backgroundColor); + TL_1->setPaletteBackgroundColor(opts->backgroundColor); + TL_2->setPaletteBackgroundColor(opts->backgroundColor); + TL_3->setPaletteBackgroundColor(opts->backgroundColor); + TL_4->setPaletteBackgroundColor(opts->backgroundColor); + TL_5->setPaletteBackgroundColor(opts->backgroundColor); + TL_6->setPaletteBackgroundColor(opts->backgroundColor); + TL_7->setPaletteBackgroundColor(opts->backgroundColor); + TL_8->setPaletteBackgroundColor(opts->backgroundColor); + TL_9->setPaletteBackgroundColor(opts->backgroundColor); + TL_10->setPaletteBackgroundColor(opts->backgroundColor); + TL_11->setPaletteBackgroundColor(opts->backgroundColor); + TL_12->setPaletteBackgroundColor(opts->backgroundColor); + TL_13->setPaletteBackgroundColor(opts->backgroundColor); + TL_14->setPaletteBackgroundColor(opts->backgroundColor); + TL_15->setPaletteBackgroundColor(opts->backgroundColor); + + TL_0->setPaletteForegroundColor(opts->ircColors[0]); + TL_1->setPaletteForegroundColor(opts->ircColors[1]); + TL_2->setPaletteForegroundColor(opts->ircColors[2]); + TL_3->setPaletteForegroundColor(opts->ircColors[3]); + TL_4->setPaletteForegroundColor(opts->ircColors[4]); + TL_5->setPaletteForegroundColor(opts->ircColors[5]); + TL_6->setPaletteForegroundColor(opts->ircColors[6]); + TL_7->setPaletteForegroundColor(opts->ircColors[7]); + TL_8->setPaletteForegroundColor(opts->ircColors[8]); + TL_9->setPaletteForegroundColor(opts->ircColors[9]); + TL_10->setPaletteForegroundColor(opts->ircColors[10]); + TL_11->setPaletteForegroundColor(opts->ircColors[11]); + TL_12->setPaletteForegroundColor(opts->ircColors[12]); + TL_13->setPaletteForegroundColor(opts->ircColors[13]); + TL_14->setPaletteForegroundColor(opts->ircColors[14]); + TL_15->setPaletteForegroundColor(opts->ircColors[15]); + + TL_0->setFont(ksopts->defaultFont); + TL_1->setFont(ksopts->defaultFont); + TL_2->setFont(ksopts->defaultFont); + TL_3->setFont(ksopts->defaultFont); + TL_4->setFont(ksopts->defaultFont); + TL_5->setFont(ksopts->defaultFont); + TL_6->setFont(ksopts->defaultFont); + TL_7->setFont(ksopts->defaultFont); + TL_8->setFont(ksopts->defaultFont); + TL_9->setFont(ksopts->defaultFont); + TL_10->setFont(ksopts->defaultFont); + TL_11->setFont(ksopts->defaultFont); + TL_12->setFont(ksopts->defaultFont); + TL_13->setFont(ksopts->defaultFont); + TL_14->setFont(ksopts->defaultFont); + TL_15->setFont(ksopts->defaultFont); +} + +void PageIRCColors::defaultConfig() +{ + KSOColors opts; + readConfig( &opts ); +} + +void PageIRCColors::changed() +{ + TL_0->setPaletteForegroundColor(CBtn_0->color()); + TL_1->setPaletteForegroundColor(CBtn_1->color()); + TL_2->setPaletteForegroundColor(CBtn_2->color()); + TL_3->setPaletteForegroundColor(CBtn_3->color()); + TL_4->setPaletteForegroundColor(CBtn_4->color()); + TL_5->setPaletteForegroundColor(CBtn_5->color()); + TL_6->setPaletteForegroundColor(CBtn_6->color()); + TL_7->setPaletteForegroundColor(CBtn_7->color()); + TL_8->setPaletteForegroundColor(CBtn_8->color()); + TL_9->setPaletteForegroundColor(CBtn_9->color()); + TL_10->setPaletteForegroundColor(CBtn_10->color()); + TL_11->setPaletteForegroundColor(CBtn_11->color()); + TL_12->setPaletteForegroundColor(CBtn_12->color()); + TL_13->setPaletteForegroundColor(CBtn_13->color()); + TL_14->setPaletteForegroundColor(CBtn_14->color()); + TL_15->setPaletteForegroundColor(CBtn_15->color()); + emit modified(); +} + + +#include "page_irccolors.moc" + diff --git a/ksirc/KSPrefs/page_irccolors.h b/ksirc/KSPrefs/page_irccolors.h new file mode 100644 index 00000000..a34045c3 --- /dev/null +++ b/ksirc/KSPrefs/page_irccolors.h @@ -0,0 +1,40 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef PAGE_IRCCOLORS_H +#define PAGE_IRCCOLORS_H + +#include "page_irccolorsbase.h" +#include "ksopts.h" + +class PageIRCColors : public PageIRCColorsBase +{ +Q_OBJECT + +public: + PageIRCColors( QWidget *parent = 0, const char *name = 0 ); + ~PageIRCColors(); + + void saveConfig(); + void defaultConfig(); + void readConfig( const KSOColors * = ksopts ); + +protected slots: + void changed(); + +public slots: + +signals: + void modified(); + +private: + +}; + +#endif diff --git a/ksirc/KSPrefs/page_irccolorsbase.ui b/ksirc/KSPrefs/page_irccolorsbase.ui new file mode 100644 index 00000000..96fc18cc --- /dev/null +++ b/ksirc/KSPrefs/page_irccolorsbase.ui @@ -0,0 +1,1275 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>PageIRCColorsBase</class> +<widget class="QWidget"> + <property name="name"> + <cstring>PageIRCColorsBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>429</width> + <height>552</height> + </rect> + </property> + <property name="caption"> + <string>IRC Colors</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel5</cstring> + </property> + <property name="text"> + <string><p>This selection allows you to control what the colors displayed inline in the channel look like. These colors are used for both mIRC style colors in channels and colorful nicks. The sample box beside the button gives you an example of what it will look like in the channel. The checkbox controls if the color is used for the colorful nick features. Checked means use it.</p></string> + </property> + </widget> + <widget class="QTabWidget"> + <property name="name"> + <cstring>tabWidget</cstring> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>dark</cstring> + </property> + <attribute name="title"> + <string>Dark Colors</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox16</cstring> + </property> + <property name="title"> + <string>Dark Colors</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>genericTextLabel_2</cstring> + </property> + <property name="text"> + <string>Black:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="KColorButton" row="1" column="1"> + <property name="name"> + <cstring>CBtn_1</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QLabel" row="1" column="2"> + <property name="name"> + <cstring>TL_1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>LineEditPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="text"> + <string><p align="center">Black</p></string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>genericTextLabel</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>White:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="KColorButton" row="0" column="1"> + <property name="name"> + <cstring>CBtn_0</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QLabel" row="0" column="2"> + <property name="name"> + <cstring>TL_0</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>3</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>LineEditPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="text"> + <string><p align="center">White</p></string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>genericTextLabel_3</cstring> + </property> + <property name="text"> + <string>Dark blue:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="KColorButton" row="2" column="1"> + <property name="name"> + <cstring>CBtn_2</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QLabel" row="2" column="2"> + <property name="name"> + <cstring>TL_2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>LineEditPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="text"> + <string><p align="center">Dark Blue</p></string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>genericTextLabel_5</cstring> + </property> + <property name="text"> + <string>Red:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="KColorButton" row="4" column="1"> + <property name="name"> + <cstring>CBtn_4</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QLabel" row="4" column="2"> + <property name="name"> + <cstring>TL_4</cstring> + </property> + <property name="frameShape"> + <enum>LineEditPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="text"> + <string><p align="center">Red</p></string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>genericTextLabel_4</cstring> + </property> + <property name="text"> + <string>Dark green:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="KColorButton" row="3" column="1"> + <property name="name"> + <cstring>CBtn_3</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QLabel" row="3" column="2"> + <property name="name"> + <cstring>TL_3</cstring> + </property> + <property name="frameShape"> + <enum>LineEditPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="text"> + <string><p align="center">Dark Green</p></string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="QLabel" row="5" column="0"> + <property name="name"> + <cstring>genericTextLabel_6</cstring> + </property> + <property name="text"> + <string>Brown:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="KColorButton" row="5" column="1"> + <property name="name"> + <cstring>CBtn_5</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QLabel" row="5" column="2"> + <property name="name"> + <cstring>TL_5</cstring> + </property> + <property name="frameShape"> + <enum>LineEditPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="text"> + <string><p align="center">Brown</p></string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="QLabel" row="6" column="0"> + <property name="name"> + <cstring>genericTextLabel_7</cstring> + </property> + <property name="text"> + <string>Magenta:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="KColorButton" row="6" column="1"> + <property name="name"> + <cstring>CBtn_6</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QLabel" row="6" column="2"> + <property name="name"> + <cstring>TL_6</cstring> + </property> + <property name="frameShape"> + <enum>LineEditPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="text"> + <string><p align="center">Magenta</p></string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="QLabel" row="7" column="0"> + <property name="name"> + <cstring>genericTextLabel_8</cstring> + </property> + <property name="text"> + <string>Orange:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="KColorButton" row="7" column="1"> + <property name="name"> + <cstring>CBtn_7</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QLabel" row="7" column="2"> + <property name="name"> + <cstring>TL_7</cstring> + </property> + <property name="frameShape"> + <enum>LineEditPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="text"> + <string><p align="center">Orange<p></string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="QCheckBox" row="0" column="3"> + <property name="name"> + <cstring>CBox_0</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="3"> + <property name="name"> + <cstring>CBox_1</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="3"> + <property name="name"> + <cstring>CBox_2</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QCheckBox" row="3" column="3"> + <property name="name"> + <cstring>CBox_3</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QCheckBox" row="4" column="3"> + <property name="name"> + <cstring>CBox_4</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QCheckBox" row="5" column="3"> + <property name="name"> + <cstring>CBox_5</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QCheckBox" row="6" column="3"> + <property name="name"> + <cstring>CBox_6</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QCheckBox" row="7" column="3"> + <property name="name"> + <cstring>CBox_7</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </grid> + </widget> + <spacer> + <property name="name"> + <cstring>spacer10</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>31</width> + <height>41</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>light</cstring> + </property> + <attribute name="title"> + <string>Light Colors</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>ircColorsGB</cstring> + </property> + <property name="frameShape"> + <enum>GroupBoxPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="title"> + <string>IRC Channel Colors</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>genericTextLabel_11</cstring> + </property> + <property name="text"> + <string>Dark cyan:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>genericTextLabel_12</cstring> + </property> + <property name="text"> + <string>Cyan:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>genericTextLabel_13</cstring> + </property> + <property name="text"> + <string>Blue:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="QLabel" row="5" column="0"> + <property name="name"> + <cstring>genericTextLabel_14</cstring> + </property> + <property name="text"> + <string>Purple:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="QLabel" row="6" column="0"> + <property name="name"> + <cstring>genericTextLabel_15</cstring> + </property> + <property name="text"> + <string>Gray:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="QLabel" row="7" column="0"> + <property name="name"> + <cstring>genericTextLabel_16</cstring> + </property> + <property name="text"> + <string>Light gray:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="KColorButton" row="0" column="1"> + <property name="name"> + <cstring>CBtn_8</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton" row="1" column="1"> + <property name="name"> + <cstring>CBtn_9</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton" row="2" column="1"> + <property name="name"> + <cstring>CBtn_10</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton" row="3" column="1"> + <property name="name"> + <cstring>CBtn_11</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton" row="4" column="1"> + <property name="name"> + <cstring>CBtn_12</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton" row="5" column="1"> + <property name="name"> + <cstring>CBtn_13</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton" row="6" column="1"> + <property name="name"> + <cstring>CBtn_14</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton" row="7" column="1"> + <property name="name"> + <cstring>CBtn_15</cstring> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>genericTextLabel_10</cstring> + </property> + <property name="text"> + <string>Green:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="2"> + <property name="name"> + <cstring>TL_8</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>LineEditPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="text"> + <string><p align="center">Yellow</p></string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="2"> + <property name="name"> + <cstring>TL_9</cstring> + </property> + <property name="frameShape"> + <enum>LineEditPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="text"> + <string><p align="center">Green</p></string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="QLabel" row="3" column="2"> + <property name="name"> + <cstring>TL_11</cstring> + </property> + <property name="frameShape"> + <enum>LineEditPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="text"> + <string><p align="center">Cyan</p></string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="QLabel" row="2" column="2"> + <property name="name"> + <cstring>TL_10</cstring> + </property> + <property name="frameShape"> + <enum>LineEditPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="text"> + <string><p align="center">Dark Cyan</p></string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="QLabel" row="4" column="2"> + <property name="name"> + <cstring>TL_12</cstring> + </property> + <property name="frameShape"> + <enum>LineEditPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="text"> + <string><p align="center">Blue</p></string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="QLabel" row="5" column="2"> + <property name="name"> + <cstring>TL_13</cstring> + </property> + <property name="frameShape"> + <enum>LineEditPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="text"> + <string><p align="center">Purple</p></string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="QLabel" row="6" column="2"> + <property name="name"> + <cstring>TL_14</cstring> + </property> + <property name="frameShape"> + <enum>LineEditPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="text"> + <string><p align="center">Gray</p></string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="QLabel" row="7" column="2"> + <property name="name"> + <cstring>TL_15</cstring> + </property> + <property name="frameShape"> + <enum>LineEditPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="text"> + <string><p align="center">Light Gray</p></string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + <widget class="QCheckBox" row="0" column="3"> + <property name="name"> + <cstring>CBox_8</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="3"> + <property name="name"> + <cstring>CBox_9</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="3"> + <property name="name"> + <cstring>CBox_10</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QCheckBox" row="3" column="3"> + <property name="name"> + <cstring>CBox_11</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QCheckBox" row="4" column="3"> + <property name="name"> + <cstring>CBox_12</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QCheckBox" row="5" column="3"> + <property name="name"> + <cstring>CBox_13</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QCheckBox" row="6" column="3"> + <property name="name"> + <cstring>CBox_14</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QCheckBox" row="7" column="3"> + <property name="name"> + <cstring>CBox_15</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>genericTextLabel_9</cstring> + </property> + <property name="text"> + <string>Yellow:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>genericTextCBtn</cstring> + </property> + </widget> + </grid> + </widget> + <spacer> + <property name="name"> + <cstring>spacer14</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>121</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>CBtn_8</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBtn_9</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBtn_10</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBtn_11</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBtn_12</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBtn_13</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBtn_14</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBtn_15</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBtn_0</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBtn_1</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBtn_2</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBtn_3</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBtn_4</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBtn_5</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBtn_6</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBtn_7</sender> + <signal>changed(const QColor&)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBox_0</sender> + <signal>stateChanged(int)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBox_1</sender> + <signal>stateChanged(int)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBox_2</sender> + <signal>stateChanged(int)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBox_3</sender> + <signal>stateChanged(int)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBox_4</sender> + <signal>stateChanged(int)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBox_5</sender> + <signal>stateChanged(int)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBox_6</sender> + <signal>stateChanged(int)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBox_7</sender> + <signal>stateChanged(int)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBox_8</sender> + <signal>stateChanged(int)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBox_9</sender> + <signal>stateChanged(int)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBox_10</sender> + <signal>stateChanged(int)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBox_11</sender> + <signal>stateChanged(int)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBox_12</sender> + <signal>stateChanged(int)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBox_13</sender> + <signal>stateChanged(int)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBox_14</sender> + <signal>stateChanged(int)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>CBox_15</sender> + <signal>stateChanged(int)</signal> + <receiver>PageIRCColorsBase</receiver> + <slot>changed()</slot> + </connection> +</connections> +<slots> + <slot>chanaged()</slot> + <slot>changed()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> +</includehints> +</UI> diff --git a/ksirc/KSPrefs/page_looknfeel.cpp b/ksirc/KSPrefs/page_looknfeel.cpp new file mode 100644 index 00000000..931a897c --- /dev/null +++ b/ksirc/KSPrefs/page_looknfeel.cpp @@ -0,0 +1,72 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <qlabel.h> +#include <qradiobutton.h> +#include <qcheckbox.h> + +#include <kstandarddirs.h> +#include <kurlrequester.h> +#include <kfiledialog.h> +#include "page_looknfeel.h" + +PageLooknFeel::PageLooknFeel( QWidget *parent, const char *name ) : PageLooknFeelBase( parent, name) +{ + modePreview->setPixmap(QPixmap(locate("data","ksirc/pics/sdi.png"))); + wallpaperPathLE->fileDialog()->setFilter( "*.jpg *.png *.gif" ); +} + +PageLooknFeel::~PageLooknFeel() +{ +} + +void PageLooknFeel::saveConfig() +{ + if ( mdiCB->isChecked() ) ksopts->displayMode = KSOptions::MDI; + if ( sdiCB->isChecked() ) ksopts->displayMode = KSOptions::SDI; + + ksopts->backgroundFile = wallpaperPathLE->url(); + +} + +void PageLooknFeel::readConfig( const KSOGeneral *opts ) +{ + if ( opts->displayMode == KSOptions::MDI ) + mdiCB->setChecked( true ); + else + sdiCB->setChecked( true ); + + wallpaperPathLE->setURL( opts->backgroundFile ); +} + +void PageLooknFeel::defaultConfig() +{ + KSOGeneral opts; + readConfig( &opts ); +} + +void PageLooknFeel::setPreviewPixmap( bool isSDI ) +{ + if (isSDI == true) + modePreview->setPixmap( QPixmap( locate("data", "ksirc/pics/sdi.png" ) ) ); + else + modePreview->setPixmap( QPixmap( locate("data", "ksirc/pics/mdi.png" ) ) ); +} + +void PageLooknFeel::showWallpaperPixmap( const QString &url ) +{ + wallpaperPreview->setPixmap( QPixmap( url ) ); +} + +void PageLooknFeel::changed() +{ + emit modified(); +} + +#include "page_looknfeel.moc" diff --git a/ksirc/KSPrefs/page_looknfeel.h b/ksirc/KSPrefs/page_looknfeel.h new file mode 100644 index 00000000..a5c7f96f --- /dev/null +++ b/ksirc/KSPrefs/page_looknfeel.h @@ -0,0 +1,37 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef PAGE_LOOKNFEEL_H +#define PAGE_LOOKNFEEL_H + +#include "page_looknfeelbase.h" +#include "ksopts.h" + +class PageLooknFeel : public PageLooknFeelBase +{ +Q_OBJECT + +public: + PageLooknFeel( QWidget *parent = 0, const char *name = 0 ); + ~PageLooknFeel(); + + void saveConfig(); + void defaultConfig(); + void readConfig( const KSOGeneral * = ksopts ); + +signals: + void modified(); + +public slots: + virtual void setPreviewPixmap( bool isSDI ); + virtual void showWallpaperPixmap( const QString &url ); + virtual void changed(); +}; + +#endif diff --git a/ksirc/KSPrefs/page_looknfeelbase.ui b/ksirc/KSPrefs/page_looknfeelbase.ui new file mode 100644 index 00000000..6aee3a14 --- /dev/null +++ b/ksirc/KSPrefs/page_looknfeelbase.ui @@ -0,0 +1,323 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>PageLooknFeelBase</class> +<widget class="QFrame"> + <property name="name"> + <cstring>PageLooknFeelBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>425</width> + <height>452</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>425</width> + <height>450</height> + </size> + </property> + <property name="caption"> + <string>LooknFeel</string> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Plain</enum> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>windowModeGB</cstring> + </property> + <property name="frameShape"> + <enum>Box</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="title"> + <string>Window Mode</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer row="4" column="0"> + <property name="name"> + <cstring>Spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>31</height> + </size> + </property> + </spacer> + <widget class="QRadioButton" row="3" column="0"> + <property name="name"> + <cstring>mdiCB</cstring> + </property> + <property name="text"> + <string>&Paged MDI mode (XChat)</string> + </property> + <property name="checked"> + <bool>false</bool> + </property> + <property name="buttonGroupId"> + <number>0</number> + </property> + </widget> + <spacer row="1" column="0"> + <property name="name"> + <cstring>Spacer1_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>31</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>wmLabel</cstring> + </property> + <property name="text"> + <string>Choose your favorite window mode:</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter|AlignLeft</set> + </property> + <property name="vAlign" stdset="0"> + </property> + <property name="wordwrap" stdset="0"> + </property> + </widget> + <widget class="QRadioButton" row="2" column="0"> + <property name="name"> + <cstring>sdiCB</cstring> + </property> + <property name="text"> + <string>&SDI mode (old behavior)</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="buttonGroupId"> + <number>0</number> + </property> + </widget> + <widget class="QFrame" row="1" column="1" rowspan="4" colspan="1"> + <property name="name"> + <cstring>Frame3</cstring> + </property> + <property name="minimumSize"> + <size> + <width>120</width> + <height>120</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>120</width> + <height>120</height> + </size> + </property> + <property name="frameShape"> + <enum>StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>modePreview</cstring> + </property> + <property name="geometry"> + <rect> + <x>10</x> + <y>10</y> + <width>100</width> + <height>100</height> + </rect> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + </widget> + </widget> + </grid> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>wallpaperGB</cstring> + </property> + <property name="title"> + <string>Wallpaper</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout4</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="KURLRequester"> + <property name="name"> + <cstring>wallpaperPathLE</cstring> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>25</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>30</height> + </size> + </property> + </widget> + </hbox> + </widget> + <widget class="QFrame"> + <property name="name"> + <cstring>Frame3_2</cstring> + </property> + <property name="minimumSize"> + <size> + <width>120</width> + <height>120</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>120</width> + <height>120</height> + </size> + </property> + <property name="frameShape"> + <enum>StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>wallpaperPreview</cstring> + </property> + <property name="geometry"> + <rect> + <x>10</x> + <y>10</y> + <width>100</width> + <height>100</height> + </rect> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + </widget> + </widget> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer5</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>51</width> + <height>1</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<connections> + <connection> + <sender>sdiCB</sender> + <signal>clicked()</signal> + <receiver>PageLooknFeelBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>sdiCB</sender> + <signal>toggled(bool)</signal> + <receiver>PageLooknFeelBase</receiver> + <slot>setPreviewPixmap(bool)</slot> + </connection> + <connection> + <sender>mdiCB</sender> + <signal>clicked()</signal> + <receiver>PageLooknFeelBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>wallpaperPathLE</sender> + <signal>textChanged(const QString &)</signal> + <receiver>PageLooknFeelBase</receiver> + <slot>showWallpaperPixmap(const QString&)</slot> + </connection> + <connection> + <sender>wallpaperPathLE</sender> + <signal>textChanged(const QString &)</signal> + <receiver>PageLooknFeelBase</receiver> + <slot>changed()</slot> + </connection> +</connections> +<tabstops> + <tabstop>sdiCB</tabstop> + <tabstop>wallpaperPathLE</tabstop> +</tabstops> +<slots> + <slot access="protected">setPreviewPixmap(bool)</slot> + <slot access="protected">showWallpaperPixmap(const QString &)</slot> + <slot>changed()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kurlrequester.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/ksirc/KSPrefs/page_rmbmenu.cpp b/ksirc/KSPrefs/page_rmbmenu.cpp new file mode 100644 index 00000000..7baf5da5 --- /dev/null +++ b/ksirc/KSPrefs/page_rmbmenu.cpp @@ -0,0 +1,206 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License. + * * + ***************************************************************************/ + +#include "page_rmbmenu.h" + +#include <qcheckbox.h> +#include <qlabel.h> +#include <qlineedit.h> +#include <qlistbox.h> +#include <qpushbutton.h> + +#include <kdebug.h> + +#include "../usercontrolmenu.h" + + + +PageRMBMenu::PageRMBMenu( QWidget *parent, const char *name ) : PageRMBMenuBase( parent, name) +{ + UserControlMenu *ucm; + + UserControlMenu::parseKConfig(); + + commandLB->clear(); + for(ucm = UserControlMenu::UserMenu.first(); + ucm != 0; + ucm = UserControlMenu::UserMenu.next()){ + + if(ucm->type == UserControlMenu::Seperator){ + commandLB->insertItem("--------------", -1); + } + else{ + commandLB->insertItem(ucm->title, -1); + } + } + + changeItemPB->hide(); + + connect(commandLB, SIGNAL(highlighted( int )), + this, SLOT(highlighted( int ))); + connect(moveUpPB, SIGNAL(clicked()), + this, SLOT(moveDown())); + connect(moveDownPB, SIGNAL(clicked()), + this, SLOT(moveUp())); + + connect(insertSeperatorPB, SIGNAL(clicked()), + this, SLOT(insSeperator())); + + connect(insertItemPB, SIGNAL(clicked()), + this, SLOT(insCommand())); + + connect(deleteItemPB, SIGNAL(clicked()), + this, SLOT(delCommand())); + +} + +PageRMBMenu::~PageRMBMenu() +{ +} + +void PageRMBMenu::saveConfig() +{ + UserControlMenu::writeKConfig(); +} + +void PageRMBMenu::readConfig( const KSORMBMenu * ) +{ +} + +void PageRMBMenu::defaultConfig() +{ +} + +void PageRMBMenu::highlighted(int index) +{ + UserControlMenu *ucm; + + ucm = UserControlMenu::UserMenu.at(index); + + if(ucm == 0) + return; + + if(ucm->type == UserControlMenu::Seperator){ + entryLE->setEnabled(false); + commandLE->setEnabled(false); + opEnableCB->setEnabled(false); + opEnableCB->setChecked(false); + changeItemPB->setEnabled(false); + } + else{ + entryLE->setEnabled(true); + commandLE->setEnabled(true); + opEnableCB->setEnabled(true); + opEnableCB->setChecked(true); + changeItemPB->setEnabled(true); + + entryLE->setText(ucm->title); + commandLE->setText(ucm->action); + opEnableCB->setChecked(ucm->op_only); + } + + if(index == 0){ + moveUpPB->setEnabled(true); + moveDownPB->setEnabled(false); + } + else if((uint)index == (commandLB->count()-1)){ + moveUpPB->setEnabled(false); + moveDownPB->setEnabled(true); + } + else { + moveUpPB->setEnabled(true); + moveDownPB->setEnabled(true); + } +} + +void PageRMBMenu::moveUp() +{ + int item = commandLB->currentItem(); + + QString txt = commandLB->text(item); + commandLB->removeItem(item); + + commandLB->insertItem(txt, item-1); + commandLB->setCurrentItem(item-1); + + UserControlMenu *ucm = UserControlMenu::UserMenu.take(item); + UserControlMenu::UserMenu.insert(item-1,ucm); + + highlighted(item-1); + emit modified(); +} + +void PageRMBMenu::moveDown() +{ + int item = commandLB->currentItem(); + + QString txt = commandLB->text(item); + commandLB->removeItem(item); + + commandLB->insertItem(txt, item+1); + commandLB->setCurrentItem(item+1); + + UserControlMenu *ucm = UserControlMenu::UserMenu.take(item); + UserControlMenu::UserMenu.insert(item+1,ucm); + + highlighted(item+1); + emit modified(); +} + +void PageRMBMenu::insSeperator() +{ + int item = commandLB->currentItem(); + + QString txt = commandLB->text(item); + + commandLB->insertItem("--------------", item); + commandLB->setCurrentItem(item); + + UserControlMenu::UserMenu.insert(item,new UserControlMenu); // Defaults to a separator + + highlighted(item); + emit modified(); +} + +void PageRMBMenu::insCommand() +{ + int item = commandLB->currentItem(); + + QString te = entryLE->text(); + QString ce = commandLE->text(); + + commandLB->insertItem(te, item); + commandLB->setCurrentItem(item); + + UserControlMenu::UserMenu.insert(item, + new UserControlMenu( + te, + ce, + 0x0, + UserControlMenu::Text + )); // Defaults to a separator + + highlighted(item); + emit modified(); +} + +void PageRMBMenu::delCommand() +{ + int item = commandLB->currentItem(); + + QString txt = commandLB->text(item); + commandLB->removeItem(item); + + UserControlMenu::UserMenu.remove(item); + + highlighted(item); + emit modified(); +} + + +#include "page_rmbmenu.moc" diff --git a/ksirc/KSPrefs/page_rmbmenu.h b/ksirc/KSPrefs/page_rmbmenu.h new file mode 100644 index 00000000..cb1de421 --- /dev/null +++ b/ksirc/KSPrefs/page_rmbmenu.h @@ -0,0 +1,38 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef PAGE_RMBMENU_H +#define PAGE_RMBMENU_H + +#include "page_rmbmenubase.h" +#include "ksopts.h" + +class PageRMBMenu : public PageRMBMenuBase +{ +Q_OBJECT + +public: + PageRMBMenu( QWidget *parent = 0, const char *name = 0 ); + ~PageRMBMenu(); + + void saveConfig(); + void defaultConfig(); + void readConfig( const KSORMBMenu * = ksopts ); +protected slots: + void highlighted(int); + void moveUp(); + void moveDown(); + void insSeperator(); + void insCommand(); + void delCommand(); +signals: + void modified(); +}; + +#endif diff --git a/ksirc/KSPrefs/page_rmbmenubase.ui b/ksirc/KSPrefs/page_rmbmenubase.ui new file mode 100644 index 00000000..1ef1e053 --- /dev/null +++ b/ksirc/KSPrefs/page_rmbmenubase.ui @@ -0,0 +1,252 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>PageRMBMenuBase</class> +<widget class="QWidget"> + <property name="name"> + <cstring>PageRMBMenuBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>399</width> + <height>465</height> + </rect> + </property> + <property name="caption"> + <string>Nick Option Menu</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>explLabel</cstring> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>32767</height> + </size> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Plain</enum> + </property> + <property name="text"> + <string>This page allows configuration of the RMB Menu for the nicklist located on the right. You can define names for certain actions. Look at the predefined commands to learn how it works.</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter|AlignLeft</set> + </property> + <property name="buddy" stdset="0"> + <cstring></cstring> + </property> + <property name="wordwrap" stdset="0"> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout28</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QListBox"> + <property name="name"> + <cstring>commandLB</cstring> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout26</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>entryNameLabel</cstring> + </property> + <property name="text"> + <string>&Entry name:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>entryLE</cstring> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>entryLE</cstring> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>commandLabel</cstring> + </property> + <property name="text"> + <string>Associated co&mmand:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>commandLE</cstring> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>commandLE</cstring> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>opEnableCB</cstring> + </property> + <property name="text"> + <string>Onl&y enable on Op status</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer4</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout24</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>moveUpPB</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string>Move Down</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>moveDownPB</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string>Move Up</string> + </property> + </widget> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer5</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>10</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>insertSeperatorPB</cstring> + </property> + <property name="text"> + <string>Insert &Separator</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>insertItemPB</cstring> + </property> + <property name="text"> + <string>&Insert Command</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>changeItemPB</cstring> + </property> + <property name="text"> + <string>M&odify</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>deleteItemPB</cstring> + </property> + <property name="text"> + <string>De&lete Selected Command</string> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<includes> + <include location="global" impldecl="in declaration">kseparator.h</include> +</includes> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/ksirc/KSPrefs/page_servchan.cpp b/ksirc/KSPrefs/page_servchan.cpp new file mode 100644 index 00000000..4689bd2a --- /dev/null +++ b/ksirc/KSPrefs/page_servchan.cpp @@ -0,0 +1,135 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "page_servchan.h" + +#include <qlistbox.h> +#include <qlineedit.h> +#include <qpushbutton.h> +#include <kapplication.h> +#include <kconfig.h> + +PageServChan::PageServChan( QWidget *parent, const char *name ) : PageServChanBase( parent, name) +{ + connect(serverDeleteItemPB, SIGNAL(pressed()), this, SLOT(deletePressedSL())); + connect(ServerAddItemPB, SIGNAL(pressed()), this, SLOT(addPressedSL())); + connect(chanDeleteItmPB, SIGNAL(pressed()), this, SLOT(deletePressedCL())); + connect(ChanAddItemPB, SIGNAL(pressed()), this, SLOT(addPressedCL())); + +} + +PageServChan::~PageServChan() +{ +} + +void PageServChan::saveConfig() +{ + QStringList sLB; + uint i; + for(i = 0; i < serverLB->count(); i++){ + QString txt = serverLB->text(i); + if(!txt.isNull()) + sLB << txt; + } + KConfig *conf = kapp->config(); + conf->setGroup("ServerList"); + conf->writeEntry("RecentServers", sLB); + + QStringList sCL; + for(i = 0; i < channelLB->count(); i++){ + QString txt = channelLB->text(i); + if(!txt.isNull()) + sCL << txt; + } + conf->setGroup("Recent"); + conf->writeEntry("Channels", sCL); +} + +void PageServChan::readConfig( const KSOServChan * ) +{ + KConfig *conf = kapp->config(); + conf->setGroup("ServerList"); + QStringList recent = conf->readListEntry("RecentServers"); + recent.sort(); + serverLB->insertStringList(recent); + conf->setGroup("Recent"); + recent = conf->readListEntry("Channels"); + recent.sort(); + channelLB->insertStringList(recent); +} + +void PageServChan::defaultConfig() +{ + readConfig(); +} + +void PageServChan::deletePressedSL() { + int item = serverLB->currentItem(); + if(item >= 0){ + serverLB->removeItem(item); + } + emit modified(); +} + +void PageServChan::addPressedSL() { + uint i; + QString txt = LineEdit6->text(); + + for(i = 0; i < serverLB->count(); i++){ + if(txt == serverLB->text(i)){ + qWarning("Server already in the list!"); + return; + } + } + + serverLB->insertItem(txt); + serverLB->sort(); + LineEdit6->clear(); + emit modified(); + for(i = 0; i < serverLB->count(); i++){ + if(txt == serverLB->text(i)){ + serverLB->setCurrentItem(i); + serverLB->ensureCurrentVisible(); + return; + } + } +} + +void PageServChan::deletePressedCL() { + int item = channelLB->currentItem(); + if(item >= 0){ + channelLB->removeItem(item); + } + emit modified(); +} + +void PageServChan::addPressedCL() { + uint i; + QString txt = LineEdit6_2->text(); + + for(i = 0; i < channelLB->count(); i++){ + if(txt == channelLB->text(i)){ + qWarning("Server already in the list!"); + return; + } + } + + channelLB->insertItem(txt); + channelLB->sort(); + LineEdit6_2->clear(); + emit modified(); + for(i = 0; i < channelLB->count(); i++){ + if(txt == channelLB->text(i)){ + channelLB->setCurrentItem(i); + channelLB->ensureCurrentVisible(); + return; + } + } +} +#include "page_servchan.moc" diff --git a/ksirc/KSPrefs/page_servchan.h b/ksirc/KSPrefs/page_servchan.h new file mode 100644 index 00000000..07429f2b --- /dev/null +++ b/ksirc/KSPrefs/page_servchan.h @@ -0,0 +1,38 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef PAGE_SERVCHAN_H +#define PAGE_SERVCHAN_H + +#include "page_servchanbase.h" +#include "ksopts.h" + +class PageServChan : public PageServChanBase +{ +Q_OBJECT + +public: + PageServChan( QWidget *parent = 0, const char *name = 0 ); + ~PageServChan(); + + void saveConfig(); + void defaultConfig(); + void readConfig( const KSOServChan * = ksopts ); + +signals: + void modified(); + +public slots: + void deletePressedSL(); + void addPressedSL(); + void deletePressedCL(); + void addPressedCL(); +}; + +#endif diff --git a/ksirc/KSPrefs/page_servchanbase.ui b/ksirc/KSPrefs/page_servchanbase.ui new file mode 100644 index 00000000..b24ce9dc --- /dev/null +++ b/ksirc/KSPrefs/page_servchanbase.ui @@ -0,0 +1,172 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>PageServChanBase</class> +<widget class="QWidget"> + <property name="name"> + <cstring>PageServChanBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>382</width> + <height>465</height> + </rect> + </property> + <property name="caption"> + <string>Server/Channels</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox33</cstring> + </property> + <property name="title"> + <string>Server</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QListBox"> + <property name="name"> + <cstring>serverLB</cstring> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout15</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>serverDeleteItemPB</cstring> + </property> + <property name="text"> + <string>De&lete Server From List</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>ServerAddItemPB</cstring> + </property> + <property name="text"> + <string>Add &Server to List</string> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>LineEdit6</cstring> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox34</cstring> + </property> + <property name="title"> + <string>Channels</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QListBox"> + <property name="name"> + <cstring>channelLB</cstring> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout15_2</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>chanDeleteItmPB</cstring> + </property> + <property name="text"> + <string>D&elete Channel From List</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer2_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>ChanAddItemPB</cstring> + </property> + <property name="text"> + <string>Add Cha&nnel to List</string> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>LineEdit6_2</cstring> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/ksirc/KSPrefs/page_shortcuts.cpp b/ksirc/KSPrefs/page_shortcuts.cpp new file mode 100644 index 00000000..45a83beb --- /dev/null +++ b/ksirc/KSPrefs/page_shortcuts.cpp @@ -0,0 +1,57 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <qlayout.h> +#include <qgroupbox.h> + +#include <kglobalaccel.h> + +#include <kkeydialog.h> +#include "page_shortcuts.h" +#include "../servercontroller.h" + +PageShortcuts::PageShortcuts( QWidget *parent, const char *name ) : PageShortcutsBase( parent, name) +{ + globalGB->setColumnLayout( 0, Qt::Horizontal ); + + m_key = new KKeyChooser(servercontroller::self()->getGlobalAccel(), globalGB); + connect(m_key, SIGNAL(keyChange()), this, SLOT(changed())); + globalGB->layout()->add(m_key); +} + +PageShortcuts::~PageShortcuts() +{ +} + +void PageShortcuts::saveConfig() +{ + m_key->commitChanges(); + servercontroller::self()->getGlobalAccel()->writeSettings(); + servercontroller::self()->getGlobalAccel()->updateConnections(); +} + +void PageShortcuts::readConfig( const KSOGeneral *opts ) +{ + servercontroller::self()->getGlobalAccel()->readSettings(); +} + +void PageShortcuts::defaultConfig() +{ + KSOGeneral opts; + readConfig( &opts ); + m_key->allDefault(); +} + + +void PageShortcuts::changed() +{ + emit modified(); +} + +#include "page_shortcuts.moc" diff --git a/ksirc/KSPrefs/page_shortcuts.h b/ksirc/KSPrefs/page_shortcuts.h new file mode 100644 index 00000000..4c16aa35 --- /dev/null +++ b/ksirc/KSPrefs/page_shortcuts.h @@ -0,0 +1,40 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef PAGE_SHORTCUTS_H +#define PAGE_SHORTCUTS_H + +#include "page_shortcutsbase.h" +#include "ksopts.h" + +class KKeyChooser; + +class PageShortcuts : public PageShortcutsBase +{ +Q_OBJECT + +public: + PageShortcuts( QWidget *parent = 0, const char *name = 0 ); + ~PageShortcuts(); + + void saveConfig(); + void defaultConfig(); + void readConfig( const KSOGeneral * = ksopts ); + +signals: + void modified(); + +public slots: + virtual void changed(); + +private: + KKeyChooser *m_key; +}; + +#endif diff --git a/ksirc/KSPrefs/page_shortcutsbase.ui b/ksirc/KSPrefs/page_shortcutsbase.ui new file mode 100644 index 00000000..57f21647 --- /dev/null +++ b/ksirc/KSPrefs/page_shortcutsbase.ui @@ -0,0 +1,57 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>PageShortcutsBase</class> +<widget class="QFrame"> + <property name="name"> + <cstring>PageShortcutslBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>425</width> + <height>452</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>425</width> + <height>450</height> + </size> + </property> + <property name="caption"> + <string>Shortcuts</string> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Plain</enum> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>globalGB</cstring> + </property> + <property name="title"> + <string>Global Shortcuts</string> + </property> + </widget> + </vbox> +</widget> +<connections> +</connections> +<tabstops> +</tabstops> +<slots> + <slot access="protected">setPreviewPixmap(bool)</slot> + <slot access="protected">showWallpaperPixmap(const QString &)</slot> + <slot>changed()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/ksirc/KSPrefs/page_startup.cpp b/ksirc/KSPrefs/page_startup.cpp new file mode 100644 index 00000000..060da44d --- /dev/null +++ b/ksirc/KSPrefs/page_startup.cpp @@ -0,0 +1,126 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <qlineedit.h> +#include <qpushbutton.h> +#include <qlistbox.h> + +#include <kapplication.h> +#include <kconfig.h> +#include <keditlistbox.h> + +#include <kdebug.h> + +#include "page_startup.h" + +PageStartup::PageStartup( QWidget *parent, const char *name ) : PageStartupBase( parent, name) +{ + notifyLB->upButton()->hide(); + notifyLB->downButton()->hide(); + serverLB->upButton()->hide(); + serverLB->downButton()->hide(); + + QListBox *lb = serverLB->listBox(); + connect(lb, SIGNAL(highlighted(int)), + this, SLOT(clickedLB(int))); + + changing = false; + +} + +PageStartup::~PageStartup() +{ +} + +void PageStartup::saveConfig() +{ + KSOServer glb = ksopts->server["global"]; + QStringList items = serverLB->items(); + + ksopts->server.clear(); + + QStringList::iterator it = items.begin(); + for( ; it != items.end(); ++it){ + ksopts->server[*it] = server[*it]; + } + if(!ksopts->server.contains("global")){ + ksopts->server["global"] = glb; + } + +} + +void PageStartup::readConfig( const KSOptions *opts ) +{ + server = opts->server; + + changing = true; + ServerOpMap::Iterator it; + for ( it = server.begin(); it != server.end(); ++it ) { + if(it.data().globalCopy == false) + serverLB->insertItem(it.key()); + } + QListBoxItem *item = serverLB->listBox()->findItem("global"); + serverLB->listBox()->setSelected(item, true); + changing = false; + clickedLB(serverLB->listBox()->index(item)); + +} + +void PageStartup::defaultConfig() +{ + KSOptions opts; + readConfig( &opts ); +} + +void PageStartup::changed() +{ + emit modified(); + + QString ser = serverLB->currentText(); + if(ser.isEmpty()) + return; + + if(changing) + return; + + kdDebug(5008) << "got changed for: " << ser <<endl; + + server[ser].nick = nickLE->text(); + server[ser].altNick = altNickLE->text(); + server[ser].realName = rnLE->text(); + server[ser].userID = uiLE->text(); + + server[ser].notifyList.clear(); + for ( int i = 0; i < notifyLB->count(); ++i) + server[ser].notifyList.append( notifyLB->text( i ) ); + server[ser].globalCopy = false; + +} + +void PageStartup::clickedLB(int index) +{ + + QString text = serverLB->text(index); + if(!server.contains(text)){ + server[text] = server["global"]; + server[text].globalCopy = true; + } + + changing = true; + notifyLB->clear(); + + nickLE->setText( server[text].nick ); + altNickLE->setText( server[text].altNick ); + rnLE->setText( server[text].realName ); + uiLE->setText( server[text].userID ); + notifyLB->insertStringList( server[text].notifyList ); + changing = false; +} + +#include "page_startup.moc" diff --git a/ksirc/KSPrefs/page_startup.h b/ksirc/KSPrefs/page_startup.h new file mode 100644 index 00000000..ecac8305 --- /dev/null +++ b/ksirc/KSPrefs/page_startup.h @@ -0,0 +1,40 @@ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef PAGE_STARTUP_H +#define PAGE_STARTUP_H + +#include "page_startupbase.h" +#include "ksopts.h" + +class PageStartup : public PageStartupBase +{ +Q_OBJECT + +public: + PageStartup( QWidget *parent = 0, const char *name = 0 ); + ~PageStartup(); + + void saveConfig(); + void defaultConfig(); + void readConfig( const KSOptions * = ksopts ); + +signals: + void modified(); + +protected slots: + void changed(); + void clickedLB(int index); + +private: + ServerOpMap server; + bool changing; +}; + +#endif diff --git a/ksirc/KSPrefs/page_startupbase.ui b/ksirc/KSPrefs/page_startupbase.ui new file mode 100644 index 00000000..1a248806 --- /dev/null +++ b/ksirc/KSPrefs/page_startupbase.ui @@ -0,0 +1,197 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>PageStartupBase</class> +<widget class="QWidget"> + <property name="name"> + <cstring>PageStartupBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>420</width> + <height>578</height> + </rect> + </property> + <property name="caption"> + <string>StartUp</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="KEditListBox"> + <property name="name"> + <cstring>serverLB</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Server</string> + </property> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>nickGB</cstring> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>32767</height> + </size> + </property> + <property name="title"> + <string>Name Settings</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLineEdit" row="0" column="1"> + <property name="name"> + <cstring>nickLE</cstring> + </property> + </widget> + <widget class="QLineEdit" row="1" column="1"> + <property name="name"> + <cstring>altNickLE</cstring> + </property> + </widget> + <widget class="QLineEdit" row="2" column="1"> + <property name="name"> + <cstring>rnLE</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>nickLabel</cstring> + </property> + <property name="text"> + <string>&Nick name:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>nickLE</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>anLabel</cstring> + </property> + <property name="text"> + <string>A&lternative nick:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>altNickLE</cstring> + </property> + </widget> + <widget class="QLineEdit" row="3" column="1"> + <property name="name"> + <cstring>uiLE</cstring> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>uiLabel</cstring> + </property> + <property name="text"> + <string>&User ID:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>rnLE</cstring> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>rnLabel</cstring> + </property> + <property name="text"> + <string>&Real name:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>rnLE</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="KEditListBox"> + <property name="name"> + <cstring>notifyLB</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Notify List</string> + </property> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>nickLE</sender> + <signal>textChanged(const QString&)</signal> + <receiver>PageStartupBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>altNickLE</sender> + <signal>textChanged(const QString&)</signal> + <receiver>PageStartupBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>notifyLB</sender> + <signal>changed()</signal> + <receiver>PageStartupBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>rnLE</sender> + <signal>textChanged(const QString&)</signal> + <receiver>PageStartupBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>uiLE</sender> + <signal>textChanged(const QString&)</signal> + <receiver>PageStartupBase</receiver> + <slot>changed()</slot> + </connection> + <connection> + <sender>serverLB</sender> + <signal>changed()</signal> + <receiver>PageStartupBase</receiver> + <slot>server_changed()</slot> + </connection> +</connections> +<slots> + <slot>changed()</slot> + <slot>server_changed()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>keditlistbox.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>keditlistbox.h</includehint> + <includehint>klineedit.h</includehint> +</includehints> +</UI> |