aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Szymon Tomasz Stefanek2015-09-14 23:34:31 +0200
committerGravatar Szymon Tomasz Stefanek2015-09-14 23:34:31 +0200
commit5a5fc951ad8e17201ce7f4ef1d49fcb55c0209c5 (patch)
tree4fc7cefacf79756b147c166768999a78860d456a /src
parentFix spelling correction offset by one (diff)
downloadKVIrc-5a5fc951ad8e17201ce7f4ef1d49fcb55c0209c5.tar.gz
KVIrc-5a5fc951ad8e17201ce7f4ef1d49fcb55c0209c5.tar.bz2
KVIrc-5a5fc951ad8e17201ce7f4ef1d49fcb55c0209c5.zip
Add the possibility of resetting the IRC colors to default. Also add an informational message about the nature of the colors.
Diffstat (limited to 'src')
-rw-r--r--src/kvilib/ext/KviNickColors.cpp2
-rw-r--r--src/kvirc/ui/KviOptionsWidget.cpp9
-rw-r--r--src/kvirc/ui/KviOptionsWidget.h2
-rw-r--r--src/modules/options/OptionsWidget_message.cpp56
-rw-r--r--src/modules/options/OptionsWidget_message.h5
5 files changed, 55 insertions, 19 deletions
diff --git a/src/kvilib/ext/KviNickColors.cpp b/src/kvilib/ext/KviNickColors.cpp
index 2fd75ea90..63ac11159 100644
--- a/src/kvilib/ext/KviNickColors.cpp
+++ b/src/kvilib/ext/KviNickColors.cpp
@@ -32,6 +32,8 @@ namespace KviNickColors
#define KVI_NUM_NICK_COLORS 95
+ // FIXME: Maybe make this table settable via options?
+ // Or maybe a kvc file...
static const char * g_nickColors[KVI_NUM_NICK_COLORS]=
{
"0,1" ,"0,2" ,"0,3" ,"0,4" ,"0,5" ,"0,6" ,"0,10" ,"0,12" ,"0,14" , //9
diff --git a/src/kvirc/ui/KviOptionsWidget.cpp b/src/kvirc/ui/KviOptionsWidget.cpp
index c787a80dd..18af482ec 100644
--- a/src/kvirc/ui/KviOptionsWidget.cpp
+++ b/src/kvirc/ui/KviOptionsWidget.cpp
@@ -692,6 +692,15 @@ void KviOptionsWidget::addRowSpacer(int x1,int y1,int x2,int y2)
layout()->setRowStretch(y1,1);
}
+QPushButton * KviOptionsWidget::addPushButton(int x1,int y1,int x2,int y2,const QString & text,bool bEnabled)
+{
+ QPushButton * pb = new QPushButton(text,this);
+ pb->setEnabled(bEnabled);
+ addWidgetToLayout(pb,x1,y1,x2,y2);
+ return pb;
+}
+
+
QLabel * KviOptionsWidget::addLabel(int x1,int y1,int x2,int y2,const QString & text,bool bEnabled)
{
QLabel * l = new QLabel(text,this);
diff --git a/src/kvirc/ui/KviOptionsWidget.h b/src/kvirc/ui/KviOptionsWidget.h
index 4df71b0ef..2e8a60cd8 100644
--- a/src/kvirc/ui/KviOptionsWidget.h
+++ b/src/kvirc/ui/KviOptionsWidget.h
@@ -35,6 +35,7 @@
#include <QLayout>
#include <QLineEdit>
#include <QTabWidget>
+#include <QPushButton>
class KVIRC_API KviOptionsWidget : public QFrame, public KviSelectorInterface
{
@@ -135,6 +136,7 @@ public:
QLabel * addLabel(int x1,int y1,int x2,int y2,const QString & text,bool bEnabled = true);
QLabel * addLabel(QWidget * pParent,const QString & text,bool bEnabled = true);
QLineEdit * addLineEdit(int x1,int y1,int x2,int y2,bool bEnabled = true);
+ QPushButton * addPushButton(int x1,int y1,int x2,int y2,const QString & text,bool bEnabled = true);
KviTalGroupBox * addGroupBox(int x1,int y1,int x2,int y2,Qt::Orientation o,const QString &txt,bool bEnabled = true);
QFrame * addSeparator(int x1,int y1,int x2,int y2);
void addRowSpacer(int x1,int y1,int x2,int y2);
diff --git a/src/modules/options/OptionsWidget_message.cpp b/src/modules/options/OptionsWidget_message.cpp
index eae096383..26616f78a 100644
--- a/src/modules/options/OptionsWidget_message.cpp
+++ b/src/modules/options/OptionsWidget_message.cpp
@@ -172,32 +172,52 @@ OptionsWidget_standardColors::OptionsWidget_standardColors(QWidget * parent)
setObjectName("stdcolors");
createLayout();
- addColorSelector(0,0,0,0,"0:",&(KVI_OPTION_MIRCCOLOR(0)));
- addColorSelector(1,0,1,0,"1:",&(KVI_OPTION_MIRCCOLOR(1)));
- addColorSelector(2,0,2,0,"2:",&(KVI_OPTION_MIRCCOLOR(2)));
- addColorSelector(3,0,3,0,"3:",&(KVI_OPTION_MIRCCOLOR(3)));
- addColorSelector(0,1,0,1,"4:",&(KVI_OPTION_MIRCCOLOR(4)));
- addColorSelector(1,1,1,1,"5:",&(KVI_OPTION_MIRCCOLOR(5)));
- addColorSelector(2,1,2,1,"6:",&(KVI_OPTION_MIRCCOLOR(6)));
- addColorSelector(3,1,3,1,"7:",&(KVI_OPTION_MIRCCOLOR(7)));
- addColorSelector(0,2,0,2,"8:",&(KVI_OPTION_MIRCCOLOR(8)));
- addColorSelector(1,2,1,2,"9:",&(KVI_OPTION_MIRCCOLOR(9)));
- addColorSelector(2,2,2,2,"10:",&(KVI_OPTION_MIRCCOLOR(10)));
- addColorSelector(3,2,3,2,"11:",&(KVI_OPTION_MIRCCOLOR(11)));
- addColorSelector(0,3,0,3,"12:",&(KVI_OPTION_MIRCCOLOR(12)));
- addColorSelector(1,3,1,3,"13:",&(KVI_OPTION_MIRCCOLOR(13)));
- addColorSelector(2,3,2,3,"14:",&(KVI_OPTION_MIRCCOLOR(14)));
- addColorSelector(3,3,3,3,"15:",&(KVI_OPTION_MIRCCOLOR(15)));
+ for(int i=0;i<16;i++)
+ m_pColorSelector[i] = addColorSelector(i%4,i/4,i%4,i/4,QString("%1:").arg(i),&(KVI_OPTION_MIRCCOLOR(i)));
- addRowSpacer(0,4,3,4);
+ QLabel * l = addLabel(0,4,3,4,__tr2qs_ctx(
+ "Please note that this is a set of standard IRC colors. " \
+ "You can adjust them a bit, make them darker or lighter but you " \
+ "shouldn't change their fundamental tint. " \
+ "Black should stay black, dark green should still remain a green darker than the light one.",
+ "options"
+ )
+ );
+ l->setAlignment(Qt::AlignCenter);
- layout()->setRowStretch(4,1);
+ addRowSpacer(0,5,3,5);
+
+ layout()->setRowStretch(5,1);
+
+ QPushButton * pReset = addPushButton(3,6,3,6,__tr2qs_ctx("Reset to Default","options"));
+
+ QObject::connect(pReset,SIGNAL(clicked()),this,SLOT(resetToDefaults()));
}
OptionsWidget_standardColors::~OptionsWidget_standardColors()
{
}
+void OptionsWidget_standardColors::resetToDefaults()
+{
+ m_pColorSelector[0]->forceColor(QColor(255,255,255));
+ m_pColorSelector[1]->forceColor(QColor(0,0,0));
+ m_pColorSelector[2]->forceColor(QColor(0,0,140));
+ m_pColorSelector[3]->forceColor(QColor(0,100,0));
+ m_pColorSelector[4]->forceColor(QColor(230,0,0));
+ m_pColorSelector[5]->forceColor(QColor(150,0,0));
+ m_pColorSelector[6]->forceColor(QColor(80,0,80));
+ m_pColorSelector[7]->forceColor(QColor(255,90,0));
+ m_pColorSelector[8]->forceColor(QColor(255,255,0));
+ m_pColorSelector[9]->forceColor(QColor(0,255,0));
+ m_pColorSelector[10]->forceColor(QColor(0,150,180));
+ m_pColorSelector[11]->forceColor(QColor(170,170,255));
+ m_pColorSelector[12]->forceColor(QColor(15,15,255));
+ m_pColorSelector[13]->forceColor(QColor(200,0,200));
+ m_pColorSelector[14]->forceColor(QColor(80,80,80));
+ m_pColorSelector[15]->forceColor(QColor(170,170,170));
+}
+
MessageListWidgetItem::MessageListWidgetItem(MessageListWidget* l,int optId)
: KviTalListWidgetItem(l)
{
diff --git a/src/modules/options/OptionsWidget_message.h b/src/modules/options/OptionsWidget_message.h
index 5cafd9465..05eb83486 100644
--- a/src/modules/options/OptionsWidget_message.h
+++ b/src/modules/options/OptionsWidget_message.h
@@ -198,7 +198,10 @@ class OptionsWidget_standardColors : public KviOptionsWidget
public:
OptionsWidget_standardColors(QWidget * par);
~OptionsWidget_standardColors();
-
+private:
+ KviColorSelector * m_pColorSelector[16];
+private slots:
+ void resetToDefaults();
};