diff options
| author | 2008-07-06 19:09:41 +0000 | |
|---|---|---|
| committer | 2008-07-06 19:09:41 +0000 | |
| commit | c0b02c7f23f263e40987162ab0a27c2b9e92cd0c (patch) | |
| tree | 7ebd65f6f38bb1f43c6562bc312c0bfe564df0b5 /src | |
| parent | Updated (diff) | |
| download | KVIrc-c0b02c7f23f263e40987162ab0a27c2b9e92cd0c.tar.gz KVIrc-c0b02c7f23f263e40987162ab0a27c2b9e92cd0c.tar.bz2 KVIrc-c0b02c7f23f263e40987162ab0a27c2b9e92cd0c.zip | |
feature request #164
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@2024 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src')
| -rw-r--r-- | src/kvirc/ui/kvi_window.cpp | 10 | ||||
| -rw-r--r-- | src/kvirc/ui/kvi_window.h | 1 | ||||
| -rw-r--r-- | src/modules/window/libkviwindow.cpp | 62 |
3 files changed, 72 insertions, 1 deletions
diff --git a/src/kvirc/ui/kvi_window.cpp b/src/kvirc/ui/kvi_window.cpp index 8afe8b9da..d859b21ff 100644 --- a/src/kvirc/ui/kvi_window.cpp +++ b/src/kvirc/ui/kvi_window.cpp @@ -347,6 +347,16 @@ bool KviWindow::highlightMeter(unsigned int *v) return true; } + +bool KviWindow::highlightMe(unsigned int v) +{ + if(v<0) v=0; + if(v>5) v=5; + if(m_pTaskBarItem) + m_pTaskBarItem->highlight(v); + return true; +} + const char * KviWindow::m_typeTable[KVI_WINDOW_NUM_TYPES + 1]= { "console", diff --git a/src/kvirc/ui/kvi_window.h b/src/kvirc/ui/kvi_window.h index d2f684819..81bcc0497 100644 --- a/src/kvirc/ui/kvi_window.h +++ b/src/kvirc/ui/kvi_window.h @@ -222,6 +222,7 @@ public: virtual bool activityMeter(unsigned int * puActivityValue,unsigned int * puActivityTemperature); virtual bool highlightMeter(unsigned int * puHighlightValue); + virtual bool highlightMe(unsigned int v); void unhighlight(); diff --git a/src/modules/window/libkviwindow.cpp b/src/modules/window/libkviwindow.cpp index 1d39d88a6..8e79aec11 100644 --- a/src/modules/window/libkviwindow.cpp +++ b/src/modules/window/libkviwindow.cpp @@ -658,6 +658,58 @@ static bool window_kvs_fnc_exists(KviKvsModuleFunctionCall * c) } /* + @doc: window.highlight + @type: + command + @title: + window.highlight + @short: + Sets the highlight (alert) level of a window + @syntax: + window.highlight [-q] <level> [window_id] + @switches: + !sw: -q | --quiet + Be quiet + @description: + Sets the highlight the user window specified by [window_id] to <level>.[br] + If <window_id> is an empty string then the current window is assumed.[br] + If the specified window does not exist a warning is printed unless the -q switch is used.[br] + For more infos on this feature read the documentation about [fnc]$window.highlightLevel[/fnc]. + @seealso: + [fnc]$window.highlightLevel[/fnc] +*/ + +static bool window_kvs_cmd_highlight(KviKvsModuleCommandCall * c) +{ + QString szWnd; + KviWindow * pWnd; + kvs_uint_t level; + + KVSM_PARAMETERS_BEGIN(c) + KVSM_PARAMETER("level",KVS_PT_UINT,0,level) + KVSM_PARAMETER("window_id",KVS_PT_STRING,KVS_PF_OPTIONAL,szWnd) + KVSM_PARAMETERS_END(c) + if(c->parameterList()->count() == 1) + { + pWnd = c->window(); + } else { + pWnd = g_pApp->findWindow(szWnd.toUtf8().data()); + if(!pWnd) + { + if(!c->hasSwitch('q',"quiet")) + c->warning(__tr2qs("The window with id '%s' does not exist"),szWnd.toUtf8().data()); + return true; + } + } + + //force the previous level to be lower + pWnd->unhighlight(); + //level boundaries checking is done by the upstream function + pWnd->highlightMe(level); + return true; +} + +/* @doc: window.highlightLevel @type: function @@ -669,9 +721,17 @@ static bool window_kvs_fnc_exists(KviKvsModuleFunctionCall * c) $window.highlightLevel $window.highlightLevel(<window_id>) @description: + Every window has a current alert level; it corresponds to an highlight color of that window in the taskbar. + There are 6 defined levels, they start from 0 (normal) to 5 (max alarm level). The classic taskbar and the tree taskbar use different colors to represent these levels. Classic task bar uses options: + [ul][li]colorTaskBarNormalText : normale state[/li][li]colorTaskBarHighlight1Text : highlight state 1[/li][li]...[/li][li]colorTaskBarHighlight5Text : highlight state 5[/li][/ul] + While the tree taskbar uses options: + [ul][li]colorTreeTaskBarForeground : normale state[/li][li]colorTreeTaskBarHighlight1Foreground : highlight state 1[/li][li]...[/li][li]colorTreeTaskBarHighlight5Foreground : highlight state 5[/li][/ul] + You can use [fnc]$option[/fnc] to read these options and the [cmd]option[/cmd] command to set them. @seealso: [fnc]$window.activityTemperature[/fnc] [fnc]$window.activityLevel[/fnc] + [fnc]$option[/fnc] + [cmd]option[/cmd] */ static bool window_kvs_fnc_highlightLevel(KviKvsModuleFunctionCall * c) @@ -1512,7 +1572,7 @@ static bool window_module_init(KviModule *m) KVSM_REGISTER_FUNCTION(m,"inputText",window_kvs_fnc_inputText); KVSM_REGISTER_FUNCTION(m,"context",window_kvs_fnc_context); - //KVSM_REGISTER_SIMPLE_COMMAND(m,"highlight",window_kvs_cmd_highlight); + KVSM_REGISTER_SIMPLE_COMMAND(m,"highlight",window_kvs_cmd_highlight); KVSM_REGISTER_SIMPLE_COMMAND(m,"close",window_kvs_cmd_close); KVSM_REGISTER_SIMPLE_COMMAND(m,"clearOutput",window_kvs_cmd_clearOutput); KVSM_REGISTER_SIMPLE_COMMAND(m,"dock",window_kvs_cmd_dock); |
