summaryrefslogtreecommitdiffstats
path: root/src/modules/notifier
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/notifier')
-rw-r--r--src/modules/notifier/Makefile.am44
-rw-r--r--src/modules/notifier/libkvinotifier.cpp323
-rw-r--r--src/modules/notifier/libkvinotifier.kvc28
-rw-r--r--src/modules/notifier/notifiermessage.cpp107
-rw-r--r--src/modules/notifier/notifiermessage.h97
-rw-r--r--src/modules/notifier/notifiersettings.h66
-rw-r--r--src/modules/notifier/notifierwindow.cpp1427
-rw-r--r--src/modules/notifier/notifierwindow.h194
-rw-r--r--src/modules/notifier/notifierwindowbody.cpp232
-rw-r--r--src/modules/notifier/notifierwindowbody.h147
-rw-r--r--src/modules/notifier/notifierwindowborder.cpp220
-rw-r--r--src/modules/notifier/notifierwindowborder.h154
-rw-r--r--src/modules/notifier/notifierwindowprogressbar.cpp51
-rw-r--r--src/modules/notifier/notifierwindowprogressbar.h67
-rw-r--r--src/modules/notifier/notifierwindowtabs.cpp705
-rw-r--r--src/modules/notifier/notifierwindowtabs.h263
-rwxr-xr-xsrc/modules/notifier/pics/Makefile.am9
-rwxr-xr-xsrc/modules/notifier/pics/notifier_background.pngbin0 -> 4306 bytes
-rw-r--r--src/modules/notifier/pics/notifier_close.pngbin0 -> 311 bytes
-rw-r--r--src/modules/notifier/pics/notifier_down.pngbin0 -> 491 bytes
-rw-r--r--src/modules/notifier/pics/notifier_icon_body_next_clicked.pngbin0 -> 630 bytes
-rw-r--r--src/modules/notifier/pics/notifier_icon_body_next_off.pngbin0 -> 561 bytes
-rw-r--r--src/modules/notifier/pics/notifier_icon_body_next_on.pngbin0 -> 568 bytes
-rw-r--r--src/modules/notifier/pics/notifier_icon_body_prev_clicked.pngbin0 -> 599 bytes
-rw-r--r--src/modules/notifier/pics/notifier_icon_body_prev_off.pngbin0 -> 520 bytes
-rw-r--r--src/modules/notifier/pics/notifier_icon_body_prev_on.pngbin0 -> 535 bytes
-rw-r--r--src/modules/notifier/pics/notifier_icon_body_write_clicked.pngbin0 -> 166 bytes
-rw-r--r--src/modules/notifier/pics/notifier_icon_body_write_off.pngbin0 -> 171 bytes
-rw-r--r--src/modules/notifier/pics/notifier_icon_body_write_on.pngbin0 -> 160 bytes
-rw-r--r--src/modules/notifier/pics/notifier_icon_close_clicked.pngbin0 -> 1087 bytes
-rw-r--r--src/modules/notifier/pics/notifier_icon_close_clicked_hl.pngbin0 -> 1064 bytes
-rw-r--r--src/modules/notifier/pics/notifier_icon_close_out.pngbin0 -> 1248 bytes
-rw-r--r--src/modules/notifier/pics/notifier_icon_close_out_hl.pngbin0 -> 1214 bytes
-rw-r--r--src/modules/notifier/pics/notifier_icon_close_over.pngbin0 -> 1374 bytes
-rw-r--r--src/modules/notifier/pics/notifier_icon_close_over_hl.pngbin0 -> 1338 bytes
-rw-r--r--src/modules/notifier/pics/notifier_icon_tab_close_clicked.pngbin0 -> 518 bytes
-rw-r--r--src/modules/notifier/pics/notifier_icon_tab_close_off.pngbin0 -> 428 bytes
-rw-r--r--src/modules/notifier/pics/notifier_icon_tab_close_on.pngbin0 -> 517 bytes
-rw-r--r--src/modules/notifier/pics/notifier_icon_tab_next_clicked.pngbin0 -> 809 bytes
-rw-r--r--src/modules/notifier/pics/notifier_icon_tab_next_out.pngbin0 -> 828 bytes
-rw-r--r--src/modules/notifier/pics/notifier_icon_tab_next_over.pngbin0 -> 870 bytes
-rw-r--r--src/modules/notifier/pics/notifier_icon_tab_prev_clicked.pngbin0 -> 773 bytes
-rw-r--r--src/modules/notifier/pics/notifier_icon_tab_prev_out.pngbin0 -> 827 bytes
-rw-r--r--src/modules/notifier/pics/notifier_icon_tab_prev_over.pngbin0 -> 843 bytes
-rw-r--r--src/modules/notifier/pics/notifier_left.pngbin0 -> 442 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pen.pngbin0 -> 712 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_body_dwn.pngbin0 -> 138 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_body_dwndx.pngbin0 -> 162 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_body_dwnsx.pngbin0 -> 162 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_body_dx.pngbin0 -> 136 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_body_kvirc.pngbin0 -> 2599 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_body_kvirc_dwn.pngbin0 -> 249 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_body_kvirc_sx.pngbin0 -> 172 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_body_sx.pngbin0 -> 136 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_caption_bkg.pngbin0 -> 154 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_caption_bkg_hl.pngbin0 -> 154 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_caption_dx.pngbin0 -> 196 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_caption_dx_hl.pngbin0 -> 196 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_caption_sx.pngbin0 -> 195 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_caption_sx_hl.pngbin0 -> 195 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_tab_bkg.pngbin0 -> 150 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_tab_dx.pngbin0 -> 157 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_tab_focused_bkg.pngbin0 -> 156 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_tab_focused_dx.pngbin0 -> 187 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_tab_focused_sx.pngbin0 -> 184 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_tab_sx.pngbin0 -> 157 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_tab_unfocused_bkg.pngbin0 -> 175 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_tab_unfocused_dx.pngbin0 -> 210 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_tab_unfocused_sx.pngbin0 -> 204 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_wnd_dwn.pngbin0 -> 156 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_wnd_dwn_hl.pngbin0 -> 156 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_wnd_dwndx.pngbin0 -> 193 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_wnd_dwndx_hl.pngbin0 -> 193 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_wnd_dwnsx.pngbin0 -> 196 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_wnd_dwnsx_hl.pngbin0 -> 196 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_wnd_dx.pngbin0 -> 150 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_wnd_dx_hl.pngbin0 -> 150 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_wnd_sx.pngbin0 -> 150 bytes
-rw-r--r--src/modules/notifier/pics/notifier_pix_wnd_sx_hl.pngbin0 -> 150 bytes
-rw-r--r--src/modules/notifier/pics/notifier_right.pngbin0 -> 443 bytes
-rw-r--r--src/modules/notifier/pics/notifier_up.pngbin0 -> 488 bytes
81 files changed, 4134 insertions, 0 deletions
diff --git a/src/modules/notifier/Makefile.am b/src/modules/notifier/Makefile.am
new file mode 100644
index 00000000..59639aca
--- /dev/null
+++ b/src/modules/notifier/Makefile.am
@@ -0,0 +1,44 @@
+###############################################################################
+# KVirc IRC client Makefile - 10.03.2000 Szymon Stefanek <stefanek@tin.it>
+###############################################################################
+
+SUBDIRS = pics
+
+AM_CPPFLAGS = -I$(SS_TOPSRCDIR)/src/kvilib/include/ -I$(SS_TOPSRCDIR)/src/kvirc/include/ \
+$(SS_INCDIRS) $(SS_CPPFLAGS) -DGLOBAL_KVIRC_DIR=\"$(globalkvircdir)\"
+
+pluglib_LTLIBRARIES = libkvinotifier.la
+
+libkvinotifier_la_LDFLAGS = -module -avoid-version $(SS_LDFLAGS) $(SS_LIBDIRS)
+
+libkvinotifier_la_SOURCES = libkvinotifier.cpp \
+ notifierwindow.cpp \
+ notifiermessage.cpp \
+ notifierwindowtabs.cpp \
+ notifierwindowbody.cpp \
+ notifierwindowborder.cpp \
+ notifierwindowprogressbar.cpp
+
+libkvinotifier_la_LIBADD = $(SS_LIBLINK) ../../kvilib/build/libkvilib.la
+
+noinst_HEADERS= \
+ notifiersettings.h \
+ notifierwindow.h \
+ notifiermessage.h \
+ notifierwindowtabs.h \
+ notifierwindowbody.h \
+ notifierwindowborder.h \
+ notifierwindowprogressbar.h
+
+confdir = $(configmodulesdir)
+
+conf_DATA = libkvinotifier.kvc
+
+EXTRA_DIST = $(conf_DATA)
+
+m_%.moc: %.h
+ $(SS_QT_MOC) $< -o $@
+
+notifierwindow.cpp: m_notifierwindow.moc
+notifierwindowtabs.cpp: m_notifierwindowtabs.moc
+
diff --git a/src/modules/notifier/libkvinotifier.cpp b/src/modules/notifier/libkvinotifier.cpp
new file mode 100644
index 00000000..edc27f0f
--- /dev/null
+++ b/src/modules/notifier/libkvinotifier.cpp
@@ -0,0 +1,323 @@
+//==================================================================================
+//
+// File : libkvinotifier.cpp
+// Creation date : Tue Jul 7 2004 20:21:12 CEST by Szymon Stefanek
+//
+// Copyright (C) 2005 Iacopo Palazzi < iakko(at)siena(dot)linux(dot)it >
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//==================================================================================
+
+#include "kvi_module.h"
+
+
+#include "notifierwindow.h"
+#include "notifiermessage.h"
+
+#include "kvi_kvs_variant.h"
+#include "kvi_app.h"
+#include "kvi_frame.h"
+#include "kvi_window.h"
+#include "kvi_locale.h"
+#include "kvi_iconmanager.h"
+#include "kvi_time.h"
+#include "kvi_options.h"
+
+#include <qsplitter.h>
+
+KviNotifierWindow * g_pNotifierWindow = 0;
+kvi_time_t g_tNotifierDisabledUntil = 0;
+
+/*
+ @doc: notifier.message
+ @type:
+ command
+ @title:
+ notifier.message
+ @short:
+ Adds a message to the notifier window
+ @syntax:
+ notifier.message [-q|quiet] [-n|noanim] [-w[=<window_id:string>]!] [-i=<image_id:string>] [-t=<timeout:integer>] <messag:string>
+ @description:
+ Adds a message to the notifier window.
+ The notifier window is shown (if not already visible)
+ unless the -q switch is present.
+ The new message becomes the current message of the notifier
+ unless the user is already typing in the input window
+ and the typed message would be directed to a different window.
+ In that case the message is appended at the end of the
+ message queue and the user will be able to scroll to it
+ by using the proper notifier buttons.[br]
+ The &lt;message&gt; text can contain simple html tags: basically you are
+ allowed to use &lt;b&gt; and &lt;i&gt;. The usage of other
+ tags is possible but is discouraged since it tends to
+ mess up the message display. In particular you should avoid
+ any color and/or font specification since the notifier is
+ skinnable and you don't know which color will result in a visible text.
+ [b]Please note that the user can forcibly disable the notifier
+ for a limited period of time (a sort of "don't bug me" option).[/b]
+ @switches:
+ !sw: -n | --noanim
+ Do not animate
+ !sw: -w | --windowid
+ Causes the message gets attacched to the specified window and
+ the user is able to type commands in that window after
+ showing up the notifier input. If the "=&lt;window_id&gt;" part
+ is omitted then the current window is used.[br]
+ !sw: -i | --icon
+ If the -i=&lt;image_id&gt; switch is present then the
+ message has the specified image displayed.
+ See the [doc:image_id]documentation on the image identifier[/doc]
+ for more informations about the image_id parameter.[br]
+ !sw: -q | --quiet
+ If you use -q then you must explicitly call [cmd]notifier.show[/cmd] to
+ show the notifier. If the -n switch is present then
+ the show action will not be animated (the notifier
+ will be shown immediately instead of fading in).
+ Obviously -n has no meaning if -q is used.[br]
+ !sw: -t | --timeout
+ Set the message lifetime to <timeout>
+ Obviously this option has no meaning if the window is not going to be shown.
+ The timeout may be overriddent by new messages but only in the future.
+ If the timeout expires and is not overridden by any new message
+ then the window will be automatically hidden.
+ A zero timeout disables auto-hiding.
+ @seealso:
+ [cmd]notifier.show[/cmd] [cmd]notifier.hide[/cmd] [fnc]$notifier.isEnabled[/fnc]()
+ @examples:
+ [example]
+ notifier.message Hello world!
+ [cmd]notifier.hide[/cmd]
+ notifier.message -q This is a hidden message!
+ notifier.message -q -i=14 This is a second hidden message with an icon
+ [cmd]notifier.show[/cmd]
+ notifier.message -w This message has the current window associated
+ notifier.message -w=[fnc]$window[/fnc] This is equivalent to the above
+ notifier.message &lt;b&gt;Bold text&lt;/b&gt; and normal text
+ [cmd]notifier.hide[/cmd]
+ notifier.message -t=10 This message will be shown only for 10 seconds
+ [/example]
+*/
+
+static bool notifier_kvs_cmd_message(KviKvsModuleCommandCall * c)
+{
+ QString szMessage;
+ KVSM_PARAMETERS_BEGIN(c)
+ KVSM_PARAMETER("message",KVS_PT_STRING,0,szMessage)
+ KVSM_PARAMETERS_END(c)
+
+ if(!g_pNotifierWindow)
+ g_pNotifierWindow = new KviNotifierWindow();
+
+ QString szIco="";
+ QString szWnd="";
+
+ KviWindow * pWnd = c->window();
+
+ if(c->hasSwitch('w',"window_id"))
+ {
+ c->switches()->getAsStringIfExisting('w',"window_id",szWnd);
+ if(!szWnd.isEmpty())
+ {
+ pWnd=g_pApp->findWindow(szWnd);
+ if(!pWnd)
+ c->warning(__tr2qs_ctx("The specified window does not exist","notifier"));
+ }
+ }
+ c->switches()->getAsStringIfExisting('i',"icon",szIco);
+ kvs_int_t uTime=0;
+ if(c->hasSwitch('t',"timeout"))
+ {
+ KviKvsVariant *time=c->getSwitch('t',"timeout");
+ if(time)
+ {
+ bool bOk=time->asInteger(uTime);
+ if(!bOk)
+ {
+ uTime = 0;
+ c->warning(__tr2qs_ctx("The specified timeout is not valid, assuming 0","notifier"));
+ }
+ } else {
+ c->warning(__tr2qs_ctx("The -t switch expects a timeout in seconds","notifier"));
+ }
+ }
+
+ g_pNotifierWindow->addMessage(pWnd,szIco,szMessage,uTime);
+
+ if(!c->hasSwitch('q',"quiet"))
+ g_pNotifierWindow->doShow(!(c->hasSwitch('n',"new")));
+ return true;
+}
+
+/*
+ @doc: notifier.hide
+ @type:
+ command
+ @title:
+ notifier.hide
+ @short:
+ Hides the notifier window
+ @syntax:
+ notifier.hide [-n|--noanim]
+ @switches:
+ !sw: -n
+ Causes the hide operation is not animated.
+ @description:
+ Hide the notifier window
+ [b]Please note that the user can forcibly disable the notifier
+ for a limited period of time (a sort of "don't bug me" option).[/b]
+ @seealso:
+ [cmd]notifier.show[/cmd] [cmd]notifier.message[/cmd] [fnc]$notifier.isEnabled[/fnc]
+*/
+
+static bool notifier_kvs_cmd_hide(KviKvsModuleCommandCall * c)
+{
+ if(g_pNotifierWindow) g_pNotifierWindow->doHide(!(c->hasSwitch('n',"notanimated")));
+ return true;
+}
+
+/*
+ @doc: notifier.show
+ @type:
+ command
+ @title:
+ notifier.show
+ @short:
+ Shows the notifier window
+ @syntax:
+ notifier.show [-n|--noanim]
+ @switches:
+ !sw: -n
+ Disables the animation
+ @description:
+ Shows the notifier window if it is not already visible
+ If the -n switch is present then the show operation is
+ not animated.[br]
+ The notifier is shown ONLY if it contains some messages.
+ [b]Please note that the user can forcibly disable the notifier
+ for a limited period of time (a sort of "don't bug me" option).[/b]
+ @seealso:
+ [cmd]notifier.hide[/cmd] [cmd]notifier.message[/cmd] [fnc]$notifier.isEnabled[/fnc]
+*/
+
+static bool notifier_kvs_cmd_show(KviKvsModuleCommandCall * c)
+{
+ if(!g_pNotifierWindow)return true;
+ if(!g_pNotifierWindow->countTabs())return true;
+
+ g_pNotifierWindow->setDisableHideOnMainWindowGotAttention(true);
+ g_pNotifierWindow->doShow(!(c->hasSwitch('n',"noanim")));
+
+ return true;
+}
+/*
+ @doc: notifier.isEnabled
+ @type:
+ function
+ @title:
+ $notifier.isEnabled
+ @short:
+ Returns 1 if the notifier window is enabled
+ @syntax:
+ <boolean> $notifier.isEnabled
+ @description:
+ Returns 1 if the notifier window is enabled and 0 otherwise.
+ The user can forcibly disable the notifier as a sort of "don't bug me"
+ feature for a limited period of time. When the notifier
+ is disabled the messages sent to it will not be shown.[br]
+ The only method that you (scripter) can use to forcibly
+ re-enable the notifier is to unload the module and
+ reload it...but [b]DON'T do it[/b] :)[br]
+ There is also a global option that allows forcibly disabling
+ the notifier forever, this option could be overridden with [cmd]option[/cmd]
+ instead.. but again [b]DON'T do it[/b] :)[br]
+
+*/
+
+static bool notifier_kvs_fnc_isEnabled(KviKvsModuleFunctionCall * c)
+{
+ bool bCheck;
+ if(KVI_OPTION_BOOL(KviOption_boolForciblyDisableNotifier))
+ bCheck=false;
+ else
+ bCheck=g_tNotifierDisabledUntil < kvi_unixTime();
+ c->returnValue()->setBoolean(bCheck);
+ return true;
+}
+
+static bool notifier_module_init(KviModule * m)
+{
+
+ KVSM_REGISTER_SIMPLE_COMMAND(m,"message",notifier_kvs_cmd_message);
+ KVSM_REGISTER_SIMPLE_COMMAND(m,"show",notifier_kvs_cmd_show);
+ KVSM_REGISTER_SIMPLE_COMMAND(m,"hide",notifier_kvs_cmd_hide);
+ KVSM_REGISTER_FUNCTION(m,"isEnabled",notifier_kvs_fnc_isEnabled);
+
+ return true;
+}
+
+static bool notifier_module_cleanup(KviModule *m)
+{
+ if(g_pNotifierWindow)
+ {
+ delete g_pNotifierWindow;
+ g_pNotifierWindow = 0;
+ }
+ return true;
+}
+
+static bool notifier_module_can_unload(KviModule *m)
+{
+ return (!g_pNotifierWindow);
+}
+
+typedef struct _NotifierMessageSupaDupaParameterStruct
+{
+ KviWindow * pWindow;
+ QString szIcon;
+ QString szMessage;
+ unsigned int uMessageLifetime; // 0 means no hide
+} NotifierMessageSupaDupaParameterStruct;
+
+static bool notifier_module_ctrl(KviModule *,const char *operation,void *param)
+{
+ if(kvi_strEqualCI("notifier::message",operation))
+ {
+ NotifierMessageSupaDupaParameterStruct * p = (NotifierMessageSupaDupaParameterStruct *)param;
+ if(!p)return false;
+
+ if(!g_pNotifierWindow)
+ g_pNotifierWindow = new KviNotifierWindow();
+
+ g_pNotifierWindow->addMessage(p->pWindow,p->szIcon,p->szMessage,p->uMessageLifetime);
+ g_pNotifierWindow->doShow(KVI_OPTION_BOOL(KviOption_boolDisableNotifierFadein)?false:true);
+
+ return true;
+ }
+ return false;
+}
+
+KVIRC_MODULE(
+ "Notifier",
+ "2.0.0",
+ "Copyright (C) 2005:\n" \
+ " Iacopo Palazzi (iakko at siena dot linux dot it)",
+ "KVIrc Client - Taskbar Notifier",
+ notifier_module_init,
+ notifier_module_can_unload,
+ notifier_module_ctrl,
+ notifier_module_cleanup
+)
diff --git a/src/modules/notifier/libkvinotifier.kvc b/src/modules/notifier/libkvinotifier.kvc
new file mode 100644
index 00000000..4625fe3b
--- /dev/null
+++ b/src/modules/notifier/libkvinotifier.kvc
@@ -0,0 +1,28 @@
+[NotifierSkin]
+CloseX=233
+CloseY=5
+PrevX=233
+PrevY=26
+NextX=233
+NextY=82
+WriteX=233
+WriteY=103
+TextRect=6,22,223,97
+TitleRect=6,5,223,20
+TextFontFamily=Arial
+TextFontSize=9
+TitleFontFamily=Arial
+TitleFontSize=9
+CurTextColor=45,0,0
+OldTextColor1=40,20,20
+OldTextColor2=40,40,40
+OldTextColor3=60,60,60
+OldTextColor4=85,85,85
+OldTextColor5=90,90,90
+OldTextColor6=95,95,95
+HistoricTextColor=125,125,125
+TitleColor=120,70,70
+InputFontFamily=Arial
+InputFontSize=9
+InputHeight=19
+BlinkTimeout=650
diff --git a/src/modules/notifier/notifiermessage.cpp b/src/modules/notifier/notifiermessage.cpp
new file mode 100644
index 00000000..1e91b5de
--- /dev/null
+++ b/src/modules/notifier/notifiermessage.cpp
@@ -0,0 +1,107 @@
+//=============================================================================
+//
+// File : notifiermessage.cpp
+// Created on mar 02 nov 2004 02:41:18 by Iacopo
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2004 Iacopo <iakko@siena.linux.it>
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//=============================================================================
+
+#include "notifiermessage.h"
+#include "notifierwindow.h"
+
+#include "kvi_iconmanager.h"
+#include "kvi_config.h"
+#include "kvi_app.h"
+#include "kvi_window.h"
+
+#include "kvi_locale.h"
+#include "kvi_frame.h"
+#include "kvi_mirccntrl.h"
+#include "kvi_options.h"
+
+/*
+#ifdef COMPILE_ON_WINDOWS
+ #include <windows.h>
+#endif
+
+#ifdef COMPILE_KDE_SUPPORT
+ #include <netwm.h>
+#endif
+*/
+
+#include <qapplication.h>
+#include <qpainter.h>
+#include <qimage.h>
+#include <qdesktopwidget.h>
+#include <qtooltip.h>
+
+#ifdef COMPILE_USE_QT4
+ #define QPopupMenu Q3PopupMenu
+ #include <q3popupmenu.h>
+#else
+ #include <qpopupmenu.h>
+#endif
+
+extern kvi_time_t g_tNotifierDisabledUntil;
+
+KviNotifierMessage::KviNotifierMessage(KviNotifierWindow * pNotifierWindow, QPixmap * pImage, const QString &szText)
+{
+ m_pText = new QSimpleRichText(KviMircCntrl::stripControlBytes(szText),pNotifierWindow->defaultFont());
+ m_pText->setWidth(pNotifierWindow->textWidth());
+ m_pImage = pImage;
+ m_bHistoric = false;
+}
+
+KviNotifierMessage::~KviNotifierMessage()
+{
+ delete m_pText;
+ if(m_pImage)delete m_pImage;
+}
+
+static void increase_transparency(QImage &buffer,QImage &srcimg,int iDivisor)
+{
+ buffer.create(srcimg.width(),srcimg.height(),32);
+ buffer.setAlphaBuffer(true);
+
+ for(int y = 0;y < buffer.height();y++)
+ {
+ QRgb * dst = (QRgb *)buffer.scanLine(y);
+ QRgb * end = dst + buffer.width();
+ QRgb * src = (QRgb *)srcimg.scanLine(y);
+
+ while(dst < end)
+ {
+ *dst = qRgba(qRed(*src),qGreen(*src),qBlue(*src),qAlpha(*src) / iDivisor);
+ dst++;
+ src++;
+ }
+ }
+}
+
+void KviNotifierMessage::setHistoric()
+{
+ m_bHistoric = true;
+ if(!m_pImage)return;
+ if(!m_pImage->hasAlphaChannel())return;
+ QImage tmp;
+ QImage out = m_pImage->convertToImage();
+ increase_transparency(tmp,out,2);
+ m_pImage->convertFromImage(tmp);
+}
+
diff --git a/src/modules/notifier/notifiermessage.h b/src/modules/notifier/notifiermessage.h
new file mode 100644
index 00000000..da4a6df2
--- /dev/null
+++ b/src/modules/notifier/notifiermessage.h
@@ -0,0 +1,97 @@
+#ifndef _NOTIFIERMESSAGE_H_
+#define _NOTIFIERMESSAGE_H_
+//=============================================================================
+//
+// File : notifiermessage.h
+// Created on mar 02 nov 2004 02:41:18 by
+// Iacopo Palazzi < iakko(at)siena(dot)linux(dot)it >
+//
+// This file is part of the KVIrc distribution
+// Copyright (C) 2004 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
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//=============================================================================
+
+
+#include "kvi_settings.h"
+
+#include <qwidget.h>
+#include <qrect.h>
+#include <qtimer.h>
+#include <qpixmap.h>
+#include <qimage.h>
+#include <qfont.h>
+#include <qcolor.h>
+#include <qlineedit.h>
+
+#include "kvi_qstring.h"
+#include "kvi_pointerlist.h"
+#include "kvi_time.h"
+
+#ifdef COMPILE_USE_QT4
+ #define QSimpleRichText Q3SimpleRichText
+ #define QPopupMenu Q3PopupMenu
+ #include <q3popupmenu.h>
+ #include <q3simplerichtext.h>
+#else
+ #include <qsimplerichtext.h>
+#endif
+
+class KviWindow;
+class KviNotifierWindow;
+
+class QPopupMenu;
+
+class KviNotifierMessage
+{
+ friend class KviNotifierWindow;
+public:
+ KviNotifierMessage(KviNotifierWindow * pNotifierWindow, QPixmap * pImage, const QString &szText);
+ ~KviNotifierMessage();
+
+// ================================
+// Put members declaration below...
+// ================================
+private:
+
+public:
+
+protected:
+ KviWindow * m_pWindow;
+ QPixmap * m_pImage;
+ QSimpleRichText * m_pText;
+ bool m_bHistoric;
+
+// ================================
+// Put methods declaration below...
+// ================================
+private:
+
+public:
+ bool historic(){ return m_bHistoric; };
+ void setHistoric();
+ void setWindow(KviWindow * pWnd){ m_pWindow = pWnd; };
+ QPixmap * image(){ return m_pImage; };
+ QSimpleRichText * text(){ return m_pText; };
+
+protected:
+
+
+};
+
+#define NUM_OLD_COLORS 6
+
+#endif //!_NOTIFIERMESSAGE_H_
diff --git a/src/modules/notifier/notifiersettings.h b/src/modules/notifier/notifiersettings.h
new file mode 100644
index 00000000..b694dc59
--- /dev/null
+++ b/src/modules/notifier/notifiersettings.h
@@ -0,0 +1,66 @@
+#ifndef _NOTIFIER_SETTINGS_H_
+#define _NOTIFIER_SETTINGS_H_
+//=============================================================================
+//
+// File : kvinotifierwindowcaption.h
+// Created on gio 30 dic 2004 21:21:33 by Iacopo Palazzi
+//
+// This file is part of the Notifier - KVIrc Distribution distribution
+// Copyright (C) 2004 Iacopo Palazzi < iakko(at)siena(dot)linux(dot)it >
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//=============================================================================
+
+// Global settings for KviNotifier
+
+
+
+#define WDG_MIN_WIDTH 370
+#define WDG_MIN_HEIGHT 150
+#define WDG_BORDER_THICKNESS 5
+#define SPACING 2
+
+#define WDG_ICON_OUT 0
+#define WDG_ICON_OVER 1
+#define WDG_ICON_CLICKED 2
+#define WDG_ICON_ON 3
+#define WDG_ICON_OFF 4
+
+#define NTF_TABS_FONT_BASELINE 8
+
+#define MAX_MESSAGES_IN_WINDOW 20
+// keep hidden messages for 600 seconds : 10 min
+#define MAX_MESSAGE_LIFETIME 600
+
+#define OPACITY_STEP 0.07
+
+#define NUM_OLD_COLORS 6
+
+#define WDG_UPSX 1
+#define WDG_UP 2
+#define WDG_UPDX 3
+#define WDG_DWNSX 4
+#define WDG_DWN 5
+#define WDG_DWNDX 6
+#define WDG_SX 7
+#define WDG_DX 8
+
+#define m_mac_bkgColor QColor(236,233,216) // Light-brown color of notifier background widget
+
+enum State { Hidden, Showing, Visible, Hiding , FocusingOff, FocusingOn };
+enum TabState { Normal, Highlighted, Changed };
+
+#endif //_NOTIFIER_SETTINGS_H_
diff --git a/src/modules/notifier/notifierwindow.cpp b/src/modules/notifier/notifierwindow.cpp
new file mode 100644
index 00000000..d275be23
--- /dev/null
+++ b/src/modules/notifier/notifierwindow.cpp
@@ -0,0 +1,1427 @@
+//==================================================================================
+//
+// File : notifierwindow.cpp
+// Creation date : Tue Jul 6 2004 20:25:12 CEST by Szymon Stefanek
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2004 Iacopo Palazzi < iakko(at)siena.linux.it >
+//
+// This program is FREE software. You can redistribute it and/or
+// modify it under the linkss of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//==================================================================================
+#include "kvi_settings.h"
+
+#ifdef COMPILE_USE_QT4
+ #define QPopupMenu Q3PopupMenu
+ #define QSimpleRichText Q3SimpleRichText
+
+ #include <q3popupmenu.h>
+ #include <q3simplerichtext.h>
+#else
+ #include <qpopupmenu.h>
+ #include <qsimplerichtext.h>
+#endif
+
+ #include <qpainter.h>
+
+#include "notifiermessage.h"
+#include "notifierwindow.h"
+
+#include "kvi_iconmanager.h"
+#include "kvi_config.h"
+#include "kvi_app.h"
+#include "kvi_window.h"
+
+#include "kvi_locale.h"
+#include "kvi_frame.h"
+#include "kvi_mirccntrl.h"
+#include "kvi_options.h"
+#include "kvi_userinput.h"
+
+#include <qapplication.h>
+#include <qimage.h>
+#include <qdesktopwidget.h>
+#include <qtooltip.h>
+#include <qevent.h>
+#include <qpen.h>
+#include <qfontmetrics.h>
+#include <qregexp.h>
+
+#include "notifierwindowbody.h"
+#include "notifierwindowborder.h"
+#include "notifierwindowprogressbar.h"
+#include "notifierwindowtabs.h"
+
+extern KviNotifierWindow * g_pNotifierWindow;
+
+KviNotifierWindow::KviNotifierWindow()
+: QWidget(0,"kvirc_notifier_window",
+#ifdef COMPILE_ON_WINDOWS
+ Qt::WStyle_Customize |
+ Qt::WStyle_NoBorder |
+ Qt::WStyle_Tool |
+ Qt::WStyle_StaysOnTop)
+#else
+ Qt::WStyle_Customize |
+ Qt::WStyle_NoBorder |
+#ifndef Q_OS_MACX
+ Qt::WStyle_Tool |
+ Qt::WX11BypassWM |
+#endif
+ Qt::WStyle_StaysOnTop)
+#endif
+{
+
+ g_pNotifierWindow = this;
+
+ m_eState = Hidden;
+ m_dOpacity = 0.0;
+ m_pShowHideTimer = 0;
+ m_pBlinkTimer = 0;
+ m_tAutoHideAt = 0;
+ m_tStartedAt=0;
+ m_pAutoHideTimer = 0;
+ m_pProgressTimer = 0;
+
+ m_pWndBorder = new KviNotifierWindowBorder();
+
+ reloadImages();
+
+ KviStr buffer;
+ g_pApp->getReadOnlyConfigPath(buffer,"libkvinotifier.kvc",KviApp::ConfigPlugins,true);
+
+ KviConfig cfg(buffer.ptr(),KviConfig::Read);
+
+ cfg.setGroup("NotifierSkin");
+
+ QString szFamily = cfg.readEntry("TextFontFamily","Arial");
+ m_pDefaultFont = new QFont(szFamily,cfg.readIntEntry("TextFontSize",9));
+ szFamily = cfg.readEntry("TitleFontFamily","Arial");
+ m_pTitleFont = new QFont(szFamily,cfg.readIntEntry("TitleFontSize",9));
+
+ m_clrCurText = cfg.readColorEntry("CurTextColor",QColor(40,0,0));
+ m_clrHistoricText = cfg.readColorEntry("HistoricTextColor",QColor(125,125,125));
+ m_clrTitle = QColor(255,255,255); //cfg.readColorEntry("TitleColor",QColor(0,0,0));
+ for(int i=0;i<NUM_OLD_COLORS;i++)
+ {
+ KviStr szKey;
+ szKey.sprintf("OldTextColor%d",i + 1);
+ m_clrOldText[i] = cfg.readColorEntry(szKey.ptr(),QColor(90,90,90));
+ }
+
+ m_iBlinkTimeout = cfg.readIntEntry("BlinkTimeout",650);
+ if(m_iBlinkTimeout < 100)m_iBlinkTimeout = 100;
+ m_iInputHeight = cfg.readIntEntry("InputHeight",20);
+ if(m_iInputHeight < 10)m_iInputHeight = 10;
+
+ setBackgroundMode(Qt::NoBackground);
+#ifdef COMPILE_USE_QT4
+ setFocusPolicy(Qt::NoFocus);
+#else
+ setFocusPolicy(QWidget::NoFocus);
+#endif
+ setMouseTracking(true);
+ //setCursor(m_cursor);
+
+ hide();
+ m_pLineEdit = new QLineEdit(this);
+ m_pLineEdit->setGeometry(0,0,0,0);
+ m_pLineEdit->hide();
+ m_pLineEdit->installEventFilter(this);
+ connect(m_pLineEdit,SIGNAL(returnPressed()),this,SLOT(returnPressed()));
+
+ szFamily = cfg.readEntry("InputFontFamily","Arial");
+ m_pLineEdit->setFont(QFont(szFamily,cfg.readIntEntry("InputFontSize",9)));
+
+ m_bBlinkOn = false;
+
+ m_bCloseDown = false;
+ m_bPrevDown = false;
+ m_bNextDown = false;
+ m_bWriteDown = false;
+
+ m_bKeyShiftPressed = false;
+
+ m_bLeftButtonIsPressed = false;
+ m_bDiagonalResizing = false;
+ m_bResizing = false;
+
+ m_pContextPopup = 0;
+ m_pDisablePopup = 0;
+
+ m_bDragging = false;
+
+ m_bDisableHideOnMainWindowGotAttention = false;
+
+ // Positioning the notifier bottom-right
+ int iWidth = m_pixBackground.width();
+ int iHeight = m_pixBackground.height();
+ QDesktopWidget * w = QApplication::desktop();
+ QRect r = w->availableGeometry(w->primaryScreen()); //w->screenGeometry(w->primaryScreen());
+
+ /*debug("r.x(),r.y(): %d,%d",r.x(),r.y());
+ debug("r.width(),r.height(): %d,%d",r.width(),r.height());*/
+
+ m_wndRect.setRect( r.x() + r.width() - (iWidth + SPACING), r.y() + r.height() - (iHeight + SPACING), iWidth, iHeight );
+
+ //m_pWndBorder = new KviNotifierWindowBorder();
+ m_pWndTabs = new KviNotifierWindowTabs(m_pWndBorder->tabsRect());
+ m_pWndBody = new KviNotifierWindowBody(m_pWndBorder->bodyRect());
+
+ m_pProgressBar = new KviNotifierWindowProgressBar(m_pWndBorder->progressRect());
+
+ // FIXME: Ugly global-font initialization..
+ QFontMetrics titleFontMetrics(*m_pTitleFont);
+ m_pWndBorder->centerTitle(titleFontMetrics.height());
+
+ connect(g_pApp,SIGNAL(reloadImages()),this,SLOT(reloadImages()));
+}
+
+KviNotifierWindow::~KviNotifierWindow()
+{
+ stopShowHideTimer();
+ stopBlinkTimer();
+ stopAutoHideTimer();
+ delete m_pDefaultFont;
+ delete m_pTitleFont;
+ delete m_pWndBorder;
+ delete m_pWndTabs;
+ delete m_pWndBody;
+}
+
+int KviNotifierWindow::countTabs() {
+ return m_pWndTabs->count();
+}
+
+void KviNotifierWindow::reloadImages()
+{
+ m_pixBackground.resize(WDG_MIN_WIDTH,WDG_MIN_HEIGHT);
+ m_pixBackground.fill();
+ m_pixBackgroundHighlighted.resize(m_pixBackground.size());
+ m_pixBackgroundHighlighted.fill();
+
+ m_pWndBorder->resize(m_pixBackground.size());
+}
+
+
+void KviNotifierWindow::addMessage(KviWindow * pWnd,const QString &szImageId,const QString &szText,unsigned int uMessageTime)
+{
+ QPixmap * pIcon;
+ QString szMessage=szText;
+ szMessage.replace( QRegExp("\r([^\r])*\r([^\r])+\r"), "\\2" );
+ if(szImageId.isEmpty())pIcon = 0;
+ else pIcon = g_pIconManager->getImage(szImageId);
+
+ KviNotifierMessage * m = new KviNotifierMessage(this,pIcon ? new QPixmap(*pIcon) : 0,szMessage);
+
+ m_pWndTabs->addMessage(pWnd, m); // Adds a tab about the sender pWnd
+
+ if(!isActiveWindow())
+ startBlinking();
+
+ if(uMessageTime > 0)
+ {
+ kvi_time_t tAutoHide = kvi_unixTime() + uMessageTime;
+ if(m_tAutoHideAt < tAutoHide)
+ {
+ m_tAutoHideAt = tAutoHide;
+ if(m_eState == Visible)startAutoHideTimer();
+ }
+ } else {
+ // never hide
+ stopAutoHideTimer();
+ m_tAutoHideAt = 0;
+ }
+
+ if(pWnd)
+ {
+ if(pWnd->hasAttention())m_bDisableHideOnMainWindowGotAttention = true;
+ }
+
+ //m_pWndTabs->setCurrentMessage(m);
+ if(isVisible())update();
+ // else the line edit was hidden
+}
+
+
+int KviNotifierWindow::textWidth() {
+ return m_pWndBody->textRect().width() - 20;
+};
+
+void KviNotifierWindow::stopShowHideTimer()
+{
+ if(!m_pShowHideTimer)return;
+ delete m_pShowHideTimer;
+ m_pShowHideTimer = 0;
+}
+
+void KviNotifierWindow::stopBlinkTimer()
+{
+ if(!m_pBlinkTimer)return;
+ delete m_pBlinkTimer;
+ m_pBlinkTimer = 0;
+}
+
+void KviNotifierWindow::stopAutoHideTimer()
+{
+ if(m_pProgressTimer) delete m_pProgressTimer;
+ m_pProgressTimer = 0;
+
+ if(!m_pAutoHideTimer)return;
+ delete m_pAutoHideTimer;
+ m_pAutoHideTimer = 0;
+ m_pProgressBar->setProgress(0);
+}
+
+void KviNotifierWindow::computeRect()
+{
+ int iWidth = m_pixBackground.width();
+ int iHeight = m_pixBackground.height();
+ m_pWndBorder->setGeometry(QPoint(x(),y()), QSize(iWidth,iHeight));
+ update();
+}
+
+void KviNotifierWindow::doShow(bool bDoAnimate)
+{
+ if(KVI_OPTION_BOOL(KviOption_boolForciblyDisableNotifier))return;
+
+ kvi_time_t tNow = kvi_unixTime();
+ if(g_tNotifierDisabledUntil > tNow)return;
+ g_tNotifierDisabledUntil = 0;
+
+ switch(m_eState)
+ {
+ case Showing:
+ // already showing up
+ return;
+ break;
+ case Visible:
+ // already visible
+ return;
+ break;
+ case Hiding:
+ // ops.. hiding!
+ m_eState = Showing;
+ break;
+ case Hidden:
+ stopShowHideTimer();
+ stopBlinkTimer();
+
+ m_bDragging = false;
+ m_bCloseDown = false;
+ m_bPrevDown = false;
+ m_bNextDown = false;
+ m_bWriteDown = false;
+ m_bBlinkOn = false;
+ #if (!defined COMPILE_USE_QT4) || !(defined(COMPILE_USE_QT4) && (defined(COMPILE_ON_WINDOWS) || defined(Q_OS_MACX)))
+ m_imgDesktop = QPixmap::grabWindow(
+ QApplication::desktop()->winId(),
+ m_wndRect.x(),
+ m_wndRect.y(),
+ m_wndRect.width(),
+ m_wndRect.height()).convertToImage();
+ #endif
+ // QPixmap tmp = QPixmap::grabWindow( QApplication::desktop()->winId(),m_wndRect.x(), m_wndRect.y(), m_wndRect.width(), m_wndRect.height());
+ // tmp.save("/root/pix.png","PNG");
+ m_pixForeground.resize(m_pixBackground.size());
+ m_imgBuffer.create(m_pixBackground.width(),m_pixBackground.height(),32);
+ if(bDoAnimate)
+ {
+ m_pShowHideTimer = new QTimer();
+ connect(m_pShowHideTimer,SIGNAL(timeout()),this,SLOT(heartbeat()));
+ m_dOpacity = OPACITY_STEP;
+ m_eState = Showing;
+ m_bCrashShowWorkAround=true;
+ #if defined(COMPILE_USE_QT4) && (defined(COMPILE_ON_WINDOWS) || defined(Q_OS_MACX))
+ setWindowOpacity(m_dOpacity);
+ #endif
+ show();
+ #if defined(COMPILE_USE_QT4) && (defined(COMPILE_ON_WINDOWS) || defined(Q_OS_MACX))
+ m_pShowHideTimer->start(40);
+ #else
+ m_pShowHideTimer->start(100);
+ #endif
+ computeRect();
+ m_bCrashShowWorkAround=false;
+ //show();
+
+ } else {
+ m_dOpacity = 1.0;
+ m_eState = Visible;
+ show();
+ startBlinking();
+ startAutoHideTimer();
+ }
+ break;
+ }
+}
+
+bool KviNotifierWindow::shouldHideIfMainWindowGotAttention()
+{
+ if(m_bDisableHideOnMainWindowGotAttention)return false;
+ KviNotifierWindowTab * t = m_pWndTabs->currentTab();
+ if(!t)return false;
+ if(!t->window())return false;
+ return t->window()->hasAttention();
+}
+
+
+void KviNotifierWindow::heartbeat()
+
+{
+ bool bIncreasing;
+ double targetOpacity = 0; //qt4
+ switch(m_eState)
+ {
+ case Hidden:
+ hideNow();
+ break;
+ case Visible:
+ stopShowHideTimer();
+ m_dOpacity = 1.0;
+ if(!isVisible())show(); //!!!
+ break;
+ case Showing:
+ // if the main window got attention while
+ // showing up then just hide now
+ if(shouldHideIfMainWindowGotAttention())
+ {
+ m_eState = Hiding;
+ } else {
+ m_dOpacity += OPACITY_STEP;
+#ifdef COMPILE_USE_QT4
+ targetOpacity = isActiveWindow() ? KVI_OPTION_UINT(KviOption_uintNotifierActiveTransparency) : KVI_OPTION_UINT(KviOption_uintNotifierInactiveTransparency);
+
+ targetOpacity/=100;
+ if(m_dOpacity >= targetOpacity)
+ {
+ m_dOpacity = targetOpacity;
+#else
+ if(m_dOpacity >= 1.0)
+ {
+ m_dOpacity = 1.0;
+#endif
+ m_eState = Visible;
+ stopShowHideTimer();
+ startBlinking();
+ startAutoHideTimer();
+ }
+
+ if(!isVisible())show(); //!!!
+ if(m_pLineEdit->isVisible())m_pLineEdit->hide();
+ #if defined(COMPILE_USE_QT4) && (defined(COMPILE_ON_WINDOWS) || defined(Q_OS_MACX))
+ setWindowOpacity(m_dOpacity);
+ #endif
+ update();
+
+ }
+ break;
+#ifdef COMPILE_USE_QT4
+ case FocusingOn:
+ targetOpacity = KVI_OPTION_UINT(KviOption_uintNotifierActiveTransparency);
+ targetOpacity/=100;
+ bIncreasing = targetOpacity>m_dOpacity;
+ m_dOpacity += bIncreasing?
+ OPACITY_STEP : -(OPACITY_STEP);
+ if( (bIncreasing && (m_dOpacity >= targetOpacity) ) ||
+ (!bIncreasing && (m_dOpacity <= targetOpacity) )
+ )
+ {
+ m_dOpacity = targetOpacity;
+ m_eState = Visible;
+ stopShowHideTimer();
+ }
+
+ setWindowOpacity(m_dOpacity);
+ break;
+ case FocusingOff:
+ targetOpacity = KVI_OPTION_UINT(KviOption_uintNotifierInactiveTransparency);
+ targetOpacity/=100;
+ bIncreasing = targetOpacity>m_dOpacity;
+ m_dOpacity += bIncreasing ? OPACITY_STEP : -(OPACITY_STEP);
+ //debug("%f %f %i %i",m_dOpacity,targetOpacity,bIncreasing,(m_dOpacity >= targetOpacity));
+ if( (bIncreasing && (m_dOpacity >= targetOpacity) ) ||
+ (!bIncreasing && (m_dOpacity <= targetOpacity) )
+ )
+ {
+ m_dOpacity = targetOpacity;
+ m_eState = Visible;
+ stopShowHideTimer();
+ }
+
+ setWindowOpacity(m_dOpacity);
+ break;
+#endif
+ case Hiding:
+ m_dOpacity -= OPACITY_STEP;
+ #if defined(COMPILE_USE_QT4) && (defined(COMPILE_ON_WINDOWS) || defined(Q_OS_MACX))
+ setWindowOpacity(m_dOpacity);
+ #endif
+ if(m_pLineEdit->isVisible())m_pLineEdit->hide();
+ if(m_dOpacity <= 0.0)hideNow();
+ else update();
+ break;
+ }
+}
+
+void KviNotifierWindow::hideNow()
+{
+ stopBlinkTimer();
+ stopShowHideTimer();
+ stopAutoHideTimer();
+ m_eState = Hidden;
+ m_dOpacity = 0.0;
+ m_tAutoHideAt = 0;
+
+ if(m_pLineEdit->isVisible())m_pLineEdit->hide();
+ hide();//if(isVisible())hide();
+}
+
+void KviNotifierWindow::doHide(bool bDoAnimate)
+{
+ stopAutoHideTimer();
+ switch(m_eState)
+ {
+ case Hiding:
+ // already hiding up
+ if(!bDoAnimate)hideNow();
+ return;
+ break;
+ case Hidden:
+ // already hidden
+ if(isVisible())hideNow(); // !!!
+ return;
+ break;
+ case Showing:
+ // ops.. hiding!
+ if(!bDoAnimate)hideNow();
+ else {
+ // continue animating, but hide
+ m_eState = Hiding;
+ }
+ break;
+ case Visible:
+ stopBlinkTimer();
+ stopShowHideTimer();
+ if(m_pLineEdit->isVisible())m_pLineEdit->hide();
+ if((!bDoAnimate) || (x() != m_pWndBorder->x()) || (y() != m_pWndBorder->y()))
+ {
+
+ //debug ("just hide quickly with notifier x() %d and notifier y() % - WBorderx() %d and WBordery() %d and bDoanimate %d",x(),y(),m_pWndBorder->x(),m_pWndBorder->y(),bDoAnimate);
+ // the user asked to not animate or
+ // the window has been moved and the animation would suck anyway
+ // just hide quickly
+ hideNow();
+ } else {
+ //debug ("starting hide animation notifier x() %d and notifier y() % - WBorderx() %d and WBordery() %d and bDoanimate %d",x(),y(),m_pWndBorder->x(),m_pWndBorder->y(),bDoAnimate);
+ m_pShowHideTimer = new QTimer();
+ connect(m_pShowHideTimer,SIGNAL(timeout()),this,SLOT(heartbeat()));
+ m_dOpacity = 1.0 - OPACITY_STEP;
+ m_eState = Hiding;
+ #if defined(COMPILE_USE_QT4) && (defined(COMPILE_ON_WINDOWS) || defined(Q_OS_MACX))
+ setWindowOpacity(m_dOpacity);
+ update();
+ m_pShowHideTimer->start(40);
+ #else
+ update();
+ m_pShowHideTimer->start(100);
+ #endif
+
+
+ }
+ break;
+ }
+}
+
+void KviNotifierWindow::showEvent(QShowEvent *e)
+{
+ computeRect();
+ setGeometry(m_wndRect); // w_win = w_wndRect
+
+}
+
+void KviNotifierWindow::hideEvent(QHideEvent * e)
+{
+ if (m_bCrashShowWorkAround) return;
+ stopBlinkTimer();
+ stopShowHideTimer();
+ stopAutoHideTimer();
+ m_eState = Hidden; // make sure it's true
+ m_tAutoHideAt = 0; // make sure it's true
+ markAllMessagesAsHistoric();
+ m_bDisableHideOnMainWindowGotAttention = false;
+}
+
+void KviNotifierWindow::startBlinking()
+{
+ stopBlinkTimer();
+ m_bBlinkOn = false;
+
+
+ if(!KVI_OPTION_BOOL(KviOption_boolDisableNotifierFlashing))
+ {
+ m_pBlinkTimer = new QTimer();
+ connect(m_pBlinkTimer,SIGNAL(timeout()),this,SLOT(blink()));
+ m_iBlinkCount = 0;
+ m_pBlinkTimer->start(m_iBlinkTimeout);
+ }
+}
+
+void KviNotifierWindow::startAutoHideTimer()
+{
+ stopAutoHideTimer();
+ m_tStartedAt = kvi_unixTime();
+ m_qtStartedAt.start();
+ if(m_tAutoHideAt <= m_tStartedAt)return;
+
+ int nSecs = m_tAutoHideAt - m_tStartedAt;
+ if(nSecs < 5)nSecs = 5;
+ m_pAutoHideTimer = new QTimer();
+ connect(m_pAutoHideTimer,SIGNAL(timeout()),this,SLOT(autoHide()));
+ m_pAutoHideTimer->start(nSecs * 1000);
+
+ m_pProgressTimer= new QTimer();
+ connect(m_pProgressTimer,SIGNAL(timeout()),this,SLOT(progressUpdate()));
+ m_pProgressTimer->start(60);
+}
+
+void KviNotifierWindow::autoHide()
+{
+ m_tAutoHideAt = 0;
+ stopAutoHideTimer();
+ doHide(true);
+}
+
+void KviNotifierWindow::blink()
+{
+ m_iBlinkCount++;
+ m_bBlinkOn = !m_bBlinkOn;
+
+ if(m_iBlinkCount > 100)
+ {
+ // stop blinking at a certain point and remain highlighted
+ m_bBlinkOn = true;
+ stopBlinkTimer();
+ } else {
+ // if the main window got attention while
+ // showing up then just hide now
+ if(shouldHideIfMainWindowGotAttention())
+ {
+ doHide(false); // don't animate: the background has almost surely changed
+ return;
+ }
+ }
+ update();
+}
+
+void KviNotifierWindow::markAllMessagesAsHistoric()
+{
+ if (!m_pWndTabs) return;
+ m_pWndTabs->markAllMessagesAsHistoric();
+}
+
+
+static void blend_images(QImage &buffer,QImage &background,QImage &foreground,double dValue)
+{
+ for(int y = 0;y < buffer.height();y++)
+ {
+ QRgb * dst = (QRgb *)buffer.scanLine(y);
+ QRgb * end = dst + buffer.width();
+ QRgb * bkg = (QRgb *)background.scanLine(y);
+ QRgb * fgn = (QRgb *)foreground.scanLine(y);
+
+ double dRemaining = 1.0 - dValue;
+
+ while(dst < end)
+ {
+ *dst = qRgb(
+ (int)((qRed(*bkg) * dRemaining) + (qRed(*fgn) * dValue)),
+ (int)((qGreen(*bkg) * dRemaining) + (qGreen(*fgn) * dValue)),
+ (int)((qBlue(*bkg) * dRemaining) + (qBlue(*fgn) * dValue))
+ );
+ dst++;
+ bkg++;
+ fgn++;
+ }
+
+ }
+}
+
+void KviNotifierWindow::paintEvent(QPaintEvent * e)
+{
+
+/*
+ if(m_bBlinkOn)
+ bitBlt(&m_pixForeground,QPoint(0,0),&m_pixBackgroundHighlighted);
+ else
+ bitBlt(&m_pixForeground,QPoint(0,0),&m_pixBackground);
+
+ QPainter p(&m_pixForeground);
+*/
+ redrawWindow();
+ redrawText();
+ if(m_dOpacity < 1.0)
+ {
+ QPainter px(this);
+
+ #if defined(COMPILE_USE_QT4) && (defined(COMPILE_ON_WINDOWS) || defined(Q_OS_MACX))
+ px.drawPixmap(0,0,m_pixForeground);
+ #else
+ QImage temp_image = m_pixForeground.convertToImage();
+ blend_images(m_imgBuffer,m_imgDesktop,temp_image,m_dOpacity);
+ px.drawImage(0,0,m_imgBuffer);
+ #endif
+ px.end();
+ } else {
+#ifdef COMPILE_USE_QT4
+ QPainter px(this);
+ px.drawPixmap(0,0,m_pixForeground);
+#else
+ bitBlt(this,QPoint(0,0),&m_pixForeground);
+#endif
+ }
+}
+
+void KviNotifierWindow::redrawText()
+{
+ QPainter p(&m_pixForeground);
+
+ // the current tab
+ KviNotifierWindowTab * tab = m_pWndTabs->currentTab();
+ if(!tab)return;
+
+ // it's message list
+ KviPointerList<KviNotifierMessage> * l = tab->messageList();
+ if(!l)return;
+ if(l->isEmpty())return;
+
+ // the current message
+ KviNotifierMessage * cur = tab->currentMessage();
+ if(!cur)cur = l->last();
+
+ // this is useful in several places
+ KviNotifierMessage * last = l->last();
+
+ // make sure that we can loop
+ int iIdx = l->findRef(cur);
+ if(iIdx == -1)
+ {
+ tab->setCurrentMessage(last);
+ cur = last;
+ iIdx = l->findRef(cur);
+ }
+
+ int y = m_pWndBody->textRect().y() + m_pWndBody->textRect().height();
+
+ if(m_pLineEdit->isVisible())y -= (m_pLineEdit->height() + 4);
+
+ QColorGroup grp = colorGroup();
+
+ int idx = iIdx;
+ KviNotifierMessage * m = cur;
+ while(m && (y > m_pWndBody->textRect().y()))
+ {
+ int iHeight = m->text()->height();
+ if(iHeight < 18)iHeight = 18;
+ y -= iHeight;
+ if(m->historic())
+ {
+ grp.setColor(QColorGroup::Text,m_clrHistoricText);
+ } else {
+ if(m == last)
+ grp.setColor(QColorGroup::Text,m_clrCurText);
+ else {
+ int iClrIdx = l->count() - (idx + 2);
+ if(iClrIdx < 0)iClrIdx = 0;
+ else if(iClrIdx >= NUM_OLD_COLORS)iClrIdx = (NUM_OLD_COLORS - 1);
+ grp.setColor(QColorGroup::Text,m_clrOldText[iClrIdx]);
+ }
+ }
+ int iMaxY = y > m_pWndBody->textRect().y() ? y : m_pWndBody->textRect().y();
+ QRect clip(m_pWndBody->textRect().x() + 20,iMaxY,m_pWndBody->textRect().width() - 20,iHeight);
+
+ m->text()->draw(&p,m_pWndBody->textRect().x() + 20,y,clip,grp); //
+ if(y > m_pWndBody->textRect().y())
+ {
+ if(m->image())
+ p.drawPixmap(m_pWndBody->textRect().x() + 1,y + 1,*(m->image()),0,0,16,16);
+ }
+ m = l->prev();
+ idx--;
+ }
+
+ p.setPen(QPen(m_clrTitle));
+ p.setFont(*m_pTitleFont);
+ QString title;
+ KviQString::sprintf(title,"[%d/%d]",iIdx + 1,l->count());
+
+ if(tab->window())
+ {
+ title += " ";
+ title += tab->window()->plainTextCaption();
+ }
+ p.drawText(m_pWndBorder->titleRect(),Qt::AlignLeft | Qt::SingleLine,title);
+ p.end();
+}
+
+void KviNotifierWindow::mouseMoveEvent(QMouseEvent * e)
+{
+
+ //debug ("move on x,y: %d,%d", e->pos().x(), e->pos().y());
+
+ if (!m_bLeftButtonIsPressed) {
+
+ if(checkResizing(e->pos())) goto sartelo;
+
+ /* ### MOUSE-MOVE-EVENT -> m_pWndBorder ### */
+ if (m_pWndBorder->captionRect().contains(e->pos())) {
+ if (m_pWndBorder->closeRect().contains(e->pos())) {
+ m_pWndBorder->setCloseIcon(WDG_ICON_OVER);
+ } else {
+ m_pWndBorder->setCloseIcon(WDG_ICON_OUT);
+ }
+ goto sartelo;
+ }
+
+ if(m_pWndTabs->currentTab())
+ {
+ /* ### MOUSE-MOVE-EVENT -> m_pWndTabs ### */
+ if (m_pWndTabs->rect().contains(e->pos())) {
+ m_pWndTabs->mouseMoveEvent(e);
+ goto sartelo;
+ }
+
+ /* ### MOUSE-MOVE-EVENT -> m_pWndBody ### */
+ if (m_pWndBody->rect().contains(e->pos())) {
+ if (m_pWndBody->rctWriteIcon().contains(e->pos())) {
+ m_pWndBody->setWriteIcon(WDG_ICON_ON);
+ } else {
+ m_pWndBody->setWriteIcon(WDG_ICON_OFF);
+ }
+ goto sartelo;
+ }
+ }
+ /* ### END ### */
+
+sartelo:
+
+ update();
+
+ }
+
+ if(m_bDragging) {
+ setCursor(Qt::SizeAllCursor);
+
+ int w = m_wndRect.width();
+ int h = m_wndRect.height();
+
+ m_wndRect.setX( m_pntPos.x() + cursor().pos().x() - m_pntDrag.x() );
+ m_wndRect.setY( m_pntPos.y() + cursor().pos().y() - m_pntDrag.y() );
+
+ m_wndRect.setWidth(w);
+ m_wndRect.setHeight(h);
+
+ setGeometry(m_wndRect);
+
+ return;
+ } else if (m_bResizing) {
+ resize(e->pos());
+ }
+
+}
+
+void KviNotifierWindow::mousePressEvent(QMouseEvent * e)
+{
+
+ // stop blinking first of all :)
+ bool bWasBlinkOn = m_bBlinkOn;
+ m_bBlinkOn = false;
+ stopBlinkTimer();
+ m_tAutoHideAt = 0;
+ stopAutoHideTimer();
+
+ setActiveWindow();
+ setFocus();
+
+ m_pntClick = e->pos();
+
+ if(e->button() == Qt::RightButton)
+ {
+ contextPopup(mapToGlobal(e->pos()));
+ return;
+ } else if(e->button() == Qt::LeftButton) {
+ m_bLeftButtonIsPressed = true;
+ }
+
+ if(checkResizing(m_pntClick)) goto sartelo;
+
+ if(m_pWndTabs->rect().contains(e->pos()))
+ {
+ m_pWndTabs->mousePressEvent(e);
+ goto sartelo;
+ }
+
+ if(m_pWndBorder->captionRect().contains(e->pos())) {
+ //debug ("Clicked on m_pWndBorder->rect()");
+ if(m_pWndBorder->closeRect().contains(e->pos())) {
+ //debug ("\tClicked on m_pWndBorder->closeRect()");
+ m_bCloseDown = true;
+ m_pWndBorder->setCloseIcon(WDG_ICON_CLICKED);
+ goto sartelo;
+ }
+
+ if( !m_bResizing) {
+ m_bDragging = true;
+ m_pntDrag = cursor().pos();
+ m_pntPos = pos();
+ goto sartelo;
+ }
+ }
+
+ //debug ("x,y: %d,%d - width,height: %d,%d", m_pWndBorder->rect().x(),m_pWndBorder->rect().y(),m_pWndBorder->rect().width(),m_pWndBorder->rect().height());
+
+ if (m_pWndBorder->rect().contains(e->pos())) {
+ if(m_pWndTabs->currentTab())
+ {
+ //debug ("Clicked on m_pWndBody->textRect()");
+ if(m_pWndBody->rctWriteIcon().contains(e->pos()))
+ {
+ m_pWndBody->setWriteIcon(WDG_ICON_CLICKED);
+ showLineEdit(!(m_pLineEdit->isVisible()));
+ }
+
+ if(m_pWndBody->rctPrevIcon().contains(e->pos()) && m_pWndBody->prevIconState()!=WDG_ICON_OFF)
+ {
+ m_bPrevDown = true;
+ m_pWndBody->setPrevIcon(WDG_ICON_CLICKED);
+ prevButtonClicked();
+ }
+
+ if(m_pWndBody->rctNextIcon().contains(e->pos()) && m_pWndBody->nextIconState()!=WDG_ICON_OFF)
+ {
+ m_bNextDown = true;
+ m_pWndBody->setNextIcon(WDG_ICON_CLICKED);
+ nextButtonClicked();
+ }
+ }
+ goto sartelo;
+ }
+
+ if(bWasBlinkOn) goto sartelo; else return;
+
+sartelo:
+ update();
+
+}
+
+void KviNotifierWindow::mouseReleaseEvent(QMouseEvent * e)
+{
+ m_bWriteDown = false;
+ m_bNextDown = false;
+ m_bPrevDown = false;
+ m_bCloseDown = false;
+ m_bLeftButtonIsPressed = false;
+ m_bResizing = false;
+
+ //m_pWndBody->setWriteIcon(WDG_ICON_ON);
+ m_pWndBody->setNextIcon(WDG_ICON_ON);
+ m_pWndBody->setPrevIcon(WDG_ICON_ON);
+ m_pWndTabs->setCloseTabIcon(WDG_ICON_OFF);
+
+ if(m_bDragging)
+ {
+ m_bDragging = false;
+ if(QApplication::overrideCursor()) QApplication::restoreOverrideCursor();
+ return;
+ }
+
+ if(m_pWndBorder->captionRect().contains(e->pos())) {
+
+ if(m_pWndBorder->closeRect().contains(e->pos())) {
+ //debug ("hide now from release event");
+ hideNow();
+ } else {
+ update();
+ }
+
+ }
+
+ if(m_pWndTabs->rect().contains(e->pos()))
+ {
+ m_pWndTabs->mouseReleaseEvent(e);
+ }
+
+ setCursor(-1);
+
+}
+
+void KviNotifierWindow::mouseDoubleClickEvent(QMouseEvent * e)
+{
+ if(!m_pWndBody->textRect().contains(e->pos()))
+ {
+ QWidget::mouseDoubleClickEvent(e);
+ return;
+ }
+
+ KviNotifierWindowTab * tab = m_pWndTabs->currentTab();
+ if(!tab)return;
+
+ if(!tab->window())return;
+
+ hideNow();
+ delayedRaise(tab->window());
+}
+
+void KviNotifierWindow::keyPressEvent(QKeyEvent * e)
+{
+ if (e->key()==Qt::Key_Shift) {
+ m_bKeyShiftPressed = true;
+ return;
+ }
+
+ if (e->key()==Qt::Key_Left && m_bKeyShiftPressed) {
+ m_pWndTabs->prev();
+ return;
+ }
+ if (e->key()==Qt::Key_Right && m_bKeyShiftPressed) {
+ m_pWndTabs->next();
+ return;
+ }
+
+ if (e->key()==Qt::Key_Escape) {
+ hideNow();
+ return;
+ }
+}
+
+void KviNotifierWindow::keyReleaseEvent(QKeyEvent * e)
+{
+ if (e->key()==Qt::Key_Shift) {
+ m_bKeyShiftPressed = false;
+ }
+}
+
+void KviNotifierWindow::delayedRaise(KviWindow * pWnd)
+{
+ m_pWindowToRaise = pWnd;
+ QTimer::singleShot(0,this,SLOT(delayedRaiseSlot()));
+}
+
+void KviNotifierWindow::delayedRaiseSlot()
+{
+ if(!m_pWindowToRaise)return;
+ if(!g_pApp->windowExists(m_pWindowToRaise))return;
+
+ if(m_pWindowToRaise->mdiParent())
+ {
+ if(!m_pWindowToRaise->frame()->isVisible())
+ m_pWindowToRaise->frame()->show();
+
+ m_pWindowToRaise->frame()->raise();
+ //((QWidget *)(m_pWindowToRaise->frame()))->setActiveWindow();
+ m_pWindowToRaise->frame()->setFocus();
+ }
+
+ m_pWindowToRaise->delayedAutoRaise();
+}
+
+bool KviNotifierWindow::checkResizing(QPoint e)
+{
+ if (e.y()<WDG_BORDER_THICKNESS) {
+ if (e.x()<WDG_BORDER_THICKNESS) {
+ //// UP LEFT CORNER ////
+ setCursor(Qt::SizeFDiagCursor);
+ if (m_bLeftButtonIsPressed) {
+ m_bResizing = true;
+ m_whereResizing = WDG_UPSX;
+ }
+ } else if (e.x() > (size().width()-WDG_BORDER_THICKNESS)) {
+ //// UP RIGHT CORNER ////
+ setCursor(Qt::SizeBDiagCursor);
+ if (m_bLeftButtonIsPressed) {
+ m_bResizing = true;
+ m_whereResizing = WDG_UPDX;
+ }
+ } else {
+ //// UP SIDE ////
+ setCursor(Qt::SizeVerCursor);
+ if (m_bLeftButtonIsPressed) {
+ m_bResizing = true;
+ m_whereResizing = WDG_UP;
+ } }
+ } else if (e.y() > (size().height()-WDG_BORDER_THICKNESS)) {
+ if (e.x()<WDG_BORDER_THICKNESS) {
+ //// DOWN LEFT CORNER ////
+ setCursor(Qt::SizeBDiagCursor);
+ if (m_bLeftButtonIsPressed) {
+ m_bResizing = true;
+ m_whereResizing = WDG_DWNSX;
+ }
+ } else if (e.x() > (size().width()-WDG_BORDER_THICKNESS)) {
+ //// DOWN RIGHT CORNER ////
+ setCursor(Qt::SizeFDiagCursor);
+ if (m_bLeftButtonIsPressed) {
+ m_bResizing = true;
+ m_whereResizing = WDG_DWNDX;
+ }
+ } else {
+ //// DOWN SIDE ////
+ setCursor(Qt::SizeVerCursor);
+ if (m_bLeftButtonIsPressed) {
+ m_bResizing = true;
+ m_whereResizing = WDG_DWN;
+ }
+ }
+ } else {
+ if (e.x()<WDG_BORDER_THICKNESS) {
+ //// LEFT SIZE ////
+ setCursor(Qt::SizeHorCursor);
+ if (m_bLeftButtonIsPressed) {
+ m_bResizing = true;
+ m_whereResizing = WDG_SX;
+ }
+ } else if (e.x() > (size().width()-WDG_BORDER_THICKNESS)) {
+ //// RIGHT SIZE ////
+ setCursor(Qt::SizeHorCursor);
+ if (m_bLeftButtonIsPressed) {
+ m_bResizing = true;
+ m_whereResizing = WDG_DX;
+ }
+ } else {
+ //// ELSEWHERE ////
+ m_whereResizing = 0;
+ m_bResizing = false;
+ setCursor(-1);
+ }
+ }
+ return m_bResizing;
+};
+
+
+
+void KviNotifierWindow::resize(QPoint p, bool up)
+{
+ //QPoint aux = mapToGlobal(p);
+
+ if (m_whereResizing==WDG_UPSX || m_whereResizing==WDG_SX || m_whereResizing==WDG_DWNSX) {
+ if ((x() + width() - cursor().pos().x()) < WDG_MIN_WIDTH)
+ m_wndRect.setLeft(x() + width() - WDG_MIN_WIDTH);
+ else
+ m_wndRect.setLeft(cursor().pos().x());
+ }
+
+ if (m_whereResizing == WDG_UPSX || m_whereResizing == WDG_UP || m_whereResizing == WDG_UPDX) {
+ if (y()+height()-cursor().pos().y() < WDG_MIN_HEIGHT)
+ m_wndRect.setTop(y() + height() - WDG_MIN_HEIGHT);
+ else
+ m_wndRect.setTop(cursor().pos().y());
+ }
+
+ if (m_whereResizing == WDG_DX || m_whereResizing == WDG_UPDX || m_whereResizing == WDG_DWNDX) {
+ if ((cursor().pos().x() - x()) > WDG_MIN_WIDTH)
+ m_wndRect.setRight(cursor().pos().x());
+ else
+ m_wndRect.setRight(x() + WDG_MIN_WIDTH);
+ }
+
+ if (m_whereResizing == WDG_DWN || m_whereResizing == WDG_DWNDX || m_whereResizing == WDG_DWNSX) {
+ if ((cursor().pos().y() - y()) > WDG_MIN_HEIGHT)
+ m_wndRect.setBottom(cursor().pos().y());
+ else
+ m_wndRect.setBottom(y() + WDG_MIN_HEIGHT);
+ }
+
+ showLineEdit(m_pLineEdit->isVisible());
+ setGeometry(m_wndRect);
+}
+
+void KviNotifierWindow::redrawWindow()
+{
+ if(m_pixBackground.size()!=m_wndRect.size())
+ {
+ // Redraw only if size was modified..
+ m_pixBackground.resize(m_wndRect.size());
+ m_pixForeground.resize(m_wndRect.size());
+ m_pixBackgroundHighlighted.resize(m_wndRect.size());
+
+ m_pWndBorder->resize( m_wndRect.size() );
+ m_pWndTabs->setWidth( m_pWndBorder->tabsRect().width() );
+ m_pWndBody->resize( m_pWndBorder->bodyRect() );
+ m_pProgressBar->setHeight(m_pWndBorder->bodyRect().height() + m_pWndBorder->tabsRect().height());
+ }
+
+ QPainter paint;
+ if(m_bBlinkOn)
+ {
+ m_pWndBorder->touch();
+ m_pWndTabs->touch();
+ m_pWndBody->touch();
+ paint.begin(&m_pixBackgroundHighlighted);
+ m_pWndBorder->draw(&paint,true);
+ m_pWndTabs->draw(&paint);
+ m_pWndBody->draw(&paint);
+ m_pProgressBar->draw(&paint);
+ paint.end();
+ bitBlt(&m_pixForeground, 0,0, &m_pixBackgroundHighlighted);
+ m_pWndBorder->touch();
+ m_pWndTabs->touch();
+ m_pWndBody->touch();
+ } else {
+ paint.begin(&m_pixBackground);
+ m_pWndBorder->draw(&paint);
+ m_pWndTabs->draw(&paint);
+ m_pWndBody->draw(&paint);
+ m_pProgressBar->draw(&paint);
+ paint.end();
+ bitBlt(&m_pixForeground, 0,0, &m_pixBackground);
+ }
+
+}
+
+inline void KviNotifierWindow::setCursor(int cur) {
+ if (m_cursor.shape() != cur) {
+ if(QApplication::overrideCursor()) QApplication::restoreOverrideCursor();
+ m_cursor.setShape((Qt::CursorShape)cur);
+ QApplication::setOverrideCursor(m_cursor);
+ } else if (cur==-1)
+ if(QApplication::overrideCursor()) QApplication::restoreOverrideCursor();
+}
+
+void KviNotifierWindow::enterEvent(QEvent * e)
+{
+#ifdef COMPILE_USE_QT4
+ if(!m_pShowHideTimer) {
+ m_pShowHideTimer = new QTimer();
+ connect(m_pShowHideTimer,SIGNAL(timeout()),this,SLOT(heartbeat()));
+ }
+ m_eState = FocusingOn;
+ m_pShowHideTimer->start(40);
+#endif
+}
+
+void KviNotifierWindow::leaveEvent(QEvent * e)
+{
+ // Leaving the widget area, restore default cursor
+ m_pWndBorder->resetIcons();
+ m_pWndTabs->resetIcons();
+ if (!m_bResizing)
+ setCursor(-1);
+#ifdef COMPILE_USE_QT4
+ if(!m_pShowHideTimer) {
+ m_pShowHideTimer = new QTimer();
+ connect(m_pShowHideTimer,SIGNAL(timeout()),this,SLOT(heartbeat()));
+ }
+ m_eState = FocusingOff;
+ m_pShowHideTimer->start(40);
+#endif
+}
+
+void KviNotifierWindow::contextPopup(const QPoint &pos)
+{
+ if(!m_pContextPopup)
+ {
+ m_pContextPopup = new QPopupMenu(this);
+ connect(m_pContextPopup,SIGNAL(aboutToShow()),this,SLOT(fillContextPopup()));
+ m_pDisablePopup = new QPopupMenu(this);
+ }
+
+ m_pContextPopup->popup(pos);
+}
+
+void KviNotifierWindow::fillContextPopup()
+{
+ m_pContextPopup->clear();
+
+ m_pContextPopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_CLOSE)),__tr2qs_ctx("Hide","notifier"),this,SLOT(hideNow()));
+ m_pContextPopup->insertSeparator();
+ m_pDisablePopup->clear();
+ m_pDisablePopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_TIME)),__tr2qs_ctx("1 Minute","notifier"),this,SLOT(disableFor1Minute()));
+ m_pDisablePopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_TIME)),__tr2qs_ctx("5 Minutes","notifier"),this,SLOT(disableFor5Minutes()));
+ m_pDisablePopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_TIME)),__tr2qs_ctx("15 Minutes","notifier"),this,SLOT(disableFor15Minutes()));
+ m_pDisablePopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_TIME)),__tr2qs_ctx("30 Minutes","notifier"),this,SLOT(disableFor30Minutes()));
+ m_pDisablePopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_TIME)),__tr2qs_ctx("1 Hour","notifier"),this,SLOT(disableFor60Minutes()));
+ m_pDisablePopup->insertSeparator();
+ m_pDisablePopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_QUIT)),__tr2qs_ctx("Until KVIrc is Restarted","notifier"),this,SLOT(disableUntilKVIrcRestarted()));
+ m_pDisablePopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_QUIT)),__tr2qs_ctx("Permanently (Until Explicitly Enabled)","notifier"),this,SLOT(disablePermanently()));
+
+ m_pContextPopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_QUIT)),__tr2qs_ctx("Disable","notifier"),m_pDisablePopup);
+}
+
+void KviNotifierWindow::disableFor15Minutes()
+{
+ kvi_time_t tNow = kvi_unixTime();
+ g_tNotifierDisabledUntil = tNow + (60 * 15);
+
+ hideNow();
+}
+
+void KviNotifierWindow::disableFor5Minutes()
+{
+ kvi_time_t tNow = kvi_unixTime();
+ g_tNotifierDisabledUntil = tNow + (60 * 5);
+
+ hideNow();
+}
+
+
+void KviNotifierWindow::disableFor1Minute()
+{
+ kvi_time_t tNow = kvi_unixTime();
+ g_tNotifierDisabledUntil = tNow + 60;
+
+ hideNow();
+}
+
+void KviNotifierWindow::disableFor30Minutes()
+{
+ kvi_time_t tNow = kvi_unixTime();
+ g_tNotifierDisabledUntil = tNow + (60 * 30);
+
+ hideNow();
+}
+
+void KviNotifierWindow::disableFor60Minutes()
+{
+ kvi_time_t tNow = kvi_unixTime();
+ g_tNotifierDisabledUntil = tNow + (60 * 60);
+
+ hideNow();
+}
+
+void KviNotifierWindow::disableUntilKVIrcRestarted()
+{
+ kvi_time_t tNow = kvi_unixTime();
+ // in fact we just disable for one year
+ g_tNotifierDisabledUntil = tNow + (3600 * 24 * 360); // one year :D
+ // this will NOT work if the module is forcibly unloaded with /notifier.unload
+ // but the user should never do it :D
+ hideNow();
+}
+
+void KviNotifierWindow::disablePermanently()
+{
+ KVI_OPTION_BOOL(KviOption_boolForciblyDisableNotifier) = true;
+ hideNow();
+}
+
+void KviNotifierWindow::wheelEvent(QWheelEvent * e)
+{
+ if(e->delta() > 0)prevButtonClicked();
+ else nextButtonClicked();
+}
+
+
+void KviNotifierWindow::prevButtonClicked()
+{
+ KviNotifierWindowTab * tab = m_pWndTabs->currentTab();
+ if(!tab)return;
+ tab->setPrevMessageAsCurrent();
+ update();
+}
+
+void KviNotifierWindow::nextButtonClicked()
+{
+ KviNotifierWindowTab * tab = m_pWndTabs->currentTab();
+ if(!tab)return;
+ tab->setNextMessageAsCurrent();
+ update();
+}
+
+void KviNotifierWindow::showLineEdit(bool bShow)
+{
+ if(bShow)
+ {
+ //if(m_pLineEdit->isVisible())return;
+ if(!m_pWndTabs->currentMessage())return;
+ if(!m_pWndTabs->currentTab()->window())return;
+ QToolTip::remove(m_pLineEdit);
+ QString tip = __tr2qs_ctx("Write text or commands to window","notifier");
+ tip += " \"";
+ tip += m_pWndTabs->currentTab()->window()->plainTextCaption();
+ tip += "\"";
+ QToolTip::add(m_pLineEdit,tip);
+ m_pLineEdit->setGeometry(m_pWndBody->textRect().x(),m_pWndBody->textRect().y() + m_pWndBody->textRect().height() - m_iInputHeight,m_pWndBody->textRect().width(),m_iInputHeight);
+ m_pLineEdit->show();
+ m_pLineEdit->setFocus();
+ redrawWindow();
+ setActiveWindow();
+ } else {
+ if(!m_pLineEdit->isVisible())return;
+ m_pLineEdit->hide();
+ setFocus();
+ KviNotifierWindowTab * tab = m_pWndTabs->currentTab();
+ if(tab)tab->setLastMessageAsCurrent();
+ update();
+ }
+}
+
+bool KviNotifierWindow::eventFilter(QObject * pEdit,QEvent * e)
+{
+ if(pEdit != (QObject *)m_pLineEdit)return false; // huh ?
+ if(!m_pLineEdit->isVisible())return false;
+ if(e->type() == QEvent::MouseButtonPress)
+ {
+ bool bWasBlinkOn = m_bBlinkOn;
+ m_bBlinkOn = false;
+ m_tAutoHideAt = 0;
+ stopAutoHideTimer();
+ stopBlinkTimer();
+ setActiveWindow();
+ m_pLineEdit->setFocus();
+ if(bWasBlinkOn)update();
+ return true;
+ }
+ if(e->type() == QEvent::KeyPress)
+ {
+ if(((QKeyEvent *)e)->key() == Qt::Key_Escape)
+ {
+ hideNow();
+ return true;
+ }
+ }
+ return false;
+}
+
+void KviNotifierWindow::returnPressed()
+{
+ if(!m_pLineEdit->isVisible())return;
+
+ KviNotifierWindowTab * tab = m_pWndTabs->currentTab();
+ if(!tab)return;
+ if(!tab->currentMessage())return;
+ if(!tab->window())return;
+
+ QString txt = m_pLineEdit->text();
+ if(txt.isEmpty())return;
+ QString html = txt;
+ html.replace("<","&lt;");
+ html.replace(">","&gt;");
+ KviStr tmp(KviStr::Format,"%d",KVI_SMALLICON_OWNPRIVMSG);
+
+ addMessage(tab->window(),tmp.ptr(),html,0); //m_pCurrentFocusedWindowTab on place of m_pCurrentMessage->window()
+ m_pLineEdit->setText("");
+ KviUserInput::parse(txt,tab->window(),QString::null,1);
+}
+
+void KviNotifierWindow::progressUpdate()
+{
+ double dProgress = m_qtStartedAt.elapsed()/(m_tAutoHideAt - m_tStartedAt);
+ dProgress/=1000;
+ m_pProgressBar->setProgress(dProgress);
+ QPainter p(this);
+ m_pProgressBar->draw(&p);
+}
+#include "m_notifierwindow.moc"
+
diff --git a/src/modules/notifier/notifierwindow.h b/src/modules/notifier/notifierwindow.h
new file mode 100644
index 00000000..be5e3b6e
--- /dev/null
+++ b/src/modules/notifier/notifierwindow.h
@@ -0,0 +1,194 @@
+#ifndef _NOTIFIERWINDOW_H_
+#define _NOTIFIERWINDOW_H_
+//==================================================================================
+//
+// File : notifierwindow.h
+// Creation date : Tue Jul 6 2004 20:25:12 CEST by Szymon Stefanek
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2005 Iacopo Palazzi < iakko(at)siena(dot)linux(dot)it >
+//
+// This program is FREE software. You can redistribute it and/or
+// modify it under the linkss of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//==================================================================================
+
+#include "kvi_settings.h"
+
+#include <qbitmap.h>
+#include <qcolor.h>
+#include <qcursor.h>
+#include <qdatetime.h>
+#include <qfont.h>
+#include <qimage.h>
+#include <qlineedit.h>
+#include <qpixmap.h>
+#include <qrect.h>
+#include <qtimer.h>
+#include <qwidget.h>
+
+#include "kvi_qstring.h"
+#include "kvi_pointerlist.h"
+#include "kvi_time.h"
+
+#include "notifiersettings.h"
+
+class KviWindow;
+class KviNotifierMessage;
+
+class KviNotifierWindowBody;
+class KviNotifierWindowBorder;
+class KviNotifierWindowProgressBar;
+class KviNotifierWindowTabs;
+
+class QPainter;
+class QPopupMenu;
+
+extern kvi_time_t g_tNotifierDisabledUntil;
+
+class KviNotifierWindow : public QWidget
+{
+ Q_OBJECT
+public:
+ KviNotifierWindow();
+ ~KviNotifierWindow();
+protected:
+ QTimer * m_pShowHideTimer;
+ QTimer * m_pProgressTimer;
+ QTimer * m_pBlinkTimer;
+ QTimer * m_pAutoHideTimer;
+ State m_eState;
+ bool m_bBlinkOn;
+ double m_dOpacity;
+ QImage m_imgDesktop; // the desktop screenshot
+ QPixmap m_pixBackground; // our background image
+ QPixmap m_pixBackgroundHighlighted;
+ QPixmap m_pixForeground; // we paint the stuff HERE
+
+ // Notifier graphic layout
+ QPixmap m_pixBckgrnd;
+
+ QImage m_imgBuffer; // here we merge the two images
+
+ bool m_bCloseDown;
+ bool m_bPrevDown;
+ bool m_bNextDown;
+ bool m_bWriteDown;
+ bool m_bCrashShowWorkAround;
+
+ bool m_bKeyShiftPressed;
+
+ QFont * m_pDefaultFont;
+ QFont * m_pTitleFont;
+
+ QRect m_wndRect;
+
+ QColor m_clrCurText;
+ QColor m_clrOldText[NUM_OLD_COLORS];
+ QColor m_clrHistoricText;
+ QColor m_clrTitle;
+
+ KviNotifierMessage * m_pCurrentMessage;
+ QLineEdit * m_pLineEdit;
+
+ bool m_bDragging;
+ bool m_bLeftButtonIsPressed;
+ bool m_bDiagonalResizing;
+ bool m_bResizing;
+
+ int m_whereResizing;
+
+ QPoint m_pntDrag;
+ QPoint m_pntPos;
+ QPoint m_pntClick;
+ int m_iInputHeight;
+ int m_iBlinkTimeout;
+ int m_iBlinkCount;
+ QPopupMenu * m_pContextPopup;
+ QPopupMenu * m_pDisablePopup;
+ KviWindow * m_pWindowToRaise;
+ kvi_time_t m_tAutoHideAt;
+ kvi_time_t m_tStartedAt;
+ QTime m_qtStartedAt;
+ bool m_bDisableHideOnMainWindowGotAttention;
+ //bool m_bForceShowing;
+
+ QCursor m_cursor;
+
+ KviNotifierWindowTabs * m_pWndTabs;
+ KviNotifierWindowProgressBar * m_pProgressBar;
+ KviNotifierWindowBody * m_pWndBody;
+ KviNotifierWindowBorder * m_pWndBorder;
+public:
+ void doShow(bool bDoAnimate);
+ void doHide(bool bDoAnimate);
+ const QFont & defaultFont(){ return *m_pDefaultFont; };
+ int textWidth();
+ void addMessage(KviWindow * pWnd,const QString &szImageId,const QString &szText,unsigned int uMessageTime);
+ State state() { return m_eState; };
+ void setDisableHideOnMainWindowGotAttention(bool b){ m_bDisableHideOnMainWindowGotAttention = b; };
+ int countTabs();
+ void showLineEdit(bool bShow);
+protected:
+ virtual void showEvent(QShowEvent *e);
+ virtual void hideEvent(QHideEvent * e);
+ virtual void paintEvent(QPaintEvent * e);
+ virtual void mousePressEvent(QMouseEvent * e);
+ virtual void mouseReleaseEvent(QMouseEvent * e);
+ virtual void mouseMoveEvent(QMouseEvent * e);
+ virtual void leaveEvent(QEvent * e);
+ virtual void enterEvent(QEvent * e);
+ virtual void mouseDoubleClickEvent(QMouseEvent * e);
+ virtual void wheelEvent(QWheelEvent * e);
+ virtual bool eventFilter(QObject * pEdit,QEvent * e);
+ virtual void keyPressEvent ( QKeyEvent * e );
+ virtual void keyReleaseEvent ( QKeyEvent * e );
+protected slots:
+ void blink();
+ void heartbeat();
+ void returnPressed();
+ void reloadImages();
+ void fillContextPopup();
+ void hideNow();
+ void disableFor1Minute();
+ void disableFor5Minutes();
+ void disableFor15Minutes();
+ void disableFor30Minutes();
+ void disableFor60Minutes();
+ void disableUntilKVIrcRestarted();
+ void disablePermanently();
+ void delayedRaiseSlot();
+ void autoHide();
+ void progressUpdate();
+private:
+ void contextPopup(const QPoint &pos);
+ void startBlinking();
+ void markAllMessagesAsHistoric();
+ void computeRect();
+ void stopShowHideTimer();
+ void stopBlinkTimer();
+ void stopAutoHideTimer();
+ void startAutoHideTimer();
+ void delayedRaise(KviWindow * pWnd);
+ void prevButtonClicked();
+ void nextButtonClicked();
+ bool shouldHideIfMainWindowGotAttention();
+ void setCursor(int);
+ void resize(QPoint p, bool = true);
+ void redrawWindow();
+ void redrawText();
+ bool checkResizing(QPoint);
+};
+
+#endif //_NOTIFIERWINDOW_H_
diff --git a/src/modules/notifier/notifierwindowbody.cpp b/src/modules/notifier/notifierwindowbody.cpp
new file mode 100644
index 00000000..7449aa9e
--- /dev/null
+++ b/src/modules/notifier/notifierwindowbody.cpp
@@ -0,0 +1,232 @@
+//=============================================================================
+//
+// File : kvinotifierwindowbody.cpp
+// Created on dom 02 gen 2005 17:53:29 by Iacopo Palazzi
+//
+// This file is part of the KVIrc distribution
+// Copyright (C) 2005 Iacopo Palazzi < iakko(at)siena(dot)linux(dot)it >
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//=============================================================================
+
+#include "notifierwindowbody.h"
+
+#include "kvi_iconmanager.h"
+
+#include <qbrush.h>
+#include <qcolor.h>
+#include <qpainter.h>
+
+/*
+#ifdef QT3_SUPPORT
+ #include <Q3Painter>
+#else
+ #include <qpainter.h>
+#endif
+*/
+
+KviNotifierWindowBody::KviNotifierWindowBody(QRect r)
+{
+ loadImages();
+ setHeight(r.height());
+ setWidth(r.width());
+ m_pnt.setX(r.x());
+ m_pnt.setY(r.y());
+ recalculatePositions();
+}
+
+KviNotifierWindowBody::~KviNotifierWindowBody()
+{
+}
+
+
+void KviNotifierWindowBody::loadImages()
+{
+ QPixmap * p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_body_dx.png")))
+ m_pixDX = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_body_sx.png")))
+ m_pixSX = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_body_dwnsx.png")))
+ m_pixDWNSX = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_body_dwndx.png")))
+ m_pixDWNDX = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_body_dwn.png")))
+ m_pixDWN = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_body_kvirc_sx.png")))
+ m_pixKVIrcSX = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_body_kvirc_dwn.png")))
+ m_pixKVIrcDWN = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_body_kvirc.png")))
+ m_pixKVIrc = *p;
+
+ if((p = g_pIconManager->getPixmap("notifier_icon_body_prev_off.png")))
+ m_pixIconPrev_off = *p;
+ if((p = g_pIconManager->getPixmap("notifier_icon_body_prev_on.png")))
+ m_pixIconPrev_on = *p;
+ if((p = g_pIconManager->getPixmap("notifier_icon_body_prev_clicked.png")))
+ m_pixIconPrev_clicked = *p;
+
+ m_pixIconPrev = m_pixIconPrev_off;
+
+ if((p = g_pIconManager->getPixmap("notifier_icon_body_next_off.png")))
+ m_pixIconNext_off = *p;
+ if((p = g_pIconManager->getPixmap("notifier_icon_body_next_on.png")))
+ m_pixIconNext_on = *p;
+ if((p = g_pIconManager->getPixmap("notifier_icon_body_next_clicked.png")))
+ m_pixIconNext_clicked = *p;
+
+ m_pixIconNext = m_pixIconNext_off;
+
+ if((p = g_pIconManager->getPixmap("notifier_icon_body_write_off.png")))
+ m_pixIconWrite_off = *p;
+ if((p = g_pIconManager->getPixmap("notifier_icon_body_write_on.png")))
+ m_pixIconWrite_on = *p;
+ if((p = g_pIconManager->getPixmap("notifier_icon_body_write_clicked.png")))
+ m_pixIconWrite_clicked = *p;
+
+ m_pixIconWrite = m_pixIconWrite_off;
+
+ needToRedraw();
+
+ m_prevIconState = WDG_ICON_OFF;
+ m_nextIconState = WDG_ICON_OFF;
+ m_writeIconState = WDG_ICON_OFF;
+
+}
+
+void KviNotifierWindowBody::setWidth(int w)
+{
+ m_rct.setWidth(w);
+ recalculatePositions();
+}
+
+void KviNotifierWindowBody::setHeight(int h)
+{
+ m_rct.setHeight(h);
+ recalculatePositions();
+}
+
+void KviNotifierWindowBody::recalculatePositions()
+{
+ m_textRect.setX(m_pnt.x()+m_pixSX.width());
+ m_textRect.setY(m_pnt.y());
+ m_textRect.setWidth(m_rct.width()-m_pixSX.width()-m_pixDX.width()-m_pixIconPrev.width());
+ m_textRect.setHeight(m_rct.height()-m_pixDWN.height());
+
+ m_rctWriteIcon.setX(m_textRect.x()+m_textRect.width());
+ m_rctWriteIcon.setY(m_pnt.y()+m_textRect.height()-m_pixIconWrite.height());
+ m_rctWriteIcon.setWidth(m_pixIconWrite.width());
+ m_rctWriteIcon.setHeight(m_pixIconWrite.height());
+
+ m_rctPrevIcon.setX(m_textRect.x()+m_textRect.width());
+ m_rctPrevIcon.setY(m_pnt.y()+2); //FIXME: Maybe the spacing should be calculated?
+ m_rctPrevIcon.setWidth(m_pixIconPrev.width());
+ m_rctPrevIcon.setHeight(m_pixIconPrev.height());
+
+ m_rctNextIcon.setX(m_textRect.x()+m_textRect.width());
+ m_rctNextIcon.setY(m_pnt.y()+m_textRect.height()-m_pixIconNext.height()-m_pixIconWrite.height());
+ m_rctNextIcon.setWidth(m_pixIconNext.width());
+ m_rctNextIcon.setHeight(m_pixIconNext.height());
+
+ needToRedraw();
+}
+
+void KviNotifierWindowBody::setPrevIcon(int state)
+{
+ //if (m_prevIconState==WDG_ICON_OFF && state!=WDG_ICON_OFF)
+ if (m_prevIconState!=state) {
+ switch (state) {
+ case WDG_ICON_ON: m_pixIconPrev = m_pixIconPrev_on; break;
+ case WDG_ICON_OFF: m_pixIconPrev = m_pixIconPrev_off; break;
+ case WDG_ICON_CLICKED: m_pixIconPrev = m_pixIconPrev_clicked; break;
+ };
+
+ m_prevIconState=state;
+ needToRedraw();
+ }
+};
+
+void KviNotifierWindowBody::setNextIcon(int state) {
+
+ //if (m_nextIconState==WDG_ICON_OFF && state!=WDG_ICON_OFF)
+ if (m_nextIconState!=state) {
+ switch (state) {
+ case WDG_ICON_ON: m_pixIconNext = m_pixIconNext_on; break;
+ case WDG_ICON_OFF: m_pixIconNext = m_pixIconNext_off; break;
+ case WDG_ICON_CLICKED: m_pixIconNext = m_pixIconNext_clicked; break;
+ };
+
+ needToRedraw();
+ m_nextIconState=state;
+ }
+};
+
+void KviNotifierWindowBody::setWriteIcon(int state) {
+
+ //if (m_writeIconState==WDG_ICON_OFF && state!=WDG_ICON_OFF)
+ if (m_writeIconState!=state) {
+ switch (state) {
+ case WDG_ICON_ON: m_pixIconWrite = m_pixIconWrite_on; break;
+ case WDG_ICON_OFF: m_pixIconWrite = m_pixIconWrite_off; break;
+ case WDG_ICON_CLICKED: m_pixIconWrite = m_pixIconWrite_clicked; break;};
+
+ needToRedraw();
+ m_writeIconState=state;
+ }
+};
+
+void KviNotifierWindowBody::draw(QPainter * p) {
+
+ if (m_bNeedToRedraw) {
+
+ p->fillRect(QRect(m_pnt,m_rct.size()),m_mac_bkgColor);
+
+ // Autotiled borders
+ p->drawTiledPixmap(m_pnt.x(), m_pnt.y(), m_pixSX.width(), m_rct.height() - m_pixDWNSX.height() - m_pixKVIrcSX.height(), m_pixSX);
+ p->drawTiledPixmap(m_pnt.x() + m_rct.width() - m_pixDX.width(), m_pnt.y(),m_pixDX.width(), m_rct.height() - m_pixDWNDX.height(), m_pixDX);
+ p->drawTiledPixmap(m_pnt.x() + m_pixKVIrcDWN.width() + m_pixDWNSX.width(), m_pnt.y() + m_rct.height() - m_pixDWN.height(), m_rct.width() - m_pixKVIrcDWN.width() - m_pixDWNSX.width() - m_pixDWNDX.width(), m_pixDWN.height(), m_pixDWN);
+
+ // Bottom corners
+ p->drawPixmap(m_pnt.x(), m_pnt.y() + m_rct.height() - m_pixDWNSX.height(), m_pixDWNSX);
+ p->drawPixmap(m_pnt.x() + m_rct.width() - m_pixDWNSX.width(), m_pnt.y() + m_rct.height() - m_pixDWNDX.height(), m_pixDWNDX);
+
+ // KVIrc image
+ p->drawPixmap(m_pnt.x(), m_pnt.y() + m_rct.height() - m_pixKVIrcSX.height() - m_pixDWNSX.height(), m_pixKVIrcSX);
+ p->drawPixmap(m_pnt.x() + m_pixKVIrcSX.width(), m_pnt.y() + m_rct.height() - m_pixKVIrcDWN.height(), m_pixKVIrcDWN);
+ p->drawPixmap(m_pnt.x() + m_pixKVIrcSX.width(), m_pnt.y() + m_rct.height() - m_pixKVIrc.height() - m_pixKVIrcDWN.height(), m_pixKVIrc, 0, 0, m_pixKVIrc.width(), m_pixKVIrc.height());
+
+ // Draw Icons
+ p->drawPixmap(m_rctPrevIcon.x(), m_rctPrevIcon.y(), m_pixIconPrev);
+ p->drawPixmap(m_rctNextIcon.x(), m_rctNextIcon.y(), m_pixIconNext);
+ p->drawPixmap(m_rctWriteIcon.x(), m_rctWriteIcon.y(), m_pixIconWrite);
+
+ m_bNeedToRedraw = false;
+
+ }
+}
+
+void KviNotifierWindowBody::mouseMoveEvent(QMouseEvent * e) {
+
+}
+
+void KviNotifierWindowBody::mousePressEvent(QMouseEvent * e) {
+
+}
+
+void KviNotifierWindowBody::mouseReleaseEvent(QMouseEvent * e) {
+
+}
diff --git a/src/modules/notifier/notifierwindowbody.h b/src/modules/notifier/notifierwindowbody.h
new file mode 100644
index 00000000..e59df9f9
--- /dev/null
+++ b/src/modules/notifier/notifierwindowbody.h
@@ -0,0 +1,147 @@
+#ifndef _KVINOTIFIERWINDOWBODY_H_
+#define _KVINOTIFIERWINDOWBODY_H_
+//=============================================================================
+//
+// File : kvinotifierwindowbody.h
+// Created on dom 02 gen 2005 17:53:29 by Iacopo Palazzi
+//
+// This file is part of the KVIrc distribution
+// Copyright (C) 2005 Iacopo Palazzi < iakko(at)siena(dot)linux(dot)it >
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//=============================================================================
+
+#include <qevent.h>
+#include <qrect.h>
+#include <qpoint.h>
+#include <qpixmap.h>
+
+#include "notifiersettings.h"
+
+/*
+#ifdef QT3_SUPPORT
+ #define QPainter Q3Painter
+#endif
+*/
+
+class QPainter;
+
+class KviNotifierWindowBody
+{
+public:
+ KviNotifierWindowBody(QRect r);
+ ~KviNotifierWindowBody();
+
+// ================================
+// Put members declaration below...
+// ================================
+private:
+ QRect m_rct;
+ QPoint m_pnt;
+
+ QRect m_textRect;
+
+ QRect m_rctWriteIcon;
+ QRect m_rctPrevIcon;
+ QRect m_rctNextIcon;
+ QRect m_rctCloseTabIcon;
+
+ // Pictures
+ QPixmap m_pixDX;
+ QPixmap m_pixSX;
+ QPixmap m_pixDWNSX;
+ QPixmap m_pixDWNDX;
+ QPixmap m_pixDWN;
+ QPixmap m_pixKVIrcSX;
+ QPixmap m_pixKVIrcDWN;
+ QPixmap m_pixKVIrc;
+
+ QPixmap m_pixIconPrev;
+ QPixmap m_pixIconPrev_off;
+ QPixmap m_pixIconPrev_on;
+ QPixmap m_pixIconPrev_clicked;
+
+ QPixmap m_pixIconNext;
+ QPixmap m_pixIconNext_off;
+ QPixmap m_pixIconNext_on;
+ QPixmap m_pixIconNext_clicked;
+
+ QPixmap m_pixIconWrite;
+ QPixmap m_pixIconWrite_off;
+ QPixmap m_pixIconWrite_on;
+ QPixmap m_pixIconWrite_clicked;
+
+ bool m_bNeedToRedraw;
+
+ int m_prevIconState;
+ int m_nextIconState;
+ int m_writeIconState;
+
+public:
+
+protected:
+
+
+// ================================
+// Put methods declaration below...
+// ================================
+private:
+ void loadImages();
+
+public:
+ void setWidth(int w);
+ void setHeight(int h);
+ void resize(int w, int h) { setWidth(w); setHeight(h); };
+ void resize(QRect r) { setWidth(r.width()); setHeight(r.height()); };
+ void setPoint(int x, int y) { m_pnt.setX(x); m_pnt.setY(y); };
+
+ void setPrevIcon(int state);
+ void setNextIcon(int state);
+ void setWriteIcon(int state);
+
+ int nextIconState() { return m_nextIconState; };
+ int prevIconState() { return m_prevIconState; };
+ int writeIconState() { return m_writeIconState; };
+
+ int x() { return m_pnt.x(); };
+ int y() { return m_pnt.y(); };
+ int width() { return m_rct.width(); };
+ int height() { return m_rct.height(); };
+ int baseLine() { return (y()+height()); };
+
+ QRect rect() { return m_rct; };
+ QRect textRect() { return m_textRect; };
+ QRect rctPrevIcon() { return m_rctPrevIcon; };
+ QRect rctNextIcon() { return m_rctNextIcon; };
+ QRect rctWriteIcon() { return m_rctWriteIcon; };
+
+ void needToRedraw() { m_bNeedToRedraw = true; };
+
+ void recalculatePositions();
+ void touch() { m_bNeedToRedraw = true; };
+ void draw(QPainter *);
+
+ void mouseMoveEvent(QMouseEvent * e);
+ void mousePressEvent(QMouseEvent * e);
+ void mouseReleaseEvent(QMouseEvent * e);
+
+
+
+protected:
+
+};
+
+#endif //!_KVINOTIFIERWINDOWBODY_H_
diff --git a/src/modules/notifier/notifierwindowborder.cpp b/src/modules/notifier/notifierwindowborder.cpp
new file mode 100644
index 00000000..efd9ec0d
--- /dev/null
+++ b/src/modules/notifier/notifierwindowborder.cpp
@@ -0,0 +1,220 @@
+//=============================================================================
+//
+// File : kvinotifierwindowborder.cpp
+// Created on lun 03 gen 2005 02:27:22 by Iacopo Palazzi
+//
+// This file is part of the KVIrc distribution
+// Copyright (C) 2005 Iacopo Palazzi < iakko(at)siena(dot)linux(dot)it >
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//=============================================================================
+
+#include "notifierwindowborder.h"
+#include "notifierwindowtabs.h"
+#include "kvi_iconmanager.h"
+
+#include <qpainter.h>
+
+KviNotifierWindowBorder::KviNotifierWindowBorder(QSize s)
+{
+ loadImages();
+ resize(s);
+}
+
+KviNotifierWindowBorder::~KviNotifierWindowBorder()
+{
+}
+
+void KviNotifierWindowBorder::loadImages() {
+
+ // Normal Border
+
+ QPixmap * p;
+
+ if((p = g_pIconManager->getPixmap("notifier_pix_wnd_sx.png")))
+ m_pixSX_N = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_wnd_dx.png")))
+ m_pixDX_N = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_wnd_dwn.png")))
+ m_pixDWN_N = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_wnd_dwndx.png")))
+ m_pixDWNDX_N = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_wnd_dwnsx.png")))
+ m_pixDWNSX_N = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_caption_sx.png")))
+ m_pixCaptionSX_N = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_caption_dx.png")))
+ m_pixCaptionDX_N = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_caption_bkg.png")))
+ m_pixCaptionBKG_N = *p;
+
+ if((p = g_pIconManager->getPixmap("notifier_icon_close_out.png")))
+ m_pixIconClose_out_N = *p;
+ if((p = g_pIconManager->getPixmap("notifier_icon_close_over.png")))
+ m_pixIconClose_over_N = *p;
+ if((p = g_pIconManager->getPixmap("notifier_icon_close_clicked.png")))
+ m_pixIconClose_clicked_N = *p;
+
+ // Highlighted Border
+
+ if((p = g_pIconManager->getPixmap("notifier_pix_wnd_sx_hl.png")))
+ m_pixSX_HL = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_wnd_dx_hl.png")))
+ m_pixDX_HL = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_wnd_dwn_hl.png")))
+ m_pixDWN_HL = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_wnd_dwndx_hl.png")))
+ m_pixDWNDX_HL = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_wnd_dwnsx_hl.png")))
+ m_pixDWNSX_HL = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_caption_sx_hl.png")))
+ m_pixCaptionSX_HL = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_caption_dx_hl.png")))
+ m_pixCaptionDX_HL = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_caption_bkg_hl.png")))
+ m_pixCaptionBKG_HL = *p;
+
+ if((p = g_pIconManager->getPixmap("notifier_icon_close_out_hl.png")))
+ m_pixIconClose_out_HL = *p;
+ if((p = g_pIconManager->getPixmap("notifier_icon_close_over_hl.png")))
+ m_pixIconClose_over_HL = *p;
+ if((p = g_pIconManager->getPixmap("notifier_icon_close_clicked_hl.png")))
+ m_pixIconClose_clicked_HL = *p;
+
+ setPics();
+ setCloseIcon(WDG_ICON_OUT);
+
+ if ( m_pixCaptionDX->height()==m_pixCaptionSX->height() && m_pixCaptionDX->height()==m_pixCaptionBKG->height()) // just to be sure that the height is fitting
+ m_captionRect.setHeight(m_pixCaptionDX->height());
+
+ // We want to see the tabs height to calculate the appropriate rect..
+ if((p = g_pIconManager->getPixmap("notifier_pix_tab_sx.png")))
+ m_iTabsHeight = p->height();
+ else
+ m_iTabsHeight = 10;
+
+ m_bNeedToRedraw = true;
+
+}
+
+void KviNotifierWindowBorder::setPics(bool b)
+{
+ if (b) {
+ m_pixSX = &m_pixSX_HL;
+ m_pixDX = &m_pixDX_HL;
+ m_pixDWN = &m_pixDWN_HL;
+ m_pixDWNSX = &m_pixDWNSX_HL;
+ m_pixDWNDX = &m_pixDWNDX_HL;
+ m_pixCaptionSX = &m_pixCaptionSX_HL;
+ m_pixCaptionDX = &m_pixCaptionDX_HL;
+ m_pixCaptionBKG = &m_pixCaptionBKG_HL;
+ m_pixIconClose_out = &m_pixIconClose_out_HL;
+ m_pixIconClose_over = &m_pixIconClose_over_HL;
+ m_pixIconClose_clicked = &m_pixIconClose_clicked_HL;
+ } else {
+ m_pixSX = &m_pixSX_N;
+ m_pixDX = &m_pixDX_N;
+ m_pixDWN = &m_pixDWN_N;
+ m_pixDWNSX = &m_pixDWNSX_N;
+ m_pixDWNDX = &m_pixDWNDX_N;
+ m_pixCaptionSX = &m_pixCaptionSX_N;
+ m_pixCaptionDX = &m_pixCaptionDX_N;
+ m_pixCaptionBKG = &m_pixCaptionBKG_N;
+ m_pixIconClose_out = &m_pixIconClose_out_N;
+ m_pixIconClose_over = &m_pixIconClose_over_N;
+ m_pixIconClose_clicked = &m_pixIconClose_clicked_N;
+ }
+}
+
+void KviNotifierWindowBorder::setWidth(int w) {
+ m_iRctWidth = w;
+ recalculatePositions();
+}
+
+void KviNotifierWindowBorder::setHeight(int h) {
+ m_iRctHeight = h;
+ recalculatePositions();
+}
+
+void KviNotifierWindowBorder::recalculatePositions()
+{
+ m_rct.setHeight(m_iRctHeight);
+ m_rct.setWidth(m_iRctWidth);
+ m_rct.setTopLeft(QPoint(0,0));
+
+ m_closeIconRect.setX(m_rct.width()-m_pixCaptionDX->width()-m_pixIconClose->width());
+ m_closeIconRect.setY(2);
+ m_closeIconRect.setWidth(m_pixIconClose->width());
+ m_closeIconRect.setHeight(m_pixIconClose->height());
+
+ m_captionRect.setTopLeft( m_rct.topLeft() );
+ m_captionRect.setSize( QSize(m_rct.width(),m_pixCaptionDX->height()) );
+
+ m_tabsRect.setTopLeft( QPoint(m_pixCaptionDX->width()+7,m_captionRect.height()) );
+ m_tabsRect.setSize( QSize(m_captionRect.width()-(2*m_pixCaptionDX->width())-7,m_iTabsHeight) );
+
+ m_bodyRect.setTopLeft( QPoint(m_pixCaptionDX->width()+7,m_captionRect.height()+m_tabsRect.height()) );
+ m_bodyRect.setSize( QSize(m_captionRect.width()-(2*m_pixCaptionDX->width())-7,m_rct.height()-m_captionRect.height()-m_pixDWN->height()-m_tabsRect.height()) );
+
+ m_titleRect.setTopLeft( QPoint(m_pixCaptionSX->width(), (m_captionRect.height()-m_iTitleFontHeight)/2 ) );
+ m_titleRect.setSize( QSize(m_rct.width()-m_pixCaptionSX->width()-m_pixCaptionDX->width(),m_iTitleFontHeight) );
+
+ m_progressRect.setTopLeft( QPoint(m_pixCaptionDX->width(),m_pixCaptionDX->height()));
+ m_progressRect.setSize( QSize(6,m_iRctHeight-m_pixCaptionDX->height()-m_pixDWN->height()));
+
+ m_bNeedToRedraw = true;
+}
+
+void KviNotifierWindowBorder::setCloseIcon(int state) {
+ m_bNeedToRedraw = true; m_eIconState = state;
+ switch (m_eIconState) {
+ case WDG_ICON_OUT: m_pixIconClose = m_pixIconClose_out; break;
+ case WDG_ICON_OVER: m_pixIconClose = m_pixIconClose_over; break;
+ case WDG_ICON_CLICKED: m_pixIconClose = m_pixIconClose_clicked; break;
+ };
+}
+
+void KviNotifierWindowBorder::resetIcons() {
+ setCloseIcon(WDG_ICON_OUT);
+}
+
+void KviNotifierWindowBorder::draw(QPainter * p, bool b) {
+
+ if (m_bNeedToRedraw) {
+ setPics(b);
+ setCloseIcon(m_eIconState);
+
+ // Draw the caption
+ p->drawPixmap(m_captionRect.x(), m_captionRect.y(), *m_pixCaptionSX);
+ p->drawTiledPixmap(m_pixCaptionSX->width(), 0, m_captionRect.width() - (m_pixCaptionSX->width() + m_pixCaptionDX->width()), m_captionRect.height(), *m_pixCaptionBKG);
+ p->drawPixmap(m_captionRect.width() - m_pixCaptionDX->width(), 0, *m_pixCaptionDX);
+
+ // Draw the tiled borders
+ p->drawTiledPixmap(0, m_captionRect.height(), m_pixSX->width(), m_bodyRect.height() + m_iTabsHeight, *m_pixSX);
+ p->drawTiledPixmap(m_bodyRect.width() + m_bodyRect.x(), m_captionRect.height(), m_pixDX->width(), m_bodyRect.height() + m_iTabsHeight, *m_pixDX);
+ p->drawTiledPixmap(m_pixDWNSX->width(), m_captionRect.height() + m_bodyRect.height() + m_iTabsHeight, m_bodyRect.width() + m_progressRect.width() + 1, m_pixDWN->height(), *m_pixDWN);
+
+ // Draw down corners
+ p->drawPixmap(0, m_captionRect.height() + m_bodyRect.height() + m_iTabsHeight, *m_pixDWNSX);
+ p->drawPixmap(m_bodyRect.width() + m_bodyRect.x(), m_captionRect.height() + m_bodyRect.height() + m_iTabsHeight, *m_pixDWNDX);
+
+ //Drawing icons
+ p->drawPixmap(m_closeIconRect.x(), m_closeIconRect.y(), *m_pixIconClose);
+
+ m_bNeedToRedraw = false;
+ }
+
+}
diff --git a/src/modules/notifier/notifierwindowborder.h b/src/modules/notifier/notifierwindowborder.h
new file mode 100644
index 00000000..5c36827b
--- /dev/null
+++ b/src/modules/notifier/notifierwindowborder.h
@@ -0,0 +1,154 @@
+#ifndef _KVINOTIFIERWINDOWBORDER_H_
+#define _KVINOTIFIERWINDOWBORDER_H_
+//=============================================================================
+//
+// File : kvinotifierwindowborder.h
+// Created on lun 03 gen 2005 02:27:22 by Iacopo Palazzi
+//
+// This file is part of the KVIrc distribution
+// Copyright (C) 2005 Iacopo Palazzi < iakko(at)siena(dot)linux(dot)it >
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//=============================================================================
+
+#include "notifiersettings.h"
+
+#include <qsize.h>
+#include <qrect.h>
+#include <qpixmap.h>
+
+class QPainter;
+
+class KviNotifierWindowBorder
+{
+public:
+ KviNotifierWindowBorder(QSize = QSize(WDG_MIN_WIDTH,WDG_MIN_HEIGHT));
+ ~KviNotifierWindowBorder();
+
+// ================================
+// Put members declaration below...
+// ================================
+private:
+ QRect m_rct;
+ QPoint m_pnt;
+
+ QRect m_closeIconRect;
+
+ QRect m_captionRect;
+ QRect m_bodyRect;
+ QRect m_tabsRect;
+ QRect m_titleRect;
+
+ QRect m_progressRect;
+
+ // Pictures
+ QPixmap * m_pixSX;
+ QPixmap * m_pixDX;
+ QPixmap * m_pixDWN;
+ QPixmap * m_pixDWNSX;
+ QPixmap * m_pixDWNDX;
+ QPixmap * m_pixCaptionSX;
+ QPixmap * m_pixCaptionDX;
+ QPixmap * m_pixCaptionBKG;
+ QPixmap * m_pixIconClose_out;
+ QPixmap * m_pixIconClose_over;
+ QPixmap * m_pixIconClose_clicked;
+ QPixmap * m_pixIconClose;
+
+ QPixmap m_pixSX_N;
+ QPixmap m_pixDX_N;
+ QPixmap m_pixDWN_N;
+ QPixmap m_pixDWNSX_N;
+ QPixmap m_pixDWNDX_N;
+ QPixmap m_pixCaptionSX_N;
+ QPixmap m_pixCaptionDX_N;
+ QPixmap m_pixCaptionBKG_N;
+ QPixmap m_pixIconClose_out_N;
+ QPixmap m_pixIconClose_over_N;
+ QPixmap m_pixIconClose_clicked_N;
+
+ QPixmap m_pixSX_HL;
+ QPixmap m_pixDX_HL;
+ QPixmap m_pixDWN_HL;
+ QPixmap m_pixDWNSX_HL;
+ QPixmap m_pixDWNDX_HL;
+ QPixmap m_pixCaptionSX_HL;
+ QPixmap m_pixCaptionDX_HL;
+ QPixmap m_pixCaptionBKG_HL;
+ QPixmap m_pixIconClose_out_HL;
+ QPixmap m_pixIconClose_over_HL;
+ QPixmap m_pixIconClose_clicked_HL;
+
+ int m_iTabsHeight;
+ int m_iTitleFontHeight;
+ int m_eIconState;
+ int m_iRctWidth;
+ int m_iRctHeight;
+
+ bool m_bNeedToRedraw;
+
+public:
+protected:
+
+
+// ================================
+// Put methods declaration below...
+// ================================
+private:
+ void loadImages();
+ void recalculatePositions();
+
+public:
+ // reading methods...
+ void setWidth(int w);
+ void setHeight(int h);
+ void resize(int w, int h) { setWidth(w); setHeight(h); };
+ void resize(QSize r) { setWidth(r.width()); setHeight(r.height()); };
+ void setGeometry(QRect r) { r.topLeft(); r.size(); /*debug("x,y: %d,%d", r.x(), r.y()); debug("w,h: %d,%d", r.width(), r.height());*/ };
+ void setGeometry(QPoint p, QSize s) { setPoint (p.x(), p.y()); setWidth (s.width()); setHeight (s.height()); };
+
+ void setPoint(int x, int y) { m_pnt.setX(x); m_pnt.setY(y); m_rct.setX(x); m_rct.setY(y); };
+
+ void setCloseIcon(int state);
+ void resetIcons();
+
+ // writing methods...
+ int x() { return m_pnt.x(); };
+ int y() { return m_pnt.y(); };
+ int width() { return m_rct.width(); };
+ int height() { return m_rct.height(); };
+ int baseLine() { return (y()+height()); };
+
+ QRect bodyRect() { return m_bodyRect; };
+ QRect tabsRect() { return m_tabsRect; };
+ QRect captionRect() { return m_captionRect; };
+ QRect rect() { return m_rct; };
+ QRect closeRect() { return m_closeIconRect; };
+ QRect titleRect() { return m_titleRect; };
+ QRect progressRect() { return m_progressRect; };
+
+ void centerTitle(int h) { m_iTitleFontHeight = h; };
+
+ void touch() { m_bNeedToRedraw = true; };
+
+ void draw(QPainter *, bool b = false);
+ void setPics(bool b = false);
+
+protected:
+
+};
+
+#endif //!_KVINOTIFIERWINDOWBORDER_H_
diff --git a/src/modules/notifier/notifierwindowprogressbar.cpp b/src/modules/notifier/notifierwindowprogressbar.cpp
new file mode 100644
index 00000000..72bbdecf
--- /dev/null
+++ b/src/modules/notifier/notifierwindowprogressbar.cpp
@@ -0,0 +1,51 @@
+//=============================================================================
+//
+// File : notifierwindowprogressbar.cpp
+// Created on Tue 17 Apr 2007 10:24:01 by Iacopo Palazzi
+//
+// This file is part of the KVIrc distribution
+// Copyright (C) 2007 Iacopo Palazzi < iakko(at)siena.linux.it >
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//=============================================================================
+
+#include "notifierwindowprogressbar.h"
+
+KviNotifierWindowProgressBar::KviNotifierWindowProgressBar(QRect r)
+: m_rect(r)
+{
+
+}
+
+KviNotifierWindowProgressBar::~KviNotifierWindowProgressBar()
+{
+ m_dProgress = 0;
+}
+
+void KviNotifierWindowProgressBar::draw(QPainter *p)
+{
+ p->fillRect(m_rect, QColor(236, 233, 216));
+ p->fillRect(
+ QRect(
+ m_rect.x()+1,
+ m_rect.y()+1 + m_rect.height() * (1 - m_dProgress),
+ m_rect.width() - 2,
+ (m_rect.height() - 2) * m_dProgress
+ ),
+ QColor(175, 28, 95)
+ );
+ p->drawRect(m_rect);
+}
diff --git a/src/modules/notifier/notifierwindowprogressbar.h b/src/modules/notifier/notifierwindowprogressbar.h
new file mode 100644
index 00000000..ec527d2e
--- /dev/null
+++ b/src/modules/notifier/notifierwindowprogressbar.h
@@ -0,0 +1,67 @@
+#ifndef _NOTIFIERWINDOWPROGRESSBAR_H_
+#define _NOTIFIERWINDOWPROGRESSBAR_H_
+//=============================================================================
+//
+// File : notifierwindowprogressbar.h
+// Created on Tue 17 Apr 2007 10:24:01 by Iacopo Palazzi
+//
+// This file is part of the KVIrc distribution
+// Copyright (C) 2007 Iacopo Palazzi < iakko(at)siena.linux.it >
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//=============================================================================
+
+#include <qrect.h>
+#include <qpainter.h>
+
+class KviNotifierWindowProgressBar
+{
+public:
+ KviNotifierWindowProgressBar(QRect r);
+ ~KviNotifierWindowProgressBar();
+
+// ================================
+// Put members declaration below...
+// ================================
+private:
+
+public:
+
+protected:
+ QRect m_rect;
+ double m_dProgress;
+
+// ================================
+// Put methods declaration below...
+// ================================
+private:
+
+public:
+ int x() { return m_rect.x(); };
+ int y() { return m_rect.y(); };
+ int width() { return m_rect.width(); };
+ int height() { return m_rect.height(); };
+
+ void setHeight(int p_iHeight) { m_rect.setHeight(p_iHeight); };
+ void setProgress(double progress) { m_dProgress=progress; };
+ void draw(QPainter *);
+
+protected:
+
+
+};
+
+#endif //!_NOTIFIERWINDOWPROGRESSBAR_H_
diff --git a/src/modules/notifier/notifierwindowtabs.cpp b/src/modules/notifier/notifierwindowtabs.cpp
new file mode 100644
index 00000000..9eaa2f12
--- /dev/null
+++ b/src/modules/notifier/notifierwindowtabs.cpp
@@ -0,0 +1,705 @@
+//=============================================================================
+//
+// File : kvinotifierwindowtabs.cpp
+// Created on dom 02 gen 2005 15:30:50 by Iacopo Palazzi
+//
+// This file is part of the KVIrc irc client distribution
+// Copyright (C) 2005 Iacopo Palazzi < iakko(at)siena(dot)linux(dot)it >
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//=============================================================================
+
+#include "kvi_app.h"
+#include "kvi_config.h"
+#include "kvi_qstring.h"
+#include "kvi_iconmanager.h"
+#include "kvi_locale.h"
+#include "kvi_options.h"
+#include "kvi_window.h"
+
+#include <qevent.h>
+#include <qpainter.h>
+#include <qbrush.h>
+#include <qcolor.h>
+#include <qfontmetrics.h>
+
+#include "notifiermessage.h"
+#include "notifierwindowtabs.h"
+
+extern KviNotifierWindow * g_pNotifierWindow;
+KviNotifierWindowTabs * g_pTabs;
+
+
+// --- tab object definition class
+
+KviNotifierWindowTab::KviNotifierWindowTab(KviWindow * pWnd, QString label)
+{
+ m_pWnd = pWnd;
+ m_label = label;
+ m_pMessageList = new KviPointerList<KviNotifierMessage>;
+ m_pMessageList->setAutoDelete(true);
+ m_bFocused = false;
+ m_pCurrentMessage = 0;
+
+ KviStr buffer;
+ g_pApp->getReadOnlyConfigPath(buffer,"libkvinotifier.kvc",KviApp::ConfigPlugins,true);
+ KviConfig cfg(buffer.ptr(),KviConfig::Read);
+ cfg.setGroup("NotifierSkin");
+ m_clrHighlightedLabel = cfg.readColorEntry("HighlightedTabLablerColor",QColor(200,0,0));
+ m_clrNormalLabel = cfg.readColorEntry("NormalTabLablerColor",QColor(0,0,0));
+ m_clrChangedLabel = cfg.readColorEntry("ChangedTabLablerColor",QColor(0,0,100));
+
+ if(pWnd)
+ {
+ connect(pWnd,SIGNAL(windowNameChanged()),this,SLOT(labelChanged()));
+ connect(pWnd,SIGNAL(destroyed()),this,SLOT(closeMe()));
+ }
+}
+
+KviNotifierWindowTab::~KviNotifierWindowTab()
+{
+ delete m_pMessageList;
+}
+
+void KviNotifierWindowTab::setNextMessageAsCurrent()
+{
+ if(!m_pCurrentMessage)return;
+ if(m_pMessageList->findRef(m_pCurrentMessage) == -1)return;
+ m_pCurrentMessage = m_pMessageList->next();
+ if(!m_pCurrentMessage)m_pCurrentMessage = m_pMessageList->last();
+}
+
+void KviNotifierWindowTab::setPrevMessageAsCurrent()
+{
+ if(!m_pCurrentMessage)return;
+ if(!m_pMessageList->findRef(m_pCurrentMessage) == -1)return;
+ m_pCurrentMessage = m_pMessageList->prev();
+ if(!m_pCurrentMessage)m_pCurrentMessage = m_pMessageList->first();
+}
+
+void KviNotifierWindowTab::setLastMessageAsCurrent()
+{
+ m_pCurrentMessage = m_pMessageList->last();
+}
+
+void KviNotifierWindowTab::appendMessage(KviNotifierMessage * m)
+{
+ if(m_pCurrentMessage == m_pMessageList->last())m_pCurrentMessage = m;
+ m_pMessageList->append(m);
+ // avoid having too much messages floating around
+ while(m_pMessageList->count() > MAX_MESSAGES_IN_WINDOW)
+ {
+ m = m_pMessageList->first();
+ m_pMessageList->removeFirst();
+ if(m == m_pCurrentMessage)
+ m_pCurrentMessage = m_pMessageList->first();
+ }
+ if(focused())setState(Normal);
+ else setState(Highlighted);
+}
+
+void KviNotifierWindowTab::labelChanged()
+{
+ if(!m_pWnd)return;
+ m_label = m_pWnd->windowName();
+ setState(Changed);
+ g_pTabs->needToRedraw();
+ g_pNotifierWindow->update();
+}
+
+void KviNotifierWindowTab::closeMe()
+{
+ g_pTabs->closeTab(this);
+}
+
+void KviNotifierWindowTab::setFocused(bool b)
+{
+ m_bFocused = b;
+ if(m_bFocused)setState(Normal);
+}
+
+void KviNotifierWindowTab::setState(TabState state)
+{
+ m_eState=state;
+ switch (m_eState) {
+ case Normal:
+ m_cLabel = m_clrNormalLabel;
+ break;
+ case Highlighted:
+ m_cLabel = m_clrHighlightedLabel;
+ break;
+ case Changed:
+ m_cLabel = m_clrChangedLabel;
+ break;
+ }
+};
+
+int KviNotifierWindowTab::width(bool b) {
+ int width = 0;
+ QFont * font;
+
+ QPixmap * sx;
+ QPixmap * dx;
+
+ if (focused()) {
+ font = g_pTabs->fontFocused();
+ sx = g_pTabs->tabFocusedPixSx();
+ dx = g_pTabs->tabFocusedPixSx();
+ } else {
+ sx = g_pTabs->tabUnfocusedPixSx();
+ dx = g_pTabs->tabUnfocusedPixSx();
+ font = g_pTabs->fontUnfocused();
+ }
+
+ QFontMetrics fm(*font);
+ width = fm.width(label())+2;
+ if (!b) width += sx->width() + dx->width();
+
+ return width;
+}
+
+// ##################################################################################à
+// ### end of tab object definition class
+// ##################################################################################à
+
+
+KviNotifierWindowTabs::KviNotifierWindowTabs(QRect r)
+{
+ g_pTabs = this;
+ m_pPixmap = new QPixmap();
+ m_pPainter = new QPainter();
+ m_pTabFocused = 0;
+ m_pWndTabFocused = 0;
+ m_iTabToStartFrom = 0;
+
+ m_tabPtrList.setAutoDelete(false); // FIXME: should take a closer look at this
+ m_lastVisitedTabPtrList.setAutoDelete(false);
+
+ loadImages();
+ initConfig();
+ resize(r);
+}
+
+KviNotifierWindowTabs::~KviNotifierWindowTabs()
+{
+ QMap<KviWindow *, KviNotifierWindowTab *>::Iterator tab;
+ for(tab = m_tabMap.begin(); tab != m_tabMap.end(); tab++ )
+ delete tab.data();
+ m_tabMap.clear();
+ delete m_pFocusedFont;
+ delete m_pUnfocusedFont;
+ delete m_pPainter;
+ delete m_pPixmap;
+}
+
+void KviNotifierWindowTabs::initConfig()
+{
+ KviStr buffer;
+ g_pApp->getReadOnlyConfigPath(buffer,"libkvinotifier.kvc",KviApp::ConfigPlugins,true);
+
+ KviConfig cfg(buffer.ptr(),KviConfig::Read);
+
+ cfg.setGroup("NotifierSkin");
+
+ QString szFamily = cfg.readEntry("TextFontFocusedTab","Arial");
+ m_pFocusedFont = new QFont(szFamily,cfg.readIntEntry("TextFocusedFontSize",10));
+ m_pFocusedFont->setBold(true);
+ szFamily = cfg.readEntry("TextFontUnfocusedTab","Arial");
+ m_pUnfocusedFont = new QFont(szFamily,cfg.readIntEntry("TextUnfocusedFontSize",9));
+}
+
+void KviNotifierWindowTabs::loadImages()
+{
+ QPixmap * p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_tab_dx.png")))
+ m_pixDX = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_tab_sx.png")))
+ m_pixSX = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_tab_bkg.png")))
+ m_pixBKG = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_tab_focused_sx.png")))
+ m_pixSXFocused = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_tab_focused_dx.png")))
+ m_pixDXFocused = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_tab_focused_bkg.png")))
+ m_pixBKGFocused = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_tab_unfocused_sx.png")))
+ m_pixSXUnfocused = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_tab_unfocused_dx.png")))
+ m_pixDXUnfocused = *p;
+ if((p = g_pIconManager->getPixmap("notifier_pix_tab_unfocused_bkg.png")))
+ m_pixBKGUnfocused = *p;
+
+ if((p = g_pIconManager->getPixmap("notifier_icon_tab_next_out.png")))
+ m_pixIconTabNext_out = *p;
+ if((p = g_pIconManager->getPixmap("notifier_icon_tab_next_over.png")))
+ m_pixIconTabNext_over = *p;
+ if((p = g_pIconManager->getPixmap("notifier_icon_tab_next_clicked.png")))
+ m_pixIconTabNext_clicked = *p;
+
+ m_pixIconTabNext = m_pixIconTabNext_out;
+
+ if((p = g_pIconManager->getPixmap("notifier_icon_tab_prev_out.png")))
+ m_pixIconTabPrev_out = *p;
+ if((p = g_pIconManager->getPixmap("notifier_icon_tab_prev_over.png")))
+ m_pixIconTabPrev_over = *p;
+ if((p = g_pIconManager->getPixmap("notifier_icon_tab_prev_clicked.png")))
+ m_pixIconTabPrev_clicked = *p;
+
+ m_pixIconTabPrev = m_pixIconTabPrev_out;
+
+ if((p = g_pIconManager->getPixmap("notifier_icon_tab_close_off.png")))
+ m_pixIconCloseTab_off = *p;
+ if((p = g_pIconManager->getPixmap("notifier_icon_tab_close_on.png")))
+ m_pixIconCloseTab_on = *p;
+ if((p = g_pIconManager->getPixmap("notifier_icon_tab_close_clicked.png")))
+ m_pixIconCloseTab_clicked = *p;
+
+ m_pixIconCloseTab = m_pixIconCloseTab_off;
+
+ m_closeTabIconState = WDG_ICON_OFF;
+
+}
+
+
+
+void KviNotifierWindowTabs::addMessage(KviWindow * pWnd, KviNotifierMessage * message)
+{
+ QString sender = pWnd ? pWnd->windowName() : "----";
+
+ // Qui servirebbe anche una lista... perche' quando si inserisce
+ // un tab lui lo piazza dove gli pare nell'ordine
+ // e quindi iterando i tab nuovi possono trovarsi PRIMA dei tab vecchi
+ // il che' confonde un po
+ KviNotifierWindowTab * tab;
+ if (!m_tabMap.contains(pWnd)) {
+ m_tabMap.insert(pWnd, tab = new KviNotifierWindowTab(pWnd, sender));
+ m_tabPtrList.append(tab);
+ } else {
+ tab = m_tabMap[pWnd];
+ }
+
+ tab->appendMessage(message);
+
+ if((g_pNotifierWindow->state()==Hidden) || (!m_pTabFocused))
+ {
+ setFocusOn(tab);
+ } else {
+ needToRedraw();
+ }
+}
+
+void KviNotifierWindowTabs::resize(QRect r)
+{
+ m_rct.setX(r.x());
+ m_rct.setY(r.y());
+ m_rct.setHeight(r.height());
+ setWidth(r.width());
+
+ recalculatePositions();
+}
+
+void KviNotifierWindowTabs::setWidth(int w) {
+ m_rct.setWidth(w);
+ recalculatePositions();
+}
+
+void KviNotifierWindowTabs::recalculatePositions()
+{
+ m_rctCloseTabIcon.setX(m_rct.x()+m_rct.width()-m_pixIconCloseTab.width());
+ m_rctCloseTabIcon.setY(m_rct.y());
+ m_rctCloseTabIcon.setWidth(m_pixIconCloseTab.width());
+ m_rctCloseTabIcon.setHeight(m_pixIconCloseTab.height());
+ // The sensible area for the Close Icon
+ m_rctCloseTabIconHotArea.setX(m_rctCloseTabIcon.x()+6);
+ m_rctCloseTabIconHotArea.setY(m_rctCloseTabIcon.y()+3);
+ m_rctCloseTabIconHotArea.setWidth(16);
+ m_rctCloseTabIconHotArea.setHeight(16);
+
+ if (m_bIsOverRightBound) {
+ m_rctNextIcon.setX(m_rct.x() + m_rct.width() - m_rctCloseTabIcon.width() - m_pixIconTabNext.width());
+ m_rctNextIcon.setY(m_rct.y());
+ m_rctNextIcon.setWidth(m_pixIconTabNext.width());
+ m_rctNextIcon.setHeight(m_pixIconTabNext.height());
+ }
+
+ if (m_bIsOverLeftBound) {
+ m_rctPrevIcon.setX(m_rct.x());
+ m_rctPrevIcon.setY(m_rct.y());
+ m_rctPrevIcon.setWidth(m_pixIconTabPrev.width());
+ m_rctPrevIcon.setHeight(m_pixIconTabPrev.height());
+ }
+
+ int tmpX, tmpWidth;
+
+ tmpWidth = m_rctCloseTabIcon.x() - m_rct.x();
+
+ if (m_bIsOverRightBound) {
+ tmpWidth -= m_rctNextIcon.width();
+ }
+
+ if (m_bIsOverLeftBound) {
+ tmpWidth -= m_rctPrevIcon.width();
+ tmpX = m_rct.x() + m_rctPrevIcon.width();
+ } else {
+ tmpX = m_rct.x();
+ }
+
+ m_rctTabs.setX(tmpX);
+ m_rctTabs.setY(m_rct.y());
+
+ m_rctTabs.setWidth(tmpWidth);
+ m_rctTabs.setHeight(m_rct.height());
+
+ needToRedraw();
+}
+
+void KviNotifierWindowTabs::prev()
+{
+ if(!m_pTabFocused)return;
+
+ KviNotifierWindowTab * tab;
+ KviPointerListIterator<KviNotifierWindowTab> tabIterator (m_tabPtrList);
+
+ tab = m_tabMap[m_pTabFocused->wnd()];
+
+ tabIterator.moveFirst();
+
+ while ((tabIterator.current()) != tab) {
+ ++tabIterator;
+ }
+
+ if (!tabIterator.moveFirst()) {
+ --tabIterator;
+ tab = tabIterator.current();
+ setFocusOn(tab);
+ }
+
+}
+
+void KviNotifierWindowTabs::next()
+{
+ if(!m_pTabFocused)return;
+
+ KviNotifierWindowTab * tab;
+ KviPointerListIterator<KviNotifierWindowTab> tabIterator (m_tabPtrList);
+
+ tab = m_tabMap[m_pTabFocused->wnd()];
+ tabIterator.moveFirst();
+ while ((tabIterator.current()) != tab) {
+ ++tabIterator;
+ }
+
+ if (!tabIterator.moveLast()) {
+ ++tabIterator;
+ tab = tabIterator.current();
+ setFocusOn(tab);
+ }
+
+}
+
+void KviNotifierWindowTabs::mousePressEvent(QMouseEvent * e) {
+
+ if (m_bIsOverRightBound && m_rctNextIcon.contains(e->pos())) {
+ return;
+ }
+
+ if (m_bIsOverLeftBound && m_rctPrevIcon.contains(e->pos())) {
+ return;
+ }
+
+ if(m_rctTabs.contains(e->pos()))
+ {
+ QMap<KviWindow *, KviNotifierWindowTab *>::Iterator tab;
+ for (tab = m_tabMap.begin(); tab != m_tabMap.end(); tab++ ) {
+ if (tab.data()->rect().contains(e->pos())) {
+ setFocusOn(tab.data());
+ return;
+ }
+ }
+ }
+
+ if (m_rctCloseTabIconHotArea.contains(e->pos())) {
+ setCloseTabIcon(WDG_ICON_CLICKED);
+ return;
+ }
+
+}
+
+void KviNotifierWindowTabs::mouseMoveEvent(QMouseEvent * e)
+{
+ if (m_rctCloseTabIconHotArea.contains(e->pos()))
+ {
+ setCloseTabIcon(WDG_ICON_ON);
+ } else {
+ if (closeTabIconState()!=WDG_ICON_OFF)
+ setCloseTabIcon(WDG_ICON_OFF);
+ }
+}
+
+void KviNotifierWindowTabs::mouseReleaseEvent(QMouseEvent * e)
+{
+
+ if (m_bIsOverRightBound && m_rctNextIcon.contains(e->pos())) {
+ scrollTabsLeft();
+ return;
+ }
+
+ if (m_bIsOverLeftBound && m_rctPrevIcon.contains(e->pos())) {
+ scrollTabsRight();
+ return;
+ }
+
+ if(currentTab())
+ {
+ if (rctCloseTabIconHotArea().contains(e->pos()))
+ {
+ closeCurrentTab();
+ g_pNotifierWindow->update();
+ }
+ }
+
+}
+
+void KviNotifierWindowTabs::scrollTabsLeft() {
+ if (m_bIsOverRightBound) {
+ m_iTabToStartFrom++;
+ }
+ needToRedraw();
+ g_pNotifierWindow->update();
+};
+
+void KviNotifierWindowTabs::scrollTabsRight() {
+ if (m_bIsOverLeftBound) {
+ m_iTabToStartFrom--;
+ }
+ needToRedraw();
+ g_pNotifierWindow->update();
+};
+
+void KviNotifierWindowTabs::setCloseTabIcon(int state) {
+
+ //if (m_writeIconState==WDG_ICON_OFF && state!=WDG_ICON_OFF)
+ if (m_closeTabIconState!=state) {
+ switch (state) {
+ case WDG_ICON_ON: m_pixIconCloseTab = m_pixIconCloseTab_on; break;
+ case WDG_ICON_OFF: m_pixIconCloseTab = m_pixIconCloseTab_off; break;
+ case WDG_ICON_CLICKED: m_pixIconCloseTab = m_pixIconCloseTab_clicked; break;
+ }
+ needToRedraw();
+ m_closeTabIconState = state;
+ }
+}
+
+void KviNotifierWindowTabs::resetIcons()
+{
+ setCloseTabIcon(WDG_ICON_OFF);
+}
+
+void KviNotifierWindowTabs::setFocusOn(KviNotifierWindowTab * tab)
+{
+ if(m_pTabFocused)m_pTabFocused->setFocused(false);
+ m_pTabFocused = tab;
+ if(m_pTabFocused)m_pTabFocused->setFocused();
+
+ m_lastVisitedTabPtrList.removeRef(tab);
+
+ m_lastVisitedTabPtrList.insert(0, tab);
+
+ needToRedraw();
+
+ g_pNotifierWindow->update();
+}
+
+void KviNotifierWindowTabs::draw(QPainter * p)
+{
+ if(!m_bNeedToRedraw)return;
+
+ m_pPixmap->resize(m_rct.width(), m_rct.height());
+
+ m_pPainter->begin(m_pPixmap);
+
+ QFont tmpFont;
+ tmpFont = p->font();
+
+ m_pPainter->setFont(tmpFont);
+
+ QString str;
+
+ bool isBigger = false;
+
+ int offset = 0;
+
+ int closeIcon_X = m_rct.width() - m_rctCloseTabIcon.width();
+ int nextIcon_X = closeIcon_X - m_pixIconTabNext_out.width();
+ int prevIcon_X = m_rct.x();
+
+ int tmpTabsWidth = 0;
+
+ m_pPainter->drawPixmap(0,0,m_pixSX);
+ m_pPainter->drawPixmap(m_rct.width()-m_pixDX.width(),0,m_pixDX);
+ m_pPainter->drawTiledPixmap(m_pixSX.width(),0,m_rct.width()-m_pixSX.width()-m_pixDX.width(),m_rct.height(),m_pixBKG);
+
+ KviPointerListIterator<KviNotifierWindowTab> tabIterator (m_tabPtrList);
+
+ //m_tabPtrList.findRef(m_tabMap[m_pTabFocused->wnd()]);
+
+// QMap<KviWindow *, KviNotifierWindowTab *>::Iterator tab;
+ KviNotifierWindowTab * tab;
+ //for (tab = m_tabMap.begin(); tab != m_tabMap.end() && !isBigger; tab++ )
+ tabIterator.moveFirst();
+
+ int i = 0;
+ while(m_iTabToStartFrom!=i) {
+ i++;
+ ++tabIterator;
+ }
+
+ while ( ((tab = tabIterator.current()) != 0) && !isBigger)
+ {
+ ++tabIterator;
+
+ if (tab->focused()) {
+
+ m_pPainter->setFont(*m_pFocusedFont);
+
+ tab->setRect(m_rct.x() + offset, m_rctTabs.y(), tab->width(), m_rctTabs.height());
+
+ m_pPainter->drawPixmap(offset,0,m_pixSXFocused);
+ m_pPainter->drawTiledPixmap(offset+m_pixSXFocused.width(),0,tab->width(true),m_rctTabs.height(),m_pixBKGFocused);
+ m_pPainter->drawPixmap(offset+m_pixSXFocused.width()+tab->width(true),0,m_pixDXFocused);
+ QPen tmpP = m_pPainter->pen(); m_pPainter->setPen(tab->labelColor());
+ m_pPainter->drawText(offset+m_pixSXFocused.width()+1,m_rctTabs.height()-NTF_TABS_FONT_BASELINE,tab->label());
+ m_pPainter->setPen(tmpP);
+
+ offset += tab->width();
+
+ } else {
+
+ m_pPainter->setFont(*m_pUnfocusedFont);
+
+ tab->setRect(m_rct.x() + offset, m_rctTabs.y(), tab->width(), m_rctTabs.height());
+
+ m_pPainter->drawPixmap(offset, 0, m_pixSXUnfocused);
+ m_pPainter->drawTiledPixmap(offset+m_pixSXUnfocused.width(), 0, tab->width(true), m_rctTabs.height(), m_pixBKGUnfocused);
+ m_pPainter->drawPixmap(offset+m_pixSXUnfocused.width()+tab->width(true), 0, m_pixDXUnfocused);
+ QPen tmpP = m_pPainter->pen(); m_pPainter->setPen(tab->labelColor());
+ m_pPainter->drawText(offset+m_pixSXUnfocused.width()+1,m_rctTabs.height()-NTF_TABS_FONT_BASELINE+1,tab->label());
+ m_pPainter->setPen(tmpP);
+ offset += tab->width();
+ }
+
+ if (offset > m_rctTabs.width()) isBigger = true; else isBigger = false;
+ }
+
+ if (m_iTabToStartFrom) {
+ // Draw the left arrow for more tabs
+ m_bIsOverLeftBound = true;
+ m_pPainter->drawPixmap(0, 0, m_pixIconTabPrev);
+ } else {
+ m_bIsOverLeftBound = false;
+ }
+
+ if (isBigger) {
+ // Draw the right arrow for more tabs
+ m_bIsOverRightBound = true;
+ m_pPainter->drawPixmap(nextIcon_X, 0, m_pixIconTabNext);
+ } else {
+ m_bIsOverRightBound = false;
+ }
+
+ m_pPainter->drawPixmap(closeIcon_X, 0, m_pixIconCloseTab);
+
+ m_pPainter->end();
+
+ p->drawPixmap(m_rct.x(), m_rct.y(), *m_pPixmap, 0, 0, m_pPixmap->width(), m_pPixmap->height());
+
+ m_bNeedToRedraw = false;
+
+}
+
+void KviNotifierWindowTabs::markAllMessagesAsHistoric()
+{
+/*
+ QMap<KviWindow *, KviNotifierWindowTab *>::Iterator tab;
+ // Iterating every tab
+ for (tab = m_tabMap.begin(); tab != m_tabMap.end(); ++tab) {
+
+ if (!tab.value()) break;
+
+ KviPointerList<KviNotifierMessage> * tmpMessageList = tab.value()->messageList();
+
+ if (!tmpMessageList) break;
+
+ for(KviNotifierMessage * m = tmpMessageList->last(); m; m = tmpMessageList->prev()) {
+ if(m->historic()) break;;
+ m->setHistoric();
+ }
+ }
+*/
+}
+
+void KviNotifierWindowTabs::closeTab(KviWindow * pWnd)
+{
+ KviNotifierWindowTab * pTab = m_tabMap.find(pWnd).data();
+ closeTab(pWnd, pTab);
+}
+
+void KviNotifierWindowTabs::closeTab(KviNotifierWindowTab * pTab)
+{
+ KviWindow * pWnd = pTab->wnd();
+ closeTab(pWnd, pTab);
+}
+
+void KviNotifierWindowTabs::closeCurrentTab()
+{
+ // Paranoic checks...
+ if (!m_pTabFocused) return; // The current tab is null? Please, kill me...
+ KviNotifierWindowTab * pTab = m_pTabFocused;
+ if (m_tabMap.isEmpty()) return; // Empty??? The World is ending...
+ KviWindow * pWnd = pTab->wnd();
+ if (!m_tabMap.contains(pWnd)) return; // The current tab is not on the map??? Call 911!!
+ // End paranoic stuff, go back to sanity...
+
+ closeTab(pWnd, pTab);
+}
+
+void KviNotifierWindowTabs::closeTab(KviWindow * pWnd, KviNotifierWindowTab * pTab)
+{
+ // Ok, we should be sure to delete the right tab...
+ m_tabPtrList.removeRef(pTab);
+ m_lastVisitedTabPtrList.removeRef(pTab);
+ m_tabMap.remove(pWnd);
+ delete pTab;
+
+ if(m_tabMap.empty())
+ {
+ m_pTabFocused = 0;
+ g_pNotifierWindow->showLineEdit(false);
+ g_pNotifierWindow->doHide(false);
+ } else {
+
+ if (m_lastVisitedTabPtrList.count()) {
+ m_pTabFocused = m_lastVisitedTabPtrList.first();
+ } else {
+ m_pTabFocused = m_tabPtrList.last();
+ }
+
+ m_pTabFocused->setFocused(true);
+ }
+}
+
+#include "m_notifierwindowtabs.moc"
diff --git a/src/modules/notifier/notifierwindowtabs.h b/src/modules/notifier/notifierwindowtabs.h
new file mode 100644
index 00000000..555906b8
--- /dev/null
+++ b/src/modules/notifier/notifierwindowtabs.h
@@ -0,0 +1,263 @@
+#ifndef _KVINOTIFIERWINDOWTABS_H_
+#define _KVINOTIFIERWINDOWTABS_H_
+//=============================================================================
+//
+// File : kvinotifierwindowtabs.h
+// Created on dom 02 gen 2005 15:30:50 by Iacopo Palazzi
+//
+// This file is part of the KVIrc distribution
+// Copyright (C) 2005 Iacopo Palazzi < iakko(at)siena.linux.it >
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+//=============================================================================
+
+#include <qfont.h>
+#include <qmap.h>
+#include <qobject.h>
+#include <qpixmap.h>
+#include <qpoint.h>
+#include <qrect.h>
+#include "kvi_settings.h"
+#include "kvi_pointerlist.h"
+#include "notifiersettings.h"
+#include "notifierwindow.h"
+
+#include "notifiermessage.h"
+
+
+class QPainter;
+class KviWindow;
+class KviNotifierWindowTab;
+
+typedef struct wndTabPair_s {
+ KviNotifierWindowTab * pTab;
+ KviWindow * pWnd;
+} wndTabPair;
+
+class KviNotifierWindowTab : public QObject // this class defines an object for every single tab about the tabs area
+{
+ Q_OBJECT
+public:
+ KviNotifierWindowTab(KviWindow *, QString);
+ ~KviNotifierWindowTab();
+
+// ================================
+// Put members declaration below...
+// ================================
+private:
+ bool m_bFocused;
+
+ QColor m_cLabel;
+ QColor m_clrHighlightedLabel;
+ QColor m_clrNormalLabel;
+ QColor m_clrChangedLabel;
+
+ QRect m_rect;
+
+ QString m_label;
+
+ KviPointerList<KviNotifierMessage> * m_pMessageList;
+ KviWindow * m_pWnd;
+ KviNotifierMessage * m_pCurrentMessage;
+
+ TabState m_eState;
+
+public:
+
+protected:
+
+
+// ================================
+// Put methods declaration below...
+// ================================
+private:
+
+private slots:
+ void labelChanged();
+ void closeMe();
+
+public:
+ bool focused() { return m_bFocused; };
+
+ int countMessage() { return m_pMessageList->count(); };
+ int width(bool b = false);
+
+ void appendMessage(KviNotifierMessage * m);
+ void setCurrentMessage(KviNotifierMessage * m) { m_pCurrentMessage = m; };
+ void setFocused(bool b = true);
+ void setLastMessageAsCurrent();
+ void setNextMessageAsCurrent();
+ void setPrevMessageAsCurrent();
+ void setState(TabState state);
+ void setRect(int x, int y, int w, int h) { m_rect.setX(x); m_rect.setY(y); m_rect.setWidth(w); m_rect.setHeight(h); };
+
+ QColor labelColor() {return m_cLabel; }
+ QRect rect() { return m_rect; };
+ QString label() { return m_label; };
+
+ KviNotifierMessage * currentMessage() { return m_pCurrentMessage; };
+ KviPointerList<KviNotifierMessage> * messageList() { return m_pMessageList; };
+ KviWindow * window() { return m_pWnd; };
+ KviWindow * wnd() {return m_pWnd; };
+
+ TabState state() { return m_eState; };
+
+protected:
+
+
+
+};
+
+
+//####################################################################################################
+//## Tabs Manager
+//####################################################################################################
+
+
+class KviNotifierWindowTabs // this class defines the tabs area
+{
+public:
+ KviNotifierWindowTabs(QRect r);
+ ~KviNotifierWindowTabs();
+
+// ================================
+// Put members declaration below...
+// ================================
+private:
+ QRect m_rct;
+ QPoint m_pnt;
+
+ QMap<KviWindow *, KviNotifierWindowTab *> m_tabMap;
+ KviPointerList<KviNotifierWindowTab> m_tabPtrList;
+ KviPointerList<KviNotifierWindowTab> m_lastVisitedTabPtrList;
+
+ QFont * m_pFocusedFont;
+ QFont * m_pUnfocusedFont;
+
+ KviNotifierWindowTab * m_pTabFocused;
+ KviWindow * m_pWndTabFocused;
+
+ QRect m_rctNextIcon;
+ QRect m_rctPrevIcon;
+ QRect m_rctCloseTabIcon;
+ QRect m_rctCloseTabIconHotArea;
+ QRect m_rctTabs;
+
+ QPainter * m_pPainter;
+ QPixmap * m_pPixmap;
+
+ QPixmap m_pixDX;
+ QPixmap m_pixSX;
+ QPixmap m_pixBKG;
+ QPixmap m_pixSXFocused;
+ QPixmap m_pixDXFocused;
+ QPixmap m_pixBKGFocused;
+ QPixmap m_pixSXUnfocused;
+ QPixmap m_pixDXUnfocused;
+ QPixmap m_pixBKGUnfocused;
+
+ QPixmap m_pixIconTabPrev;
+ QPixmap m_pixIconTabPrev_out;
+ QPixmap m_pixIconTabPrev_over;
+ QPixmap m_pixIconTabPrev_clicked;
+
+ QPixmap m_pixIconTabNext;
+ QPixmap m_pixIconTabNext_out;
+ QPixmap m_pixIconTabNext_over;
+ QPixmap m_pixIconTabNext_clicked;
+
+ QPixmap m_pixIconCloseTab;
+ QPixmap m_pixIconCloseTab_off;
+ QPixmap m_pixIconCloseTab_on;
+ QPixmap m_pixIconCloseTab_clicked;
+
+ int m_closeTabIconState;
+ int m_iTabToStartFrom;
+
+ bool m_bIsOverLeftBound;
+ bool m_bIsOverRightBound;
+ bool m_bNeedToRedraw;
+
+public:
+
+protected:
+
+
+// ================================
+// Put methods declaration below...
+// ================================
+private:
+ void initConfig();
+ void loadImages();
+
+public:
+ void addMessage(KviWindow *, KviNotifierMessage *);
+ void closeCurrentTab();
+ void closeTab(KviWindow * pWnd); // referes to void closeTab(KviWindow * pWnd, KviNotifierWindowTab * pTab);
+ void closeTab(KviNotifierWindowTab * pTab); // referes to void closeTab(KviWindow * pWnd, KviNotifierWindowTab * pTab);
+ void closeTab(KviWindow * pWnd, KviNotifierWindowTab * pTab);
+ void draw(QPainter *);
+ void needToRedraw() { m_bNeedToRedraw = true; };
+ void markAllMessagesAsHistoric();
+ void mouseMoveEvent(QMouseEvent * e);
+ void mousePressEvent(QMouseEvent * e);
+ void mouseReleaseEvent(QMouseEvent * e);
+ void next();
+ void prev();
+ void recalculatePositions();
+ void resetIcons();
+ void resize(QRect);
+ void scrollTabsLeft();
+ void scrollTabsRight();
+ void setCloseTabIcon(int state);
+ void setCurrentMessage(KviNotifierMessage * m) { if(m_pTabFocused)m_pTabFocused->setCurrentMessage(m); };
+ void setFocusOn(KviNotifierWindowTab *);
+ void setPoint(int x, int y) { m_pnt.setX(x); m_pnt.setY(y); };
+ void setWidth(int w);
+ void touch() { m_bNeedToRedraw = true; };
+
+ int baseLine() { return (y()+height()); };
+ int closeTabIconState() { return m_closeTabIconState; };
+ int count() { return (int)m_tabMap.count(); };
+ int height() { return m_rct.height(); };
+ int width() { return m_rct.width(); };
+ int x() { return m_pnt.x(); };
+ int y() { return m_pnt.y(); };
+
+ QFont * fontFocused() { return m_pFocusedFont; };
+ QFont * fontUnfocused() { return m_pUnfocusedFont; };
+
+ QPixmap * tabFocusedPixSx() {return &m_pixSXFocused; };
+ QPixmap * tabFocusedPixDx() {return &m_pixDXFocused; };
+ QPixmap * tabUnfocusedPixSx() {return &m_pixSXUnfocused; };
+ QPixmap * tabUnfocusedPixDx() {return &m_pixDXUnfocused; };
+
+ QRect rect() {return m_rct;};
+ QRect rctCloseTabIconHotArea() {return m_rctCloseTabIconHotArea; };
+
+ KviNotifierWindowTab * currentTab() { return m_pTabFocused; };
+
+ KviNotifierMessage * currentMessage() { return m_pTabFocused ? m_pTabFocused->currentMessage() : 0; };
+
+ KviWindow * window() { return m_pTabFocused->wnd(); };
+
+
+
+protected:
+
+};
+
+#endif //!_KVINOTIFIERWINDOWTABS_H_
diff --git a/src/modules/notifier/pics/Makefile.am b/src/modules/notifier/pics/Makefile.am
new file mode 100755
index 00000000..26f8bf9b
--- /dev/null
+++ b/src/modules/notifier/pics/Makefile.am
@@ -0,0 +1,9 @@
+###############################################################################
+# KVirc IRC client Makefile - 10.03.2000 Szymon Stefanek <stefanek@tin.it>
+###############################################################################
+
+tmpdir = $(picsdir)
+
+tmp_DATA= *.png
+
+EXTRA_DIST = $(tmp_DATA)
diff --git a/src/modules/notifier/pics/notifier_background.png b/src/modules/notifier/pics/notifier_background.png
new file mode 100755
index 00000000..2787f64c
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_background.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_close.png b/src/modules/notifier/pics/notifier_close.png
new file mode 100644
index 00000000..95ce3d8b
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_close.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_down.png b/src/modules/notifier/pics/notifier_down.png
new file mode 100644
index 00000000..01e11383
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_down.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_icon_body_next_clicked.png b/src/modules/notifier/pics/notifier_icon_body_next_clicked.png
new file mode 100644
index 00000000..2cab5af8
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_icon_body_next_clicked.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_icon_body_next_off.png b/src/modules/notifier/pics/notifier_icon_body_next_off.png
new file mode 100644
index 00000000..6a93e780
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_icon_body_next_off.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_icon_body_next_on.png b/src/modules/notifier/pics/notifier_icon_body_next_on.png
new file mode 100644
index 00000000..86dfe01e
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_icon_body_next_on.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_icon_body_prev_clicked.png b/src/modules/notifier/pics/notifier_icon_body_prev_clicked.png
new file mode 100644
index 00000000..ab8a9af3
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_icon_body_prev_clicked.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_icon_body_prev_off.png b/src/modules/notifier/pics/notifier_icon_body_prev_off.png
new file mode 100644
index 00000000..af9e5307
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_icon_body_prev_off.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_icon_body_prev_on.png b/src/modules/notifier/pics/notifier_icon_body_prev_on.png
new file mode 100644
index 00000000..10cc8f18
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_icon_body_prev_on.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_icon_body_write_clicked.png b/src/modules/notifier/pics/notifier_icon_body_write_clicked.png
new file mode 100644
index 00000000..1dc06165
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_icon_body_write_clicked.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_icon_body_write_off.png b/src/modules/notifier/pics/notifier_icon_body_write_off.png
new file mode 100644
index 00000000..1096b7a8
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_icon_body_write_off.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_icon_body_write_on.png b/src/modules/notifier/pics/notifier_icon_body_write_on.png
new file mode 100644
index 00000000..55fe9d9e
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_icon_body_write_on.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_icon_close_clicked.png b/src/modules/notifier/pics/notifier_icon_close_clicked.png
new file mode 100644
index 00000000..f68f16f0
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_icon_close_clicked.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_icon_close_clicked_hl.png b/src/modules/notifier/pics/notifier_icon_close_clicked_hl.png
new file mode 100644
index 00000000..d7bcc291
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_icon_close_clicked_hl.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_icon_close_out.png b/src/modules/notifier/pics/notifier_icon_close_out.png
new file mode 100644
index 00000000..ccec0bdb
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_icon_close_out.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_icon_close_out_hl.png b/src/modules/notifier/pics/notifier_icon_close_out_hl.png
new file mode 100644
index 00000000..89917dae
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_icon_close_out_hl.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_icon_close_over.png b/src/modules/notifier/pics/notifier_icon_close_over.png
new file mode 100644
index 00000000..e3cffc0f
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_icon_close_over.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_icon_close_over_hl.png b/src/modules/notifier/pics/notifier_icon_close_over_hl.png
new file mode 100644
index 00000000..6a7f1bc0
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_icon_close_over_hl.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_icon_tab_close_clicked.png b/src/modules/notifier/pics/notifier_icon_tab_close_clicked.png
new file mode 100644
index 00000000..ac647250
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_icon_tab_close_clicked.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_icon_tab_close_off.png b/src/modules/notifier/pics/notifier_icon_tab_close_off.png
new file mode 100644
index 00000000..105c728b
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_icon_tab_close_off.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_icon_tab_close_on.png b/src/modules/notifier/pics/notifier_icon_tab_close_on.png
new file mode 100644
index 00000000..dfd87ffe
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_icon_tab_close_on.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_icon_tab_next_clicked.png b/src/modules/notifier/pics/notifier_icon_tab_next_clicked.png
new file mode 100644
index 00000000..b6d98d3e
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_icon_tab_next_clicked.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_icon_tab_next_out.png b/src/modules/notifier/pics/notifier_icon_tab_next_out.png
new file mode 100644
index 00000000..4e4cf075
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_icon_tab_next_out.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_icon_tab_next_over.png b/src/modules/notifier/pics/notifier_icon_tab_next_over.png
new file mode 100644
index 00000000..9f1f8f90
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_icon_tab_next_over.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_icon_tab_prev_clicked.png b/src/modules/notifier/pics/notifier_icon_tab_prev_clicked.png
new file mode 100644
index 00000000..a24139b5
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_icon_tab_prev_clicked.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_icon_tab_prev_out.png b/src/modules/notifier/pics/notifier_icon_tab_prev_out.png
new file mode 100644
index 00000000..20e4a06f
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_icon_tab_prev_out.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_icon_tab_prev_over.png b/src/modules/notifier/pics/notifier_icon_tab_prev_over.png
new file mode 100644
index 00000000..68b390f7
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_icon_tab_prev_over.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_left.png b/src/modules/notifier/pics/notifier_left.png
new file mode 100644
index 00000000..b0887a7f
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_left.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pen.png b/src/modules/notifier/pics/notifier_pen.png
new file mode 100644
index 00000000..31978d1b
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pen.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_body_dwn.png b/src/modules/notifier/pics/notifier_pix_body_dwn.png
new file mode 100644
index 00000000..4a96de08
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_body_dwn.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_body_dwndx.png b/src/modules/notifier/pics/notifier_pix_body_dwndx.png
new file mode 100644
index 00000000..5b8ca523
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_body_dwndx.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_body_dwnsx.png b/src/modules/notifier/pics/notifier_pix_body_dwnsx.png
new file mode 100644
index 00000000..ffa3c980
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_body_dwnsx.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_body_dx.png b/src/modules/notifier/pics/notifier_pix_body_dx.png
new file mode 100644
index 00000000..c2ca5ce0
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_body_dx.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_body_kvirc.png b/src/modules/notifier/pics/notifier_pix_body_kvirc.png
new file mode 100644
index 00000000..1a304b0a
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_body_kvirc.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_body_kvirc_dwn.png b/src/modules/notifier/pics/notifier_pix_body_kvirc_dwn.png
new file mode 100644
index 00000000..37168c57
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_body_kvirc_dwn.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_body_kvirc_sx.png b/src/modules/notifier/pics/notifier_pix_body_kvirc_sx.png
new file mode 100644
index 00000000..acd39ab5
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_body_kvirc_sx.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_body_sx.png b/src/modules/notifier/pics/notifier_pix_body_sx.png
new file mode 100644
index 00000000..c1a5315a
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_body_sx.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_caption_bkg.png b/src/modules/notifier/pics/notifier_pix_caption_bkg.png
new file mode 100644
index 00000000..96b691df
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_caption_bkg.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_caption_bkg_hl.png b/src/modules/notifier/pics/notifier_pix_caption_bkg_hl.png
new file mode 100644
index 00000000..0c5f155c
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_caption_bkg_hl.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_caption_dx.png b/src/modules/notifier/pics/notifier_pix_caption_dx.png
new file mode 100644
index 00000000..76a37a61
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_caption_dx.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_caption_dx_hl.png b/src/modules/notifier/pics/notifier_pix_caption_dx_hl.png
new file mode 100644
index 00000000..ceca1a1d
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_caption_dx_hl.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_caption_sx.png b/src/modules/notifier/pics/notifier_pix_caption_sx.png
new file mode 100644
index 00000000..2939f96b
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_caption_sx.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_caption_sx_hl.png b/src/modules/notifier/pics/notifier_pix_caption_sx_hl.png
new file mode 100644
index 00000000..78be4e71
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_caption_sx_hl.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_tab_bkg.png b/src/modules/notifier/pics/notifier_pix_tab_bkg.png
new file mode 100644
index 00000000..3918b044
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_tab_bkg.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_tab_dx.png b/src/modules/notifier/pics/notifier_pix_tab_dx.png
new file mode 100644
index 00000000..112d9604
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_tab_dx.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_tab_focused_bkg.png b/src/modules/notifier/pics/notifier_pix_tab_focused_bkg.png
new file mode 100644
index 00000000..ef42ef68
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_tab_focused_bkg.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_tab_focused_dx.png b/src/modules/notifier/pics/notifier_pix_tab_focused_dx.png
new file mode 100644
index 00000000..e8dee6b9
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_tab_focused_dx.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_tab_focused_sx.png b/src/modules/notifier/pics/notifier_pix_tab_focused_sx.png
new file mode 100644
index 00000000..f94cbb55
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_tab_focused_sx.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_tab_sx.png b/src/modules/notifier/pics/notifier_pix_tab_sx.png
new file mode 100644
index 00000000..0f693bdd
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_tab_sx.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_tab_unfocused_bkg.png b/src/modules/notifier/pics/notifier_pix_tab_unfocused_bkg.png
new file mode 100644
index 00000000..36a5f22e
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_tab_unfocused_bkg.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_tab_unfocused_dx.png b/src/modules/notifier/pics/notifier_pix_tab_unfocused_dx.png
new file mode 100644
index 00000000..f7ba1ee1
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_tab_unfocused_dx.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_tab_unfocused_sx.png b/src/modules/notifier/pics/notifier_pix_tab_unfocused_sx.png
new file mode 100644
index 00000000..aa01c4c6
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_tab_unfocused_sx.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_wnd_dwn.png b/src/modules/notifier/pics/notifier_pix_wnd_dwn.png
new file mode 100644
index 00000000..7f94fef4
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_wnd_dwn.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_wnd_dwn_hl.png b/src/modules/notifier/pics/notifier_pix_wnd_dwn_hl.png
new file mode 100644
index 00000000..6090316b
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_wnd_dwn_hl.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_wnd_dwndx.png b/src/modules/notifier/pics/notifier_pix_wnd_dwndx.png
new file mode 100644
index 00000000..429fa4a0
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_wnd_dwndx.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_wnd_dwndx_hl.png b/src/modules/notifier/pics/notifier_pix_wnd_dwndx_hl.png
new file mode 100644
index 00000000..2c392742
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_wnd_dwndx_hl.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_wnd_dwnsx.png b/src/modules/notifier/pics/notifier_pix_wnd_dwnsx.png
new file mode 100644
index 00000000..3fb987ef
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_wnd_dwnsx.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_wnd_dwnsx_hl.png b/src/modules/notifier/pics/notifier_pix_wnd_dwnsx_hl.png
new file mode 100644
index 00000000..eb51c09a
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_wnd_dwnsx_hl.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_wnd_dx.png b/src/modules/notifier/pics/notifier_pix_wnd_dx.png
new file mode 100644
index 00000000..0a1c4f4b
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_wnd_dx.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_wnd_dx_hl.png b/src/modules/notifier/pics/notifier_pix_wnd_dx_hl.png
new file mode 100644
index 00000000..24d1cde6
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_wnd_dx_hl.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_wnd_sx.png b/src/modules/notifier/pics/notifier_pix_wnd_sx.png
new file mode 100644
index 00000000..01fb63fd
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_wnd_sx.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_pix_wnd_sx_hl.png b/src/modules/notifier/pics/notifier_pix_wnd_sx_hl.png
new file mode 100644
index 00000000..9a18f058
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_pix_wnd_sx_hl.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_right.png b/src/modules/notifier/pics/notifier_right.png
new file mode 100644
index 00000000..85819102
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_right.png
Binary files differ
diff --git a/src/modules/notifier/pics/notifier_up.png b/src/modules/notifier/pics/notifier_up.png
new file mode 100644
index 00000000..f846b624
--- /dev/null
+++ b/src/modules/notifier/pics/notifier_up.png
Binary files differ