aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Elvio Basello2008-09-18 00:20:04 +0000
committerGravatar Elvio Basello2008-09-18 00:20:04 +0000
commit32bd06d797020eb7b71ce0a5ab324dca252d2534 (patch)
treea83a5046d2b193fe382e14070631f3250755863f /src
parentfix warning. (diff)
downloadKVIrc-32bd06d797020eb7b71ce0a5ab324dca252d2534.tar.gz
KVIrc-32bd06d797020eb7b71ce0a5ab324dca252d2534.tar.bz2
KVIrc-32bd06d797020eb7b71ce0a5ab324dca252d2534.zip
added doxygen comments
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@2477 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src')
-rw-r--r--src/kvirc/kernel/kvi_userinput.cpp51
-rw-r--r--src/kvirc/kernel/kvi_userinput.h54
-rw-r--r--src/kvirc/ui/kvi_actiondrawer.cpp205
-rw-r--r--src/kvirc/ui/kvi_actiondrawer.h146
-rw-r--r--src/kvirc/ui/kvi_colorwin.cpp59
-rw-r--r--src/kvirc/ui/kvi_colorwin.h42
6 files changed, 360 insertions, 197 deletions
diff --git a/src/kvirc/kernel/kvi_userinput.cpp b/src/kvirc/kernel/kvi_userinput.cpp
index 01f551d92..f6bce2972 100644
--- a/src/kvirc/kernel/kvi_userinput.cpp
+++ b/src/kvirc/kernel/kvi_userinput.cpp
@@ -4,7 +4,7 @@
// Created on Sun 25 Sep 2005 05:27:57 by Szymon Stefanek
//
// This file is part of the KVIrc IRC Client distribution
-// Copyright (C) 2005 Szymon Stefanek <pragma at kvirc dot net>
+// Copyright (C) 2005-2008 Szymon Stefanek <pragma at kvirc dot net>
//
// This program is FREE software. You can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -22,8 +22,6 @@
//
//=============================================================================
-
-
#include "kvi_userinput.h"
#include "kvi_kvs_variantlist.h"
#include "kvi_console.h"
@@ -37,26 +35,29 @@
namespace KviUserInput
{
- bool parse(QString &szData,KviWindow * pWindow,const QString &szContext,bool bUserFriendlyCommandline)
+ bool parse(QString & szData, KviWindow * pWindow, const QString & szContext, bool bUserFriendlyCommandline)
{
const QChar * b = KviQString::nullTerminatedArray(szData);
const QChar * c = b;
if(!c)return true; // empty
- while(c->isSpace())c++;
- if(!c->unicode())return true; // empty
+ while(c->isSpace()) c++;
+
+ if(!c->unicode())
+ return true; // empty
if(c->unicode() == '\\')
{
c++;
- if(c->unicode() != '/')c--;
+ if(c->unicode() != '/')
+ c--;
} else {
if(c->unicode() == '/')
{
c++;
if(c->unicode() != '/')
{
- szData.remove(0,c-b);
+ szData.remove(0, c - b);
return parseCommand(szData,pWindow,szContext,bUserFriendlyCommandline);
} else {
// C++ comment, probably
@@ -68,17 +69,20 @@ namespace KviUserInput
if(KVS_TRIGGER_EVENT_1_HALTED(KviEvent_OnTextInput,pWindow,szData))
return true; // halted
- if(c != b)szData.remove(0,c-b);
+ if(c != b)
+ szData.remove(0,c-b);
+
parseNonCommand(szData,pWindow);
return true;
}
- bool parseCommand(const QString &szData,KviWindow * pWindow,const QString &szContext,bool bUserFriendlyCommandline)
+ bool parseCommand(const QString & szData, KviWindow * pWindow, const QString & szContext, bool bUserFriendlyCommandline)
{
if(bUserFriendlyCommandline)
{
static QString szUserFriendlyCommandlineContext(__tr2qs("commandline::userfriendly"));
- QString szCmd=szData;
+
+ QString szCmd = szData;
// escape any -$;\%(
szCmd.replace("\\","\\\\");
szCmd.replace("\"","\\\"");
@@ -88,29 +92,37 @@ namespace KviUserInput
szCmd.replace(";","\\;");
szCmd.replace("-","\\-");
szCmd.replace("+","\\+");
+
KviKvsScript kvs(szContext.isEmpty() ? szUserFriendlyCommandlineContext : szContext,szCmd);
return (kvs.run(pWindow,0,0) != KviKvsScript::Error);
} else {
static QString szCommandlineContext(__tr2qs("commandline::kvs"));
+
KviKvsScript kvs(szContext.isEmpty() ? szCommandlineContext : szContext,szData);
return (kvs.run(pWindow,0,0/*,KviKvsScript::AssumeLocals*/) != KviKvsScript::Error);
}
}
- void parseNonCommand(QString &szData,KviWindow * pWindow)
+ void parseNonCommand(QString & szData, KviWindow * pWindow)
{
const QChar * aux = KviQString::nullTerminatedArray(szData);
const QChar * beg = aux;
- if(!beg)return; // empty
+
+ if(!beg)
+ return; // empty
while(aux->unicode())
{
- while(aux->unicode() && (aux->unicode() != '\n'))aux++;
- QString buf(beg,aux-beg);
- if(aux->unicode() == '\n')aux++;
+ while(aux->unicode() && (aux->unicode() != '\n'))
+ aux++;
+
+ QString buf(beg, aux - beg);
+ if(aux->unicode() == '\n')
+ aux++;
beg = aux;
- if(buf.isEmpty())buf = " "; // avoid "No text to send" (d3vah)
+ if(buf.isEmpty())
+ buf = " "; // avoid "No text to send" (d3vah)
switch(pWindow->type())
{
@@ -118,6 +130,7 @@ namespace KviUserInput
if(pWindow->connection())
{
KviQCString data = pWindow->connection()->encodeText(buf);
+
if(((KviConsole *)pWindow)->connection()->sendData(data.data()))
{
pWindow->output(KVI_OUT_RAW,"[RAW]: %Q",&buf);
@@ -130,9 +143,11 @@ namespace KviUserInput
case KVI_WINDOW_TYPE_QUERY:
if(pWindow->connection())
{
- if(KVI_OPTION_BOOL(KviOption_boolExitAwayOnInput))
+ if(KVI_OPTION_BOOL(KviOption_boolExitAwayOnInput))
+ {
if(pWindow->connection()->userInfo()->isAway())
parseCommand("back",pWindow->console());
+ }
}
pWindow->ownMessage(buf);
break;
diff --git a/src/kvirc/kernel/kvi_userinput.h b/src/kvirc/kernel/kvi_userinput.h
index 94faed47c..75faf1689 100644
--- a/src/kvirc/kernel/kvi_userinput.h
+++ b/src/kvirc/kernel/kvi_userinput.h
@@ -6,7 +6,7 @@
// Created on Sun 25 Sep 2005 05:27:57 by Szymon Stefanek
//
// This file is part of the KVIrc IRC Client distribution
-// Copyright (C) 2005 Szymon Stefanek <pragma at kvirc dot net>
+// Copyright (C) 2005-2008 Szymon Stefanek <pragma at kvirc dot net>
//
// This program is FREE software. You can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -24,20 +24,52 @@
//
//=============================================================================
+/**
+* \file kvi_userinput.h
+* \author Szymon Stefanek
+* \brief User input parsing
+*/
+
#include "kvi_settings.h"
#include "kvi_qstring.h"
#include "kvi_window.h"
-namespace KviUserInput
+/**
+* \namespace KviUserInput
+* \brief Namespace that contains parsing function for the user input
+*/
+namespace KviUserInput
{
- // WARNING: May destroy szData
- // returns false if szData is a command and it fails to run
- KVIRC_API bool parse(QString &szData,KviWindow * pWindow,const QString &szContext = KviQString::empty,bool bUserFriendlyCommandline = false);
-
- KVIRC_API bool parseCommand(const QString &szData,KviWindow * pWindow,const QString &szContext = KviQString::empty,bool bUserFriendlyCommandline = false);
- //bool parseCommandWithSingleArgument(const QString &szData,KviWindow * pWindow,const QString &szContext = KviQString::empty);
- KVIRC_API void parseNonCommand(QString &szData,KviWindow * pWindow);
-};
+ /**
+ * \brief Returns false if szData is a command and it fails to run
+ * \param szData The input data to parse
+ * \param pWindow The window associated to the input
+ * \param szContext The context associated to the input
+ * \param bUserFriendlyCommandline Whether the commandline is in user friendly mode
+ * \return bool
+ * \warning May destroy szData
+ */
+ KVIRC_API bool parse(QString & szData, KviWindow * pWindow, const QString & szContext = KviQString::empty, bool bUserFriendlyCommandline = false);
+
+ /**
+ * \brief Returns true if the command run
+ * \param szData The input data to parse
+ * \param pWindow The window associated to the input
+ * \param szContext The context associated to the input
+ * \param bUserFriendlyCommandline Whether the commandline is in user friendly mode
+ * \return bool
+ */
+ KVIRC_API bool parseCommand(const QString & szData, KviWindow * pWindow, const QString & szContext = KviQString::empty, bool bUserFriendlyCommandline = false);
+ /**
+ * \brief Parses the non command input data
+ * \param szData The input data to parse
+ * \param pWindow The window associated to the input
+ * \return void
+ */
+ KVIRC_API void parseNonCommand(QString & szData, KviWindow * pWindow);
+
+ //bool parseCommandWithSingleArgument(const QString & szData, KviWindow * pWindow, const QString & szContext = KviQString::empty);
+};
-#endif //!_KVI_USERINPUT_H_
+#endif //_KVI_USERINPUT_H_
diff --git a/src/kvirc/ui/kvi_actiondrawer.cpp b/src/kvirc/ui/kvi_actiondrawer.cpp
index c4d3b6032..6b1dd7bd8 100644
--- a/src/kvirc/ui/kvi_actiondrawer.cpp
+++ b/src/kvirc/ui/kvi_actiondrawer.cpp
@@ -4,7 +4,7 @@
// Created on Sun 21 Nov 2004 05:44:22 by Szymon Stefanek
//
// This file is part of the KVIrc IRC Client distribution
-// Copyright (C) 2004 Szymon Stefanek <pragma at kvirc dot net>
+// Copyright (C) 2004-2008 Szymon Stefanek <pragma at kvirc dot net>
//
// This program is FREE software. You can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -40,32 +40,86 @@
#include <QMouseEvent>
#include <QTextDocument>
-KviActionDrawerPageListWidgetItem::KviActionDrawerPageListWidgetItem(KviTalListWidget * v,KviAction * a)
-: KviTalListWidgetItem(v)
+KviActionDrawer::KviActionDrawer(QWidget * pParent)
+: QTabWidget(pParent)
{
- m_pListWidget = v;
- //setDragEnabled(true);
- m_szName = a->name();
- QString t = "<b>" + a->visibleName() + "</b>";
- if(a->isKviUserActionNeverOverrideThis())
- t += " <font color=\"#a0a0a0\">[" + __tr2qs("Script") + "]</font>";
- t += "<br><font size=\"-1\">" + a->description()+ "</font>";
- m_szKey = a->visibleName().toUpper();
+ setMinimumWidth(400);
+ setMinimumHeight(300);
+}
- QPixmap * p = a->bigIcon();
- setIcon(QIcon(*p));
- setText(t);
+KviActionDrawer::~KviActionDrawer()
+{
}
-KviActionDrawerPageListWidgetItem::~KviActionDrawerPageListWidgetItem()
+void KviActionDrawer::fill()
+{
+ KviActionManager::loadAllAvailableActions();
+
+ KviPointerHashTable<QString,KviActionDrawerPage> pages;
+ pages.setAutoDelete(false);
+
+ KviPointerHashTable<QString,KviAction> * d = KviActionManager::instance()->actions();
+ if(!d)
+ return; // ooops
+
+ KviPointerHashTableIterator<QString,KviAction> it(*d);
+ while(KviAction * pAction = it.current())
+ {
+ KviActionCategory * pCat = pAction->category();
+ if(!pCat)
+ pCat = KviActionManager::categoryGeneric();
+
+ KviActionDrawerPage * pPage = pages.find(pCat->visibleName());
+ if(!pPage)
+ {
+ pPage = new KviActionDrawerPage(this,pCat->description());
+ pages.replace(pCat->visibleName(),pPage);
+ addTab(pPage,pCat->visibleName());
+ //p->show();
+ }
+ pPage->add(pAction);
+ ++it;
+ }
+
+ KviActionDrawerPage * pPage = pages.find(KviActionManager::categoryIrc()->visibleName());
+ if(pPage)
+ {
+ int iId = indexOf(pPage);
+ if(iId >= 0)
+ setCurrentIndex(iId);
+ }
+}
+
+KviActionDrawerPage::KviActionDrawerPage(QWidget * pParent, const QString & szDescription)
+: QWidget(pParent)
{
+ QGridLayout * pLayout = new QGridLayout(this);
+
+ QString szDesc = "<b>" + szDescription + "</b>";
+ QLabel * pLabel = new QLabel(szDesc,this);
+ pLayout->addWidget(pLabel,0,0);
+
+ m_pListWidget = new KviActionDrawerPageListWidget(this);
+
+ pLayout->addWidget(m_pListWidget,1,0);
+ pLayout->setRowStretch(1,1);
}
+
+KviActionDrawerPage::~KviActionDrawerPage()
+{
+}
+
+void KviActionDrawerPage::add(KviAction * pAction)
+{
+ (void)new KviActionDrawerPageListWidgetItem(m_pListWidget,pAction);
+}
+
KviActionDrawerPageListWidget::KviActionDrawerPageListWidget(KviActionDrawerPage * pParent)
: KviTalListWidget(pParent)
{
- KviTalIconAndRichTextItemDelegate *itemDelegate=new KviTalIconAndRichTextItemDelegate(this);
- setItemDelegate(itemDelegate);
+ KviTalIconAndRichTextItemDelegate * pItemDelegate = new KviTalIconAndRichTextItemDelegate(this);
+ setItemDelegate(pItemDelegate);
setSelectionMode(QAbstractItemView::SingleSelection);
setSortingEnabled(true);
setMinimumHeight(400);
@@ -78,110 +132,65 @@ KviActionDrawerPageListWidget::KviActionDrawerPageListWidget(KviActionDrawerPage
szPic += "/kvi_actiondrawer.png";
QString szStyle("QListWidget {background-image: url(" + szPic + ");background-repeat: no-repeat;background-position: bottom right;}");
setStyleSheet(szStyle);
-// m_pPage = pParent;
-// setSelectionMode(Single);[{['
+ /*
+ m_pPage = pParent;
+ setSelectionMode(Single);[{['
//header()->hide();
-// int iWidth = viewport()->width();
-// if(iWidth < LVI_MINIMUM_CELL_WIDTH)iWidth = LVI_MINIMUM_CELL_WIDTH;
-// setHeaderLabel("");
-// addColumn("",iWidth);
-// setSorting(0,true);
+ int iWidth = viewport()->width();
+ if(iWidth < LVI_MINIMUM_CELL_WIDTH)iWidth = LVI_MINIMUM_CELL_WIDTH;
+ setHeaderLabel("");
+ addColumn("",iWidth);
+ setSorting(0,true);
+ */
}
KviActionDrawerPageListWidget::~KviActionDrawerPageListWidget()
{
}
-
+/*
void KviActionDrawerPageListWidget::contentsMousePressEvent(QMouseEvent * e)
{
- /*
KviListView::contentsMousePressEvent(e);
- KviActionDrawerPageListWidgetItem * i = (KviActionDrawerPageListWidgetItem *)itemAt(QPoint(5,contentsToViewport(e->pos()).y()));
- if(!i)return;
- KviTextDrag * dr = new KviTextDrag();
- dr->setText(i->name());
- if(i->icon()) dr->setImageData(i->icon());
- */
+ KviActionDrawerPageListWidgetItem * pItem = (KviActionDrawerPageListWidgetItem *)itemAt(QPoint(5,contentsToViewport(e->pos()).y()));
+ if(!pItem)
+ return;
+
+ KviTextDrag * pDrag = new KviTextDrag();
+ pDrag->setText(pItem->name());
+
+ if(pItem->icon())
+ pDrag->setImageData(pItem->icon());
}
+*/
void KviActionDrawerPageListWidget::resizeEvent(QResizeEvent * e)
{
KviTalListWidget::resizeEvent(e);
int iWidth = viewport()->width();
- if(iWidth < LVI_MINIMUM_CELL_WIDTH)iWidth = LVI_MINIMUM_CELL_WIDTH;
+ if(iWidth < LVI_MINIMUM_CELL_WIDTH)
+ iWidth = LVI_MINIMUM_CELL_WIDTH;
//setColumnWidth(0,iWidth);
}
-
-KviActionDrawerPage::KviActionDrawerPage(QWidget * pParent,const QString &szDescription)
-: QWidget(pParent)
+KviActionDrawerPageListWidgetItem::KviActionDrawerPageListWidgetItem(KviTalListWidget * pList, KviAction * pAction)
+: KviTalListWidgetItem(pList)
{
- QGridLayout * g = new QGridLayout(this);
-
- QString t = "<b>" + szDescription + "</b>";
- QLabel * l = new QLabel(t,this);
- g->addWidget(l,0,0);
-
- m_pListWidget = new KviActionDrawerPageListWidget(this);
-
- g->addWidget(m_pListWidget,1,0);
-
- g->setRowStretch(1,1);
-}
-
-KviActionDrawerPage::~KviActionDrawerPage()
-{
-}
-
-void KviActionDrawerPage::add(KviAction * a)
-{
- (void)new KviActionDrawerPageListWidgetItem(m_pListWidget,a);
-}
-
-KviActionDrawer::KviActionDrawer(QWidget * pParent)
-: QTabWidget(pParent)
-{
- setMinimumWidth(400);
- setMinimumHeight(300);
-}
+ m_pListWidget = pList;
+ //setDragEnabled(true);
+ m_szName = pAction->name();
+ QString szText = "<b>" + pAction->visibleName() + "</b>";
+ if(pAction->isKviUserActionNeverOverrideThis())
+ szText += " <font color=\"#a0a0a0\">[" + __tr2qs("Script") + "]</font>";
+ szText += "<br><font size=\"-1\">" + pAction->description() + "</font>";
+ m_szKey = pAction->visibleName().toUpper();
-KviActionDrawer::~KviActionDrawer()
-{
+ QPixmap * p = pAction->bigIcon();
+ setIcon(QIcon(*p));
+ setText(szText);
}
-void KviActionDrawer::fill()
+KviActionDrawerPageListWidgetItem::~KviActionDrawerPageListWidgetItem()
{
- KviActionManager::loadAllAvailableActions();
-
- KviPointerHashTable<QString,KviActionDrawerPage> pages;
- pages.setAutoDelete(false);
-
- KviPointerHashTable<QString,KviAction> * d = KviActionManager::instance()->actions();
- if(!d)return; // ooops
-
- KviPointerHashTableIterator<QString,KviAction> it(*d);
- while(KviAction * a = it.current())
- {
- KviActionCategory * c = a->category();
- if(!c)c = KviActionManager::categoryGeneric();
- KviActionDrawerPage * p = pages.find(c->visibleName());
- if(!p)
- {
- p = new KviActionDrawerPage(this,c->description());
- pages.replace(c->visibleName(),p);
- addTab(p,c->visibleName());
- //p->show();
- }
- p->add(a);
- ++it;
- }
-
- KviActionDrawerPage * p = pages.find(KviActionManager::categoryIrc()->visibleName());
- if(p)
- {
- int iii = indexOf(p);
- if(iii >= 0)setCurrentIndex(iii);
- }
}
diff --git a/src/kvirc/ui/kvi_actiondrawer.h b/src/kvirc/ui/kvi_actiondrawer.h
index c4a48079e..a74397ff9 100644
--- a/src/kvirc/ui/kvi_actiondrawer.h
+++ b/src/kvirc/ui/kvi_actiondrawer.h
@@ -6,7 +6,7 @@
// Created on Sun 21 Nov 2004 05:44:22 by Szymon Stefanek
//
// This file is part of the KVIrc IRC Client distribution
-// Copyright (C) 2004 Szymon Stefanek <pragma at kvirc dot net>
+// Copyright (C) 2004-2008 Szymon Stefanek <pragma at kvirc dot net>
//
// This program is FREE software. You can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -24,6 +24,12 @@
//
//=============================================================================
+/**
+* \file kvi_actiondrawer.h
+* \author Szymon Stefanek
+* \brief Handling of actions drawer
+*/
+
#include "kvi_settings.h"
#include "kvi_qstring.h"
#include "kvi_tal_listwidget.h"
@@ -31,69 +37,131 @@
#include <QWidget>
#include <QTabWidget>
-class KviAction;
-class KviActionDrawerPage;
class QPixmap;
+class KviAction;
+class KviActionDrawerPageListWidget;
-class KVIRC_API KviActionDrawerPageListWidgetItem : public KviTalListWidgetItem
+/**
+* \class KviActionDrawer
+* \brief Action drawer class
+*/
+class KVIRC_API KviActionDrawer : public QTabWidget
{
+ Q_OBJECT
public:
- KviActionDrawerPageListWidgetItem(KviTalListWidget * v,KviAction * a);
- ~KviActionDrawerPageListWidgetItem();
-protected:
- QString m_szName;
-// Q3SimpleRichText * m_pText;
- QPixmap * m_pIcon;
- KviTalListWidget * m_pListWidget;
- QString m_szKey;
+ /**
+ * \brief Constructs an action drawer object
+ * \param pParent The parent widget
+ * \return KviActionDrawer
+ */
+ KviActionDrawer(QWidget * pParent);
+
+ /**
+ * \brief Destroys an action drawer object
+ */
+ ~KviActionDrawer();
public:
-// QPixmap * icon(){ return m_pIcon; };
-// const QString & name(){ return m_szName; };
- /*
-protected:
- virtual void paintCell(QPainter * p,const QColorGroup & cg,int column,int width,int align);
- virtual void setup();
- virtual QString key(int,bool) const;
+ /**
+ * \brief Fills in the drawer page
+ * \return void
*/
+ void fill();
};
-class KVIRC_API KviActionDrawerPageListWidget : public KviTalListWidget
+/**
+* \class KviActionDrawer
+* \brief Action drawer page class
+*/
+class KVIRC_API KviActionDrawerPage : public QWidget
{
- friend class KviActionDrawerPage;
+ friend class KviActionDrawer;
Q_OBJECT
protected:
- KviActionDrawerPageListWidget(KviActionDrawerPage * pParent);
+ /**
+ * \brief Constructs an action drawer page object
+ * \param pParent The parent widget
+ * \param szDescription The description of the page
+ * \return KviActionDrawerPage
+ */
+ KviActionDrawerPage(QWidget * pParent, const QString & szDescription);
public:
- ~KviActionDrawerPageListWidget();
-//protected:
-// KviActionDrawerPage * m_pPage;
+ /**
+ * \brief Destroys an action drawer page object
+ */
+ ~KviActionDrawerPage();
protected:
- virtual void resizeEvent(QResizeEvent * e);
- virtual void contentsMousePressEvent(QMouseEvent * e);
+ KviActionDrawerPageListWidget * m_pListWidget;
+protected:
+ /**
+ * \brief Adds an action
+ * \param pAction The pointer to the action to add
+ * \return void
+ */
+ void add(KviAction * pAction);
};
-class KVIRC_API KviActionDrawerPage : public QWidget
+/**
+* \class KviActionDrawer
+* \brief Action drawer page list class
+*/
+class KVIRC_API KviActionDrawerPageListWidget : public KviTalListWidget
{
- friend class KviActionDrawer;
+ friend class KviActionDrawerPage;
Q_OBJECT
protected:
- KviActionDrawerPage(QWidget * pParent,const QString &szDescription);
+ /**
+ * \brief Constructs an action drawer page list object
+ * \param pParent The parent widget
+ * \return KviActionDrawerPageListWidget
+ */
+ KviActionDrawerPageListWidget(KviActionDrawerPage * pParent);
public:
- ~KviActionDrawerPage();
+ /**
+ * \brief Destroys an action drawer page list object
+ */
+ ~KviActionDrawerPageListWidget();
+/*
protected:
- KviActionDrawerPageListWidget * m_pListWidget;
+ KviActionDrawerPage * m_pPage;
+*/
protected:
- void add(KviAction * a);
+ virtual void resizeEvent(QResizeEvent * e);
+ //virtual void contentsMousePressEvent(QMouseEvent * e);
};
-class KVIRC_API KviActionDrawer : public QTabWidget
+/**
+* \class KviActionDrawer
+* \brief Action drawer page list item class
+*/
+class KVIRC_API KviActionDrawerPageListWidgetItem : public KviTalListWidgetItem
{
- Q_OBJECT
public:
- KviActionDrawer(QWidget * pParent);
- ~KviActionDrawer();
+ /**
+ * \brief Constructs an action drawer page list item object
+ * \param pList The list where to add the item
+ * \param pAction The action associated to the item
+ * \return KviActionDrawerPageListWidget
+ */
+ KviActionDrawerPageListWidgetItem(KviTalListWidget * pList, KviAction * pAction);
+
+ /**
+ * \brief Destroys an action drawer page list item object
+ */
+ ~KviActionDrawerPageListWidgetItem();
+protected:
+ QString m_szName;
+ QPixmap * m_pIcon;
+ KviTalListWidget * m_pListWidget;
+ QString m_szKey;
+/*
public:
- void fill();
+ QPixmap * icon(){ return m_pIcon; };
+ const QString & name(){ return m_szName; };
+protected:
+ virtual void paintCell(QPainter * p,const QColorGroup & cg,int column,int width,int align);
+ virtual void setup();
+ virtual QString key(int,bool) const;
+*/
};
-#endif //!_KVI_ACTIONDRAWER_H_
+#endif //_KVI_ACTIONDRAWER_H_
diff --git a/src/kvirc/ui/kvi_colorwin.cpp b/src/kvirc/ui/kvi_colorwin.cpp
index a1f42beb8..a6ce106b7 100644
--- a/src/kvirc/ui/kvi_colorwin.cpp
+++ b/src/kvirc/ui/kvi_colorwin.cpp
@@ -4,7 +4,7 @@
// Creation date : Wed Jan 6 1999 04:30:20 by Szymon Stefanek
//
// This file is part of the KVirc irc client distribution
-// Copyright (C) 1999-2007 Szymon Stefanek (pragma at kvirc dot net)
+// Copyright (C) 1999-2008 Szymon Stefanek (pragma at kvirc dot net)
//
// This program is FREE software. You can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -22,8 +22,6 @@
//
//=============================================================================
-
-
#include "kvi_colorwin.h"
#include "kvi_app.h"
#include "kvi_options.h"
@@ -53,22 +51,21 @@ KviColorWindow::~KviColorWindow()
{
if(m_iTimerId != -1)
killTimer(m_iTimerId);
-// if(m_pOwner)m_pOwner->setFocus();
+ //if(m_pOwner)m_pOwner->setFocus();
}
-void KviColorWindow::popup(QWidget *owner)
+void KviColorWindow::popup(QWidget * pOwner)
{
- m_pOwner = owner;
+ m_pOwner = pOwner;
show();
}
-
-void KviColorWindow::paintEvent(QPaintEvent *)
+void KviColorWindow::paintEvent(QPaintEvent * e)
{
- static int clrIdx[16]={ 1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,1 };
+ static int clrIdx[16] = { 1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,1 };
QPainter p(this);
- for(int i=0;i<16;i++)
+ for(int i=0; i<16; i++)
{
p.fillRect((i % 8) * 18,(i / 8) * 18,18,18,KVI_OPTION_MIRCCOLOR(i));
p.setPen(KVI_OPTION_MIRCCOLOR(clrIdx[i]));
@@ -77,7 +74,7 @@ void KviColorWindow::paintEvent(QPaintEvent *)
}
}
-void KviColorWindow::keyPressEvent(QKeyEvent *e)
+void KviColorWindow::keyPressEvent(QKeyEvent * e)
{
if(m_iTimerId != -1)
killTimer(m_iTimerId);
@@ -85,31 +82,47 @@ void KviColorWindow::keyPressEvent(QKeyEvent *e)
if(m_pOwner)g_pApp->sendEvent(m_pOwner,e);
}
-void KviColorWindow::mousePressEvent(QMouseEvent *e)
+void KviColorWindow::mousePressEvent(QMouseEvent * e)
{
- QString str;
- if(!((e->pos().x() < 0) || (e->pos().x() > width()) || (e->pos().y() < 0) || (e->pos().y() > height())))
+ QString szStr;
+ if(!(
+ (e->pos().x() < 0) || (e->pos().x() > width()) ||
+ (e->pos().y() < 0) || (e->pos().y() > height())
+ ))
{
- int key=e->x()/18;
- if (e->x()<36 && e->y()>18) key +=8;
- if (e->x()>36 && e->y()>18) key -=2;
- int ascii=key+48;
- str.setNum(key);
- if (e->x()>36 && e->y()>18)
- if(m_pOwner) g_pApp->sendEvent(m_pOwner,new QKeyEvent(QEvent::KeyPress,Qt::Key_1,Qt::NoModifier,"1"));
- if(m_pOwner) g_pApp->sendEvent(m_pOwner,new QKeyEvent(QEvent::KeyPress,key,(Qt::KeyboardModifiers)Qt::NoModifier,str));
+ int iKey = e->x() / 18;
+ if (e->x() < 36 && e->y() > 18)
+ iKey += 8;
+ if (e->x() > 36 && e->y() > 18)
+ iKey -= 2;
+
+ int iAscii = iKey + 48;
+
+ // FIXME: is this right? maybe it should be szStr.setNum(iAscii);
+ szStr.setNum(iKey);
+
+ if (e->x() > 36 && e->y() > 18)
+ {
+ if(m_pOwner)
+ g_pApp->sendEvent(m_pOwner,new QKeyEvent(QEvent::KeyPress,Qt::Key_1,Qt::NoModifier,"1"));
+ }
+
+ if(m_pOwner)
+ g_pApp->sendEvent(m_pOwner,new QKeyEvent(QEvent::KeyPress,iKey,(Qt::KeyboardModifiers)Qt::NoModifier,szStr));
}
+
if(m_iTimerId != -1)
killTimer(m_iTimerId);
hide();
}
+
void KviColorWindow::show()
{
m_iTimerId = startTimer(10000); //10 sec ...seems enough
QWidget::show();
}
-void KviColorWindow::timerEvent(QTimerEvent *)
+void KviColorWindow::timerEvent(QTimerEvent * e)
{
if(m_iTimerId != -1)
killTimer(m_iTimerId);
diff --git a/src/kvirc/ui/kvi_colorwin.h b/src/kvirc/ui/kvi_colorwin.h
index 4f9a39cef..a1165b49b 100644
--- a/src/kvirc/ui/kvi_colorwin.h
+++ b/src/kvirc/ui/kvi_colorwin.h
@@ -1,11 +1,12 @@
#ifndef _KVI_COLORWIN_H_
#define _KVI_COLORWIN_H_
+//=============================================================================
//
// File : kvi_colorwin.h
// Creation date : Wed Jan 6 1999 04:27:45 by Szymon Stefanek
//
// This file is part of the KVirc irc client distribution
-// Copyright (C) 1999-2000 Szymon Stefanek (pragma at kvirc dot net)
+// Copyright (C) 1999-2008 Szymon Stefanek (pragma at kvirc dot net)
//
// This program is FREE software. You can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -21,27 +22,52 @@
// along with this program. If not, write to the Free Software Foundation,
// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
+//=============================================================================
+
+/**
+* \file kvi_colorwin.h
+* \author Szymon Stefanek
+* \brief Mirc color window
+*/
+
#include "kvi_settings.h"
#include <QWidget>
+/**
+* \class KviColorWindow
+* \brief Mirc color window handling
+*/
class KVIRC_API KviColorWindow : public QWidget
{
Q_OBJECT
public:
+ /**
+ * \brief Constructs the mirc color window object
+ * \return KviColorWindow
+ */
KviColorWindow();
+
+ /**
+ * \brief Destroys the mirc color window object
+ */
~KviColorWindow();
private:
- QWidget *m_pOwner;
- int m_iTimerId;
+ QWidget * m_pOwner;
+ int m_iTimerId;
public:
- void popup(QWidget *owner);
+ /**
+ * \brief Popups the color window
+ * \param pOwner The owner widget
+ * \return void
+ */
+ void popup(QWidget * pOwner);
private:
virtual void show();
- virtual void paintEvent(QPaintEvent *);
- virtual void keyPressEvent(QKeyEvent *e);
- virtual void mousePressEvent(QMouseEvent *);
- virtual void timerEvent(QTimerEvent *);
+ virtual void paintEvent(QPaintEvent * e);
+ virtual void keyPressEvent(QKeyEvent * e);
+ virtual void mousePressEvent(QMouseEvent * e);
+ virtual void timerEvent(QTimerEvent * e);
};
#endif //_KVI_COLORWIN_H_