From ff28d125380b2dbceb410f6f15785b78808fdad9 Mon Sep 17 00:00:00 2001 From: Elvio Basello Date: Sat, 5 Apr 2008 17:13:08 +0000 Subject: code clean git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@1398 17fca916-40b9-46aa-a4ea-0a15b648b75c --- src/modules/CMakeLists.txt | 5 +- src/modules/mask/libkvimask.cpp | 150 ++++++------ src/modules/math/libkvimath.cpp | 21 +- src/modules/mircimport/libkvimircimport.cpp | 25 +- src/modules/mircimport/libkvimircimport.h | 10 +- src/modules/my/idle.cpp | 7 +- src/modules/my/idle.h | 13 +- src/modules/my/idle_mac.cpp | 258 ++++++++++----------- src/modules/my/idle_win.cpp | 158 ++++++------- src/modules/my/idle_x11.cpp | 147 ++++++------ src/modules/my/libkvimy.cpp | 6 +- src/modules/notifier/libkvinotifier.cpp | 10 +- src/modules/notifier/notifiermessage.cpp | 20 +- src/modules/notifier/notifiermessage.h | 33 ++- src/modules/notifier/notifierwindow.cpp | 135 ++++------- src/modules/notifier/notifierwindow.h | 32 ++- src/modules/notifier/notifierwindowbody.cpp | 35 +-- src/modules/notifier/notifierwindowbody.h | 16 +- src/modules/notifier/notifierwindowborder.cpp | 24 +- src/modules/notifier/notifierwindowborder.h | 6 +- src/modules/notifier/notifierwindowprogressbar.h | 6 +- src/modules/notifier/notifierwindowtabs.cpp | 41 ++-- src/modules/notifier/notifierwindowtabs.h | 18 +- src/modules/objects/libkviobjects.cpp | 174 +++++++------- src/modules/perl/libkviperl.cpp | 4 +- src/modules/perlcore/libkviperlcore.cpp | 3 +- src/modules/perlcore/perlcoreinterface.h | 2 +- src/modules/popupeditor/libkvipopupeditor.cpp | 11 +- src/modules/popupeditor/popupeditor.cpp | 68 +----- src/modules/popupeditor/popupeditor.h | 16 +- src/modules/raweditor/libkviraweditor.cpp | 11 +- src/modules/raweditor/raweditor.cpp | 61 ++--- src/modules/raweditor/raweditor.h | 9 +- src/modules/rijndael/libkvirijndael.cpp | 11 +- src/modules/rijndael/rijndael.cpp | 2 +- src/modules/rijndael/rijndael.h | 6 +- src/modules/sharedfile/libkvisharedfile.cpp | 13 +- .../sharedfileswindow/libkvisharedfileswindow.cpp | 10 +- .../sharedfileswindow/sharedfileswindow.cpp | 25 +- src/modules/sharedfileswindow/sharedfileswindow.h | 9 +- src/modules/socketspy/libkvisocketspy.cpp | 11 +- src/modules/socketspy/socketspywindow.cpp | 10 +- src/modules/spaste/controller.cpp | 34 +-- src/modules/spaste/controller.h | 49 ++-- src/modules/spaste/libkvispaste.cpp | 14 +- src/modules/spaste/libkvispaste.h | 31 ++- 46 files changed, 780 insertions(+), 980 deletions(-) (limited to 'src') diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt index 21a533d52..980ece711 100644 --- a/src/modules/CMakeLists.txt +++ b/src/modules/CMakeLists.txt @@ -21,7 +21,7 @@ INCLUDE_DIRECTORIES( SUBDIRS( about action actioneditor addon aliaseditor avatar - chan channelsjoin clock codetester config context + chan channelsjoin clock codetester config context dcc dialog editor eventeditor file filetransferwindow @@ -30,8 +30,7 @@ SUBDIRS( lamerizer links list log logview mask math mediaplayer mircimport my notifier - objects - options + objects options popupeditor raweditor regchan reguser rijndael setup sharedfile sharedfileswindow snd socketspy spaste str system diff --git a/src/modules/mask/libkvimask.cpp b/src/modules/mask/libkvimask.cpp index 23d9876d7..c993e95da 100644 --- a/src/modules/mask/libkvimask.cpp +++ b/src/modules/mask/libkvimask.cpp @@ -22,34 +22,32 @@ #include "kvi_module.h" - #include "kvi_locale.h" #include "kvi_string.h" #include "kvi_ircmask.h" - /* - @doc: mask.match - @type: - function - @title: - $mask.match - @short: - Matches a mask agains a wildcarded one - @syntax: - $mask.match(,) - @description: - Returns 1 if the matches and 0 otherwise. - can obviously contain wildcards ('*' and '?'). - @example: - [example] - [cmd]if[/cmd]($mask.match(*!*@*.linux.it,$0)) - [cmd]op[/cmd] [fnc]$mask.nick[/fnc]($0) - [/example] - */ +/* + @doc: mask.match + @type: + function + @title: + $mask.match + @short: + Matches a mask agains a wildcarded one + @syntax: + $mask.match(,) + @description: + Returns 1 if the matches and 0 otherwise. + can obviously contain wildcards ('*' and '?'). + @example: + [example] + [cmd]if[/cmd]($mask.match(*!*@*.linux.it,$0)) + [cmd]op[/cmd] [fnc]$mask.nick[/fnc]($0) + [/example] +*/ static bool mask_kvs_fnc_match(KviKvsModuleFunctionCall * c) -{ - +{ QString wildmask,fixedmask; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("wildcard mask",KVS_PT_STRING,0,wildmask) @@ -61,23 +59,22 @@ static bool mask_kvs_fnc_match(KviKvsModuleFunctionCall * c) return true; } - /* - @doc: mask.nick - @type: - function - @title: - $mask.nick - @short: - Returns the nick part of an IRC mask - @syntax: - $mask.nick() - @description: - Returns the nickname part of an IRC mask. - */ +/* + @doc: mask.nick + @type: + function + @title: + $mask.nick + @short: + Returns the nick part of an IRC mask + @syntax: + $mask.nick() + @description: + Returns the nickname part of an IRC mask. +*/ static bool mask_kvs_fnc_nick(KviKvsModuleFunctionCall * c) { - QString mask; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("mask",KVS_PT_STRING,0,mask) @@ -87,23 +84,22 @@ static bool mask_kvs_fnc_nick(KviKvsModuleFunctionCall * c) return true; } - /* - @doc: mask.user - @type: - function - @title: - $mask.user - @short: - Returns the username part of an IRC mask - @syntax: - $mask.user() - @description: - Returns the username part of an IRC mask. - */ +/* + @doc: mask.user + @type: + function + @title: + $mask.user + @short: + Returns the username part of an IRC mask + @syntax: + $mask.user() + @description: + Returns the username part of an IRC mask. +*/ static bool mask_kvs_fnc_user(KviKvsModuleFunctionCall * c) { - QString mask; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("mask",KVS_PT_STRING,0,mask) @@ -114,19 +110,19 @@ static bool mask_kvs_fnc_user(KviKvsModuleFunctionCall * c) } - /* - @doc: mask.host - @type: - function - @title: - $mask.host - @short: - Returns the hostname part of an IRC mask - @syntax: - $mask.host() - @description: - Returns the hostname part of an IRC mask. - */ +/* + @doc: mask.host + @type: + function + @title: + $mask.host + @short: + Returns the hostname part of an IRC mask + @syntax: + $mask.host() + @description: + Returns the hostname part of an IRC mask. +*/ static bool mask_kvs_fnc_host(KviKvsModuleFunctionCall * c) { @@ -140,19 +136,19 @@ static bool mask_kvs_fnc_host(KviKvsModuleFunctionCall * c) } - /* - @doc: mask.hasnumerichost - @type: - function - @title: - $mask.hasNumericHost - @short: - Checks if a host part of a mask is numeric - @syntax: - $mask.hasNumericHost() - @description: - Returns 1 if the hostname part of the mask is numeric (e.g : unresolved IPV4 or IPV6 address) - */ +/* + @doc: mask.hasnumerichost + @type: + function + @title: + $mask.hasNumericHost + @short: + Checks if a host part of a mask is numeric + @syntax: + $mask.hasNumericHost() + @description: + Returns 1 if the hostname part of the mask is numeric (e.g : unresolved IPV4 or IPV6 address) +*/ static bool mask_kvs_fnc_hasnumerichost(KviKvsModuleFunctionCall * c) @@ -191,7 +187,7 @@ static bool mask_module_cleanup(KviModule *m) KVIRC_MODULE( "File", // module name - "1.0.0", // module version + "4.0.0", // module version "Copyright (C) 2002 Szymon Stefanek (pragma at kvirc dot net)", "Mask manipulation functions", mask_module_init, diff --git a/src/modules/math/libkvimath.cpp b/src/modules/math/libkvimath.cpp index 62b7cda75..917ec558d 100644 --- a/src/modules/math/libkvimath.cpp +++ b/src/modules/math/libkvimath.cpp @@ -51,7 +51,7 @@ static bool __fncname(KviKvsModuleFunctionCall * c) \ } #ifdef COMPILE_ON_WINDOWS -// dobbiamo testare meglio, i risultati. +// we have to test better the results static double cbrt(double x) { if (x > 0.0) return pow(x, 1.0/3.0); @@ -69,6 +69,7 @@ static int isinf (double d) { return 0; } } + static int isnan (double d) { int expon = 0; double val = frexp (d, &expon); @@ -332,27 +333,21 @@ static bool math_kvs_fnc_isnan(KviKvsModuleFunctionCall * c) @description: Checks if the specified value is the infinity. */ -#ifdef COMPILE_ON_WINDOWS static bool math_kvs_fnc_isinf(KviKvsModuleFunctionCall * c) { kvs_real_t dReal; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("value",KVS_PT_REAL,0,dReal) KVSM_PARAMETERS_END(c) +#ifdef COMPILE_ON_WINDOWS c->returnValue()->setBoolean(sinf(dReal)); - return true; -} #else -static bool math_kvs_fnc_isinf(KviKvsModuleFunctionCall * c) -{ - kvs_real_t dReal; - KVSM_PARAMETERS_BEGIN(c) - KVSM_PARAMETER("value",KVS_PT_REAL,0,dReal) - KVSM_PARAMETERS_END(c) c->returnValue()->setBoolean(isinf(dReal)); +#endif //COMPILE_ON_WINDOWS return true; } -#endif //COMPILE_ON_WINDOWS + + /* @doc: math.pow @type: @@ -431,6 +426,7 @@ static bool math_kvs_fnc_e(KviKvsModuleFunctionCall * c) return true; } #endif + static bool math_module_init(KviModule * m) { KVSM_REGISTER_FUNCTION(m,"sin",math_kvs_fnc_sin); @@ -455,7 +451,6 @@ static bool math_module_init(KviModule * m) return true; } - static bool math_module_cleanup(KviModule *m) { return true; @@ -463,7 +458,7 @@ static bool math_module_cleanup(KviModule *m) KVIRC_MODULE( "Math", // module name - "1.0.0", // module version + "4.0.0", // module version "Copyright (C) 2006 Szymon Stefanek (pragma at kvirc dot net),"\ "Tonino Imbesi (grifisx at barmes dot org)," \ "Alessandro Carbone (noldor at barmes dot org)", diff --git a/src/modules/mircimport/libkvimircimport.cpp b/src/modules/mircimport/libkvimircimport.cpp index 49eb78abd..7b72b0b1b 100644 --- a/src/modules/mircimport/libkvimircimport.cpp +++ b/src/modules/mircimport/libkvimircimport.cpp @@ -21,20 +21,20 @@ // #include "libkvimircimport.h" -#include "kvi_module.h" +#include "kvi_module.h" #include "kvi_filedialog.h" #include "kvi_fileutils.h" #include "kvi_locale.h" #include "kvi_config.h" #include "kvi_app.h" #include "kvi_qstring.h" +#include "kvi_tal_vbox.h" +#include +#include +#include -#include -#include -#include -#include "kvi_tal_vbox.h" KviMircServersIniImport * g_pMircServersIniImport = 0; KviRemoteMircServersIniImport * g_pRemoteMircServersIniImport = 0; @@ -132,14 +132,8 @@ void KviMircServersIniImport::die() - - - - #define KVI_WWWMIRCCOUK_SERVERSINI "http://www.mirc.co.uk/servers.ini" - - KviRemoteMircServerImportWizard::KviRemoteMircServerImportWizard(KviRemoteMircServersIniImport * f) : KviTalWizard(0) { @@ -163,7 +157,6 @@ KviRemoteMircServerImportWizard::KviRemoteMircServerImportWizard(KviRemoteMircSe vb->setStretchFactor(l,1); m_pUrlEdit = new QLineEdit(vb); - m_pUrlEdit->setText(KVI_WWWMIRCCOUK_SERVERSINI); addPage(vb,__tr2qs("URL Selection")); @@ -208,7 +201,6 @@ void KviRemoteMircServerImportWizard::done(int r) m_pFilter->die(); } - void KviRemoteMircServerImportWizard::start() { QString url = m_pUrlEdit->text(); @@ -236,7 +228,6 @@ void KviRemoteMircServerImportWizard::getListMessage(const QString &message) if(!message.isEmpty())m_pOutput->setText(message); } - void KviRemoteMircServerImportWizard::getListTerminated(bool bSuccess) { if(!m_pRequest)return; @@ -292,7 +283,6 @@ void KviRemoteMircServersIniImport::die() delete this; } - static KviModuleExtension * mircimport_local_filter_alloc(KviModuleExtensionAllocStruct * s) { if(g_pMircServersIniImport)delete g_pMircServersIniImport; @@ -372,8 +362,8 @@ KVIMODULEEXPORTFUNC KviIrcServerImport * mircimport_module_createIrcServerImport KVIRC_MODULE( - "File", // module name - "1.0.0", // module version + "mIRCimport", // module name + "4.0.0", // module version "Copyright (C) 2002 Szymon Stefanek (pragma at kvirc dot net)", // author & (C) "mIRC servers.ini importer", mircimport_module_init, @@ -385,4 +375,3 @@ KVIRC_MODULE( #ifndef COMPILE_USE_STANDALONE_MOC_SOURCES #include "libkvimircimport.moc" #endif //!COMPILE_USE_STANDALONE_MOC_SOURCES - diff --git a/src/modules/mircimport/libkvimircimport.h b/src/modules/mircimport/libkvimircimport.h index 61e3259b5..53fd71b6d 100644 --- a/src/modules/mircimport/libkvimircimport.h +++ b/src/modules/mircimport/libkvimircimport.h @@ -25,10 +25,12 @@ #include "kvi_mexserverimport.h" #include "kvi_string.h" #include "kvi_http.h" - #include -#include -#include + +#include +#include + +class KviRemoteMircServerImportWizard; class KviMircServersIniImport : public KviMexServerImport { @@ -42,8 +44,6 @@ public: virtual void die(); }; -class KviRemoteMircServerImportWizard; - class KviRemoteMircServersIniImport : public KviMircServersIniImport { Q_OBJECT diff --git a/src/modules/my/idle.cpp b/src/modules/my/idle.cpp index 75c576170..ee174aeec 100644 --- a/src/modules/my/idle.cpp +++ b/src/modules/my/idle.cpp @@ -20,9 +20,9 @@ #include"idle.h" -#include -#include -#include +#include +#include +#include static IdlePlatform *platform = 0; static int platform_ref = 0; @@ -133,4 +133,3 @@ void Idle::doCheck() #ifndef COMPILE_USE_STANDALONE_MOC_SOURCES #include "idle.moc" #endif //!COMPILE_USE_STANDALONE_MOC_SOURCES - diff --git a/src/modules/my/idle.h b/src/modules/my/idle.h index 414d24654..3ae4171ab 100644 --- a/src/modules/my/idle.h +++ b/src/modules/my/idle.h @@ -1,3 +1,5 @@ +#ifndef _IDLE_H_ +#define _IDLE_H_ /* * idle.h - detect desktop idle time * Copyright (C) 2003 Justin Karneges @@ -18,14 +20,13 @@ * */ -#ifndef IDLE_H -#define IDLE_H #include "kvi_settings.h" -#include -#include -#include -#include + +#include +#include +#include +#include class IdlePlatform; diff --git a/src/modules/my/idle_mac.cpp b/src/modules/my/idle_mac.cpp index 9fe775cfb..5234df5cc 100644 --- a/src/modules/my/idle_mac.cpp +++ b/src/modules/my/idle_mac.cpp @@ -20,143 +20,143 @@ #ifdef Q_OS_MACX -#include"idle.h" -#include - -// Why does Apple have to make this so complicated? -static OSStatus LoadFrameworkBundle(CFStringRef framework, CFBundleRef *bundlePtr) { - OSStatus err; - FSRef frameworksFolderRef; - CFURLRef baseURL; - CFURLRef bundleURL; - - if ( bundlePtr == nil ) return( -1 ); - - *bundlePtr = nil; - - baseURL = nil; - bundleURL = nil; - - err = FSFindFolder(kOnAppropriateDisk, kFrameworksFolderType, true, &frameworksFolderRef); - if (err == noErr) { - baseURL = CFURLCreateFromFSRef(kCFAllocatorSystemDefault, &frameworksFolderRef); - if (baseURL == nil) { - err = coreFoundationUnknownErr; + #include "idle.h" + #include + + // Why does Apple have to make this so complicated? + static OSStatus LoadFrameworkBundle(CFStringRef framework, CFBundleRef *bundlePtr) { + OSStatus err; + FSRef frameworksFolderRef; + CFURLRef baseURL; + CFURLRef bundleURL; + + if ( bundlePtr == nil ) return( -1 ); + + *bundlePtr = nil; + + baseURL = nil; + bundleURL = nil; + + err = FSFindFolder(kOnAppropriateDisk, kFrameworksFolderType, true, &frameworksFolderRef); + if (err == noErr) { + baseURL = CFURLCreateFromFSRef(kCFAllocatorSystemDefault, &frameworksFolderRef); + if (baseURL == nil) { + err = coreFoundationUnknownErr; + } } - } - if (err == noErr) { - bundleURL = CFURLCreateCopyAppendingPathComponent(kCFAllocatorSystemDefault, baseURL, framework, false); - if (bundleURL == nil) { - err = coreFoundationUnknownErr; + if (err == noErr) { + bundleURL = CFURLCreateCopyAppendingPathComponent(kCFAllocatorSystemDefault, baseURL, framework, false); + if (bundleURL == nil) { + err = coreFoundationUnknownErr; + } } - } - if (err == noErr) { - *bundlePtr = CFBundleCreate(kCFAllocatorSystemDefault, bundleURL); - if (*bundlePtr == nil) { - err = coreFoundationUnknownErr; + if (err == noErr) { + *bundlePtr = CFBundleCreate(kCFAllocatorSystemDefault, bundleURL); + if (*bundlePtr == nil) { + err = coreFoundationUnknownErr; + } } - } - if (err == noErr) { - if ( ! CFBundleLoadExecutable( *bundlePtr ) ) { - err = coreFoundationUnknownErr; + if (err == noErr) { + if ( ! CFBundleLoadExecutable( *bundlePtr ) ) { + err = coreFoundationUnknownErr; + } } + + // Clean up. + if (err != noErr && *bundlePtr != nil) { + CFRelease(*bundlePtr); + *bundlePtr = nil; + } + if (bundleURL != nil) { + CFRelease(bundleURL); + } + if (baseURL != nil) { + CFRelease(baseURL); + } + + return err; } - - // Clean up. - if (err != noErr && *bundlePtr != nil) { - CFRelease(*bundlePtr); - *bundlePtr = nil; - } - if (bundleURL != nil) { - CFRelease(bundleURL); - } - if (baseURL != nil) { - CFRelease(baseURL); - } - - return err; -} - - -class IdlePlatform::Private { -public: - EventLoopTimerRef mTimerRef; - int mSecondsIdle; - - Private() : mTimerRef(0), mSecondsIdle(0) {} - - static pascal void IdleTimerAction(EventLoopTimerRef, EventLoopIdleTimerMessage inState, void* inUserData); - -}; - - -pascal void IdlePlatform::Private::IdleTimerAction(EventLoopTimerRef, EventLoopIdleTimerMessage inState, void* inUserData) { - switch (inState) { - case kEventLoopIdleTimerStarted: - case kEventLoopIdleTimerStopped: - // Get invoked with this constant at the start of the idle period, - // or whenever user activity cancels the idle. - ((IdlePlatform::Private*)inUserData)->mSecondsIdle = 0; - break; - case kEventLoopIdleTimerIdling: - // Called every time the timer fires (i.e. every second). - ((IdlePlatform::Private*)inUserData)->mSecondsIdle++; - break; + + + class IdlePlatform::Private { + public: + EventLoopTimerRef mTimerRef; + int mSecondsIdle; + + Private() : mTimerRef(0), mSecondsIdle(0) {} + + static pascal void IdleTimerAction(EventLoopTimerRef, EventLoopIdleTimerMessage inState, void* inUserData); + + }; + + + pascal void IdlePlatform::Private::IdleTimerAction(EventLoopTimerRef, EventLoopIdleTimerMessage inState, void* inUserData) { + switch (inState) { + case kEventLoopIdleTimerStarted: + case kEventLoopIdleTimerStopped: + // Get invoked with this constant at the start of the idle period, + // or whenever user activity cancels the idle. + ((IdlePlatform::Private*)inUserData)->mSecondsIdle = 0; + break; + case kEventLoopIdleTimerIdling: + // Called every time the timer fires (i.e. every second). + ((IdlePlatform::Private*)inUserData)->mSecondsIdle++; + break; + } } -} - - -IdlePlatform::IdlePlatform() { - d = new Private(); -} - -IdlePlatform::~IdlePlatform() { - RemoveEventLoopTimer(d->mTimerRef); - delete d; -} - - -// Typedef for the function we're getting back from CFBundleGetFunctionPointerForName. -typedef OSStatus (*InstallEventLoopIdleTimerPtr)(EventLoopRef inEventLoop, - EventTimerInterval inFireDelay, - EventTimerInterval inInterval, - EventLoopIdleTimerUPP inTimerProc, - void * inTimerData, - EventLoopTimerRef * outTimer); - - -bool IdlePlatform::init() { - // May already be init'ed. - if (d->mTimerRef) { - return true; + + + IdlePlatform::IdlePlatform() { + d = new Private(); } - - // According to the docs, InstallEventLoopIdleTimer is new in 10.2. - // According to the headers, it has been around since 10.0. - // One of them is lying. We'll play it safe and weak-link the function. - - // Load the "Carbon.framework" bundle. - CFBundleRef carbonBundle; - if (LoadFrameworkBundle( CFSTR("Carbon.framework"), &carbonBundle ) != noErr) { - return false; + + IdlePlatform::~IdlePlatform() { + RemoveEventLoopTimer(d->mTimerRef); + delete d; } - - // Load the Mach-O function pointers for the routine we will be using. - InstallEventLoopIdleTimerPtr myInstallEventLoopIdleTimer = (InstallEventLoopIdleTimerPtr)CFBundleGetFunctionPointerForName(carbonBundle, CFSTR("InstallEventLoopIdleTimer")); - if (myInstallEventLoopIdleTimer == 0) { + + + // Typedef for the function we're getting back from CFBundleGetFunctionPointerForName. + typedef OSStatus (*InstallEventLoopIdleTimerPtr)(EventLoopRef inEventLoop, + EventTimerInterval inFireDelay, + EventTimerInterval inInterval, + EventLoopIdleTimerUPP inTimerProc, + void * inTimerData, + EventLoopTimerRef * outTimer); + + + bool IdlePlatform::init() { + // May already be init'ed. + if (d->mTimerRef) { + return true; + } + + // According to the docs, InstallEventLoopIdleTimer is new in 10.2. + // According to the headers, it has been around since 10.0. + // One of them is lying. We'll play it safe and weak-link the function. + + // Load the "Carbon.framework" bundle. + CFBundleRef carbonBundle; + if (LoadFrameworkBundle( CFSTR("Carbon.framework"), &carbonBundle ) != noErr) { + return false; + } + + // Load the Mach-O function pointers for the routine we will be using. + InstallEventLoopIdleTimerPtr myInstallEventLoopIdleTimer = (InstallEventLoopIdleTimerPtr)CFBundleGetFunctionPointerForName(carbonBundle, CFSTR("InstallEventLoopIdleTimer")); + if (myInstallEventLoopIdleTimer == 0) { + return false; + } + + EventLoopIdleTimerUPP timerUPP = NewEventLoopIdleTimerUPP(Private::IdleTimerAction); + if ((*myInstallEventLoopIdleTimer)(GetMainEventLoop(), kEventDurationSecond, kEventDurationSecond, timerUPP, 0, &d->mTimerRef)) { + return true; + } + return false; } - - EventLoopIdleTimerUPP timerUPP = NewEventLoopIdleTimerUPP(Private::IdleTimerAction); - if ((*myInstallEventLoopIdleTimer)(GetMainEventLoop(), kEventDurationSecond, kEventDurationSecond, timerUPP, 0, &d->mTimerRef)) { - return true; + + + int IdlePlatform::secondsIdle() { + return d->mSecondsIdle; } - - return false; -} - - -int IdlePlatform::secondsIdle() { - return d->mSecondsIdle; -} -#endif \ No newline at end of file +#endif diff --git a/src/modules/my/idle_win.cpp b/src/modules/my/idle_win.cpp index 0cc403990..58cd3f3f1 100644 --- a/src/modules/my/idle_win.cpp +++ b/src/modules/my/idle_win.cpp @@ -19,91 +19,91 @@ */ #ifdef COMPILE_ON_WINDOWS -#include"idle.h" - -#include -#include - -typedef struct tagLASTINPUTINFO { - UINT cbSize; - DWORD dwTime; -} LASTINPUTINFO, *PLASTINPUTINFO; - -class IdlePlatform::Private -{ -public: - Private() + #include "idle.h" + + #include + #include< windows.h> + + typedef struct tagLASTINPUTINFO { + UINT cbSize; + DWORD dwTime; + } LASTINPUTINFO, *PLASTINPUTINFO; + + class IdlePlatform::Private { - GetLastInputInfo = 0; - IdleUIGetLastInputTime = 0; - lib = 0; - } - - BOOL (__stdcall * GetLastInputInfo)(PLASTINPUTINFO); - DWORD (__stdcall * IdleUIGetLastInputTime)(void); - QLibrary *lib; -}; - -IdlePlatform::IdlePlatform() -{ - d = new Private; -} - -IdlePlatform::~IdlePlatform() -{ - delete d->lib; - delete d; -} - -bool IdlePlatform::init() -{ - if(d->lib) - return true; - void *p; - - // try to find the built-in Windows 2000 function - d->lib = new QLibrary("user32"); - if(d->lib->load() && (p = d->lib->resolve("GetLastInputInfo"))) { - d->GetLastInputInfo = (BOOL (__stdcall *)(PLASTINPUTINFO))p; - return true; + public: + Private() + { + GetLastInputInfo = 0; + IdleUIGetLastInputTime = 0; + lib = 0; + } + + BOOL (__stdcall * GetLastInputInfo)(PLASTINPUTINFO); + DWORD (__stdcall * IdleUIGetLastInputTime)(void); + QLibrary *lib; + }; + + IdlePlatform::IdlePlatform() + { + d = new Private; } - else { + + IdlePlatform::~IdlePlatform() + { delete d->lib; - d->lib = 0; - } - - // fall back on idleui - d->lib = new QLibrary("idleui"); - if(d->lib->load() && (p = d->lib->resolve("IdleUIGetLastInputTime"))) { - d->IdleUIGetLastInputTime = (DWORD (__stdcall *)(void))p; - return true; + delete d; } - else { - delete d->lib; - d->lib = 0; + + bool IdlePlatform::init() + { + if(d->lib) + return true; + void *p; + + // try to find the built-in Windows 2000 function + d->lib = new QLibrary("user32"); + if(d->lib->load() && (p = d->lib->resolve("GetLastInputInfo"))) { + d->GetLastInputInfo = (BOOL (__stdcall *)(PLASTINPUTINFO))p; + return true; + } + else { + delete d->lib; + d->lib = 0; + } + + // fall back on idleui + d->lib = new QLibrary("idleui"); + if(d->lib->load() && (p = d->lib->resolve("IdleUIGetLastInputTime"))) { + d->IdleUIGetLastInputTime = (DWORD (__stdcall *)(void))p; + return true; + } + else { + delete d->lib; + d->lib = 0; + } + + return false; } - - return false; -} - -int IdlePlatform::secondsIdle() -{ - int i; - if(d->GetLastInputInfo) { - LASTINPUTINFO li; - li.cbSize = sizeof(LASTINPUTINFO); - bool ok = d->GetLastInputInfo(&li); - if(!ok) + + int IdlePlatform::secondsIdle() + { + int i; + if(d->GetLastInputInfo) { + LASTINPUTINFO li; + li.cbSize = sizeof(LASTINPUTINFO); + bool ok = d->GetLastInputInfo(&li); + if(!ok) + return 0; + i = li.dwTime; + } + else if(d->IdleUIGetLastInputTime) { + i = d->IdleUIGetLastInputTime(); + } + else return 0; - i = li.dwTime; + + return (GetTickCount() - i) / 1000; } - else if(d->IdleUIGetLastInputTime) { - i = d->IdleUIGetLastInputTime(); - } - else - return 0; - - return (GetTickCount() - i) / 1000; -} #endif \ No newline at end of file diff --git a/src/modules/my/idle_x11.cpp b/src/modules/my/idle_x11.cpp index cd794f827..7b80f4377 100644 --- a/src/modules/my/idle_x11.cpp +++ b/src/modules/my/idle_x11.cpp @@ -23,91 +23,74 @@ #include"idle.h" #ifndef COMPILE_XSS_SUPPORT - -IdlePlatform::IdlePlatform() {} -IdlePlatform::~IdlePlatform() {} -bool IdlePlatform::init() { return false; } -int IdlePlatform::secondsIdle() { return 0; } - + IdlePlatform::IdlePlatform() {} + IdlePlatform::~IdlePlatform() {} + bool IdlePlatform::init() { return false; } + int IdlePlatform::secondsIdle() { return 0; } #else - -#include - -#include -#include -#include - -#ifdef COMPILE_USE_QT4 - #include -#endif - -static XErrorHandler old_handler = 0; -extern "C" int xerrhandler(Display* dpy, XErrorEvent* err) -{ - if(err->error_code == BadDrawable) - return 0; - - return (*old_handler)(dpy, err); -} - -class IdlePlatform::Private -{ -public: - Private() {} - - XScreenSaverInfo *ss_info; -}; - -IdlePlatform::IdlePlatform() -{ - d = new Private; - d->ss_info = 0; -} - -IdlePlatform::~IdlePlatform() -{ - if(d->ss_info) - XFree(d->ss_info); - if(old_handler) { - XSetErrorHandler(old_handler); - old_handler = 0; + #include + #include + #include + + #include + #include + #include + + static XErrorHandler old_handler = 0; + extern "C" int xerrhandler(Display* dpy, XErrorEvent* err) + { + if(err->error_code == BadDrawable) + return 0; + + return (*old_handler)(dpy, err); } - delete d; -} - -bool IdlePlatform::init() -{ - if(d->ss_info) - return true; - - old_handler = XSetErrorHandler(xerrhandler); - - int event_base, error_base; - if(XScreenSaverQueryExtension(QApplication::desktop()->screen()->x11Display(), &event_base, &error_base)) { - d->ss_info = XScreenSaverAllocInfo(); - return true; + + class IdlePlatform::Private + { + public: + Private() {} + + XScreenSaverInfo *ss_info; + }; + + IdlePlatform::IdlePlatform() + { + d = new Private; + d->ss_info = 0; + } + + IdlePlatform::~IdlePlatform() + { + if(d->ss_info) + XFree(d->ss_info); + if(old_handler) { + XSetErrorHandler(old_handler); + old_handler = 0; + } + delete d; + } + + bool IdlePlatform::init() + { + if(d->ss_info) + return true; + + old_handler = XSetErrorHandler(xerrhandler); + + int event_base, error_base; + if(XScreenSaverQueryExtension(QApplication::desktop()->screen()->x11Display(), &event_base, &error_base)) { + d->ss_info = XScreenSaverAllocInfo(); + return true; + } + return false; + } + + int IdlePlatform::secondsIdle() + { + if(!d->ss_info) return 0; + if(!XScreenSaverQueryInfo(QApplication::desktop()->screen()->x11Display(), QX11Info::appRootWindow(), d->ss_info)) return 0; + return d->ss_info->idle / 1000; } - return false; -} - -#ifdef COMPILE_USE_QT4 - #include -#endif - -int IdlePlatform::secondsIdle() -{ - if(!d->ss_info) - return 0; -#ifdef COMPILE_USE_QT4 - if(!XScreenSaverQueryInfo(QApplication::desktop()->screen()->x11Display(), QX11Info::appRootWindow(), d->ss_info)) -#else - if(!XScreenSaverQueryInfo(QApplication::desktop()->screen()->x11Display(), qt_xrootwin(), d->ss_info)) -#endif - return 0; - return d->ss_info->idle / 1000; -} - #endif - #endif #endif diff --git a/src/modules/my/libkvimy.cpp b/src/modules/my/libkvimy.cpp index 52b4c0a85..d029eceac 100644 --- a/src/modules/my/libkvimy.cpp +++ b/src/modules/my/libkvimy.cpp @@ -21,17 +21,17 @@ // #include "kvi_module.h" - #include "kvi_console.h" - #include "kvi_app.h" #include "kvi_locale.h" #include "kvi_ircconnection.h" #include "kvi_ircconnectionuserinfo.h" #include "kvi_ircconnectionserverinfo.h" #include "kvi_ircserver.h" + #include "idle.h" Idle* g_pIdle; + #define GET_KVS_CONSOLE \ kvs_uint_t uiWnd; \ KviConsole *wnd =0; \ @@ -416,7 +416,7 @@ static bool my_module_can_unload(KviModule *) KVIRC_MODULE( "My", // module name - "1.0.0", // module version + "4.0.0", // module version "Copyright (C) 2002 Szymon Stefanek (pragma at kvirc dot net)" \ " (C) 2005 Tonino Imbesi (grifisx at barmes dot net)" \ " (C) 2005 Alessandro Carbone (noldor at barmes dot net)", // author & (C) diff --git a/src/modules/notifier/libkvinotifier.cpp b/src/modules/notifier/libkvinotifier.cpp index e513f439f..7a14610ab 100644 --- a/src/modules/notifier/libkvinotifier.cpp +++ b/src/modules/notifier/libkvinotifier.cpp @@ -21,12 +21,10 @@ // //================================================================================== -#include "kvi_module.h" - - #include "notifierwindow.h" #include "notifiermessage.h" +#include "kvi_module.h" #include "kvi_kvs_variant.h" #include "kvi_app.h" #include "kvi_frame.h" @@ -36,7 +34,7 @@ #include "kvi_time.h" #include "kvi_options.h" -#include +#include KviNotifierWindow * g_pNotifierWindow = 0; kvi_time_t g_tNotifierDisabledUntil = 0; @@ -312,9 +310,9 @@ static bool notifier_module_ctrl(KviModule *,const char *operation,void *param) KVIRC_MODULE( "Notifier", - "2.0.0", + "4.0.0", "Copyright (C) 2005:\n" \ - " Iacopo Palazzi (iakko at siena dot linux dot it)", + " Iacopo Palazzi (iakko at siena dot linux dot it)", "KVIrc Client - Taskbar Notifier", notifier_module_init, notifier_module_can_unload, diff --git a/src/modules/notifier/notifiermessage.cpp b/src/modules/notifier/notifiermessage.cpp index cc7af2391..e9e1dd7d0 100644 --- a/src/modules/notifier/notifiermessage.cpp +++ b/src/modules/notifier/notifiermessage.cpp @@ -29,7 +29,6 @@ #include "kvi_config.h" #include "kvi_app.h" #include "kvi_window.h" - #include "kvi_locale.h" #include "kvi_frame.h" #include "kvi_mirccntrl.h" @@ -45,18 +44,14 @@ #endif */ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#define QPopupMenu Q3PopupMenu -#ifdef COMPILE_USE_QT4 - #define QPopupMenu Q3PopupMenu - #include -#else - #include -#endif extern kvi_time_t g_tNotifierDisabledUntil; @@ -104,4 +99,3 @@ void KviNotifierMessage::setHistoric() increase_transparency(tmp,out,2); m_pImage->convertFromImage(tmp); } - diff --git a/src/modules/notifier/notifiermessage.h b/src/modules/notifier/notifiermessage.h index c7b337315..645b6c062 100644 --- a/src/modules/notifier/notifiermessage.h +++ b/src/modules/notifier/notifiermessage.h @@ -27,34 +27,27 @@ #include "kvi_settings.h" - -#include -#include -#include -#include -#include -#include -#include -#include - #include "kvi_qstring.h" #include "kvi_pointerlist.h" #include "kvi_time.h" -#ifdef COMPILE_USE_QT4 - #define QSimpleRichText Q3SimpleRichText - #define QPopupMenu Q3PopupMenu - #include - #include -#else - #include -#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define QSimpleRichText Q3SimpleRichText +#define QPopupMenu Q3PopupMenu +class QPopupMenu; class KviWindow; class KviNotifierWindow; -class QPopupMenu; - class KviNotifierMessage { friend class KviNotifierWindow; diff --git a/src/modules/notifier/notifierwindow.cpp b/src/modules/notifier/notifierwindow.cpp index f997d018b..f177b8f98 100644 --- a/src/modules/notifier/notifierwindow.cpp +++ b/src/modules/notifier/notifierwindow.cpp @@ -23,46 +23,36 @@ //================================================================================== #include "kvi_settings.h" -#ifdef COMPILE_USE_QT4 - #define QPopupMenu Q3PopupMenu - #define QSimpleRichText Q3SimpleRichText - - #include - #include -#else - #include - #include -#endif - - #include - #include "notifiermessage.h" #include "notifierwindow.h" +#include "notifierwindowbody.h" +#include "notifierwindowborder.h" +#include "notifierwindowprogressbar.h" +#include "notifierwindowtabs.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 -#include -#include -#include -#include -#include -#include -#include - -#include "notifierwindowbody.h" -#include "notifierwindowborder.h" -#include "notifierwindowprogressbar.h" -#include "notifierwindowtabs.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define QPopupMenu Q3PopupMenu +#define QSimpleRichText Q3SimpleRichText extern KviNotifierWindow * g_pNotifierWindow; @@ -83,7 +73,6 @@ KviNotifierWindow::KviNotifierWindow() Qt::WStyle_StaysOnTop) #endif { - g_pNotifierWindow = this; m_eState = Hidden; @@ -127,11 +116,7 @@ KviNotifierWindow::KviNotifierWindow() 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); @@ -201,7 +186,8 @@ KviNotifierWindow::~KviNotifierWindow() delete m_pWndBody; } -int KviNotifierWindow::countTabs() { +int KviNotifierWindow::countTabs() +{ return m_pWndTabs->count(); } @@ -215,7 +201,6 @@ void KviNotifierWindow::reloadImages() m_pWndBorder->resize(m_pixBackground.size()); } - void KviNotifierWindow::addMessage(KviWindow * pWnd,const QString &szImageId,const QString &szText,unsigned int uMessageTime) { QPixmap * pIcon; @@ -256,9 +241,10 @@ void KviNotifierWindow::addMessage(KviWindow * pWnd,const QString &szImageId,con } -int KviNotifierWindow::textWidth() { +int KviNotifierWindow::textWidth() +{ return m_pWndBody->textRect().width() - 20; -}; +} void KviNotifierWindow::stopShowHideTimer() { @@ -344,14 +330,14 @@ void KviNotifierWindow::doShow(bool bDoAnimate) m_dOpacity = OPACITY_STEP; m_eState = Showing; m_bCrashShowWorkAround=true; - #if defined(COMPILE_USE_QT4) && (defined(COMPILE_ON_WINDOWS) || defined(Q_OS_MACX)) + #if (defined(COMPILE_ON_WINDOWS) || defined(Q_OS_MACX)) setWindowOpacity(m_dOpacity); - #endif + #endif show(); - #if defined(COMPILE_USE_QT4) && (defined(COMPILE_ON_WINDOWS) || defined(Q_OS_MACX)) - m_pShowHideTimer->start(40); + #if (defined(COMPILE_ON_WINDOWS) || defined(Q_OS_MACX)) + m_pShowHideTimer->start(40); #else - m_pShowHideTimer->start(100); + m_pShowHideTimer->start(100); #endif computeRect(); m_bCrashShowWorkAround=false; @@ -377,9 +363,7 @@ bool KviNotifierWindow::shouldHideIfMainWindowGotAttention() return t->window()->hasAttention(); } - void KviNotifierWindow::heartbeat() - { bool bIncreasing; double targetOpacity = 0; //qt4 @@ -401,18 +385,12 @@ void KviNotifierWindow::heartbeat() 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(); @@ -421,14 +399,13 @@ void KviNotifierWindow::heartbeat() 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); + #if (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; @@ -463,10 +440,9 @@ void KviNotifierWindow::heartbeat() setWindowOpacity(m_dOpacity); break; -#endif case Hiding: m_dOpacity -= OPACITY_STEP; - #if defined(COMPILE_USE_QT4) && (defined(COMPILE_ON_WINDOWS) || defined(Q_OS_MACX)) + #if (defined(COMPILE_ON_WINDOWS) || defined(Q_OS_MACX)) setWindowOpacity(m_dOpacity); #endif if(m_pLineEdit->isVisible())m_pLineEdit->hide(); @@ -530,16 +506,14 @@ void KviNotifierWindow::doHide(bool bDoAnimate) 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); + #if (defined(COMPILE_ON_WINDOWS) || defined(Q_OS_MACX)) + setWindowOpacity(m_dOpacity); + update(); + m_pShowHideTimer->start(40); #else - update(); - m_pShowHideTimer->start(100); + update(); + m_pShowHideTimer->start(100); #endif - - } break; } @@ -549,7 +523,6 @@ void KviNotifierWindow::showEvent(QShowEvent *e) { computeRect(); setGeometry(m_wndRect); // w_win = w_wndRect - } void KviNotifierWindow::hideEvent(QHideEvent * e) @@ -568,7 +541,6 @@ void KviNotifierWindow::startBlinking() { stopBlinkTimer(); m_bBlinkOn = false; - if(!KVI_OPTION_BOOL(KviOption_boolDisableNotifierFlashing)) { @@ -623,7 +595,7 @@ void KviNotifierWindow::blink() return; } } - update(); + update(); } void KviNotifierWindow::markAllMessagesAsHistoric() @@ -632,7 +604,6 @@ void KviNotifierWindow::markAllMessagesAsHistoric() m_pWndTabs->markAllMessagesAsHistoric(); } - static void blend_images(QImage &buffer,QImage &background,QImage &foreground,double dValue) { for(int y = 0;y < buffer.height();y++) @@ -676,7 +647,7 @@ void KviNotifierWindow::paintEvent(QPaintEvent * e) { QPainter px(this); - #if defined(COMPILE_USE_QT4) && (defined(COMPILE_ON_WINDOWS) || defined(Q_OS_MACX)) + #if (defined(COMPILE_ON_WINDOWS) || defined(Q_OS_MACX)) px.drawPixmap(0,0,m_pixForeground); #else QImage temp_image = m_pixForeground.convertToImage(); @@ -685,12 +656,8 @@ void KviNotifierWindow::paintEvent(QPaintEvent * e) #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 } } @@ -778,7 +745,6 @@ void KviNotifierWindow::redrawText() void KviNotifierWindow::mouseMoveEvent(QMouseEvent * e) { - //debug ("move on x,y: %d,%d", e->pos().x(), e->pos().y()); if (!m_bLeftButtonIsPressed) { @@ -816,8 +782,7 @@ void KviNotifierWindow::mouseMoveEvent(QMouseEvent * e) /* ### END ### */ sartelo: - - update(); + update(); } @@ -844,7 +809,6 @@ sartelo: void KviNotifierWindow::mousePressEvent(QMouseEvent * e) { - // stop blinking first of all :) bool bWasBlinkOn = m_bBlinkOn; m_bBlinkOn = false; @@ -1008,9 +972,7 @@ void KviNotifierWindow::keyPressEvent(QKeyEvent * e) void KviNotifierWindow::keyReleaseEvent(QKeyEvent * e) { - if (e->key()==Qt::Key_Shift) { - m_bKeyShiftPressed = false; - } + if (e->key()==Qt::Key_Shift) m_bKeyShiftPressed = false; } void KviNotifierWindow::delayedRaise(KviWindow * pWnd) @@ -1107,9 +1069,7 @@ bool KviNotifierWindow::checkResizing(QPoint e) } } return m_bResizing; -}; - - +} void KviNotifierWindow::resize(QPoint p, bool up) { @@ -1190,7 +1150,8 @@ void KviNotifierWindow::redrawWindow() } -inline void KviNotifierWindow::setCursor(int cur) { +inline void KviNotifierWindow::setCursor(int cur) +{ if (m_cursor.shape() != cur) { if(QApplication::overrideCursor()) QApplication::restoreOverrideCursor(); m_cursor.setShape((Qt::CursorShape)cur); @@ -1201,14 +1162,12 @@ inline void KviNotifierWindow::setCursor(int cur) { 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) @@ -1216,16 +1175,13 @@ 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_bResizing) setCursor(-1); 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) @@ -1322,7 +1278,6 @@ void KviNotifierWindow::wheelEvent(QWheelEvent * e) else nextButtonClicked(); } - void KviNotifierWindow::prevButtonClicked() { KviNotifierWindowTab * tab = m_pWndTabs->currentTab(); @@ -1423,7 +1378,7 @@ void KviNotifierWindow::progressUpdate() QPainter p(this); m_pProgressBar->draw(&p); } + #ifndef COMPILE_USE_STANDALONE_MOC_SOURCES #include "m_notifierwindow.moc" #endif //!COMPILE_USE_STANDALONE_MOC_SOURCES - diff --git a/src/modules/notifier/notifierwindow.h b/src/modules/notifier/notifierwindow.h index 27480e25b..0887b2a0b 100644 --- a/src/modules/notifier/notifierwindow.h +++ b/src/modules/notifier/notifierwindow.h @@ -24,36 +24,34 @@ // //================================================================================== -#include "kvi_settings.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "notifiersettings.h" +#include "kvi_settings.h" #include "kvi_qstring.h" #include "kvi_pointerlist.h" #include "kvi_time.h" -#include "notifiersettings.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +class QPainter; +class QPopupMenu; class KviWindow; class KviNotifierMessage; - class KviNotifierWindowBody; class KviNotifierWindowBorder; class KviNotifierWindowProgressBar; class KviNotifierWindowTabs; -class QPainter; -class QPopupMenu; extern kvi_time_t g_tNotifierDisabledUntil; diff --git a/src/modules/notifier/notifierwindowbody.cpp b/src/modules/notifier/notifierwindowbody.cpp index a85ea0ac4..d6353fdfc 100644 --- a/src/modules/notifier/notifierwindowbody.cpp +++ b/src/modules/notifier/notifierwindowbody.cpp @@ -26,9 +26,9 @@ #include "kvi_iconmanager.h" -#include -#include -#include +#include +#include +#include /* #ifdef QT3_SUPPORT @@ -52,7 +52,6 @@ KviNotifierWindowBody::~KviNotifierWindowBody() { } - void KviNotifierWindowBody::loadImages() { QPixmap * p; @@ -158,10 +157,10 @@ void KviNotifierWindowBody::setPrevIcon(int state) m_prevIconState=state; needToRedraw(); } -}; - -void KviNotifierWindowBody::setNextIcon(int state) { +} +void KviNotifierWindowBody::setNextIcon(int state) +{ //if (m_nextIconState==WDG_ICON_OFF && state!=WDG_ICON_OFF) if (m_nextIconState!=state) { switch (state) { @@ -173,10 +172,10 @@ void KviNotifierWindowBody::setNextIcon(int state) { needToRedraw(); m_nextIconState=state; } -}; - -void KviNotifierWindowBody::setWriteIcon(int state) { +} +void KviNotifierWindowBody::setWriteIcon(int state) +{ //if (m_writeIconState==WDG_ICON_OFF && state!=WDG_ICON_OFF) if (m_writeIconState!=state) { switch (state) { @@ -187,10 +186,10 @@ void KviNotifierWindowBody::setWriteIcon(int state) { needToRedraw(); m_writeIconState=state; } -}; +} -void KviNotifierWindowBody::draw(QPainter * p) { - +void KviNotifierWindowBody::draw(QPainter * p) +{ if (m_bNeedToRedraw) { p->fillRect(QRect(m_pnt,m_rct.size()),m_mac_bkgColor); @@ -215,18 +214,20 @@ void KviNotifierWindowBody::draw(QPainter * p) { p->drawPixmap(m_rctWriteIcon.x(), m_rctWriteIcon.y(), m_pixIconWrite); m_bNeedToRedraw = false; - } } -void KviNotifierWindowBody::mouseMoveEvent(QMouseEvent * e) { +void KviNotifierWindowBody::mouseMoveEvent(QMouseEvent * e) +{ } -void KviNotifierWindowBody::mousePressEvent(QMouseEvent * e) { +void KviNotifierWindowBody::mousePressEvent(QMouseEvent * e) +{ } -void KviNotifierWindowBody::mouseReleaseEvent(QMouseEvent * e) { +void KviNotifierWindowBody::mouseReleaseEvent(QMouseEvent * e) +{ } diff --git a/src/modules/notifier/notifierwindowbody.h b/src/modules/notifier/notifierwindowbody.h index d2a661c8d..083e17fc8 100644 --- a/src/modules/notifier/notifierwindowbody.h +++ b/src/modules/notifier/notifierwindowbody.h @@ -24,20 +24,22 @@ // //============================================================================= -#include -#include -#include -#include - #include "notifiersettings.h" +#include +#include +#include +#include +#include + +class QPainter; + /* #ifdef QT3_SUPPORT #define QPainter Q3Painter #endif */ -class QPainter; class KviNotifierWindowBody { @@ -137,8 +139,6 @@ public: void mouseMoveEvent(QMouseEvent * e); void mousePressEvent(QMouseEvent * e); void mouseReleaseEvent(QMouseEvent * e); - - protected: diff --git a/src/modules/notifier/notifierwindowborder.cpp b/src/modules/notifier/notifierwindowborder.cpp index 89361654a..85dce649c 100644 --- a/src/modules/notifier/notifierwindowborder.cpp +++ b/src/modules/notifier/notifierwindowborder.cpp @@ -24,9 +24,10 @@ #include "notifierwindowborder.h" #include "notifierwindowtabs.h" + #include "kvi_iconmanager.h" -#include +#include KviNotifierWindowBorder::KviNotifierWindowBorder(QSize s) { @@ -38,8 +39,8 @@ KviNotifierWindowBorder::~KviNotifierWindowBorder() { } -void KviNotifierWindowBorder::loadImages() { - +void KviNotifierWindowBorder::loadImages() +{ // Normal Border QPixmap * p; @@ -139,12 +140,14 @@ void KviNotifierWindowBorder::setPics(bool b) } } -void KviNotifierWindowBorder::setWidth(int w) { +void KviNotifierWindowBorder::setWidth(int w) +{ m_iRctWidth = w; recalculatePositions(); } -void KviNotifierWindowBorder::setHeight(int h) { +void KviNotifierWindowBorder::setHeight(int h) +{ m_iRctHeight = h; recalculatePositions(); } @@ -178,7 +181,8 @@ void KviNotifierWindowBorder::recalculatePositions() m_bNeedToRedraw = true; } -void KviNotifierWindowBorder::setCloseIcon(int state) { +void KviNotifierWindowBorder::setCloseIcon(int state) +{ m_bNeedToRedraw = true; m_eIconState = state; switch (m_eIconState) { case WDG_ICON_OUT: m_pixIconClose = m_pixIconClose_out; break; @@ -187,12 +191,13 @@ void KviNotifierWindowBorder::setCloseIcon(int state) { }; } -void KviNotifierWindowBorder::resetIcons() { +void KviNotifierWindowBorder::resetIcons() +{ setCloseIcon(WDG_ICON_OUT); } -void KviNotifierWindowBorder::draw(QPainter * p, bool b) { - +void KviNotifierWindowBorder::draw(QPainter * p, bool b) +{ if (m_bNeedToRedraw) { setPics(b); setCloseIcon(m_eIconState); @@ -216,5 +221,4 @@ void KviNotifierWindowBorder::draw(QPainter * p, bool b) { m_bNeedToRedraw = false; } - } diff --git a/src/modules/notifier/notifierwindowborder.h b/src/modules/notifier/notifierwindowborder.h index d205bed8c..2653f3f06 100644 --- a/src/modules/notifier/notifierwindowborder.h +++ b/src/modules/notifier/notifierwindowborder.h @@ -26,9 +26,9 @@ #include "notifiersettings.h" -#include -#include -#include +#include +#include +#include class QPainter; diff --git a/src/modules/notifier/notifierwindowprogressbar.h b/src/modules/notifier/notifierwindowprogressbar.h index 674f204cc..55444184a 100644 --- a/src/modules/notifier/notifierwindowprogressbar.h +++ b/src/modules/notifier/notifierwindowprogressbar.h @@ -24,8 +24,8 @@ // //============================================================================= -#include -#include +#include +#include class KviNotifierWindowProgressBar { @@ -60,8 +60,6 @@ public: void draw(QPainter *); protected: - - }; #endif //!_NOTIFIERWINDOWPROGRESSBAR_H_ diff --git a/src/modules/notifier/notifierwindowtabs.cpp b/src/modules/notifier/notifierwindowtabs.cpp index 4ef9b45c9..7a0f78b69 100644 --- a/src/modules/notifier/notifierwindowtabs.cpp +++ b/src/modules/notifier/notifierwindowtabs.cpp @@ -22,6 +22,9 @@ // //============================================================================= +#include "notifiermessage.h" +#include "notifierwindowtabs.h" + #include "kvi_app.h" #include "kvi_config.h" #include "kvi_qstring.h" @@ -30,14 +33,12 @@ #include "kvi_options.h" #include "kvi_window.h" -#include -#include -#include -#include -#include - -#include "notifiermessage.h" -#include "notifierwindowtabs.h" +#include +#include +#include +#include +#include +#include extern KviNotifierWindow * g_pNotifierWindow; KviNotifierWindowTabs * g_pTabs; @@ -171,9 +172,9 @@ int KviNotifierWindowTab::width(bool b) { return width; } -// ##################################################################################à +// ################################################################################# // ### end of tab object definition class -// ##################################################################################à +// ################################################################################# KviNotifierWindowTabs::KviNotifierWindowTabs(QRect r) @@ -274,8 +275,6 @@ void KviNotifierWindowTabs::loadImages() } - - void KviNotifierWindowTabs::addMessage(KviWindow * pWnd, KviNotifierMessage * message) { QString sender = pWnd ? pWnd->windowName() : "----"; @@ -411,7 +410,8 @@ void KviNotifierWindowTabs::next() } -void KviNotifierWindowTabs::mousePressEvent(QMouseEvent * e) { +void KviNotifierWindowTabs::mousePressEvent(QMouseEvent * e) +{ if (m_bIsOverRightBound && m_rctNextIcon.contains(e->pos())) { return; @@ -452,7 +452,6 @@ void KviNotifierWindowTabs::mouseMoveEvent(QMouseEvent * e) void KviNotifierWindowTabs::mouseReleaseEvent(QMouseEvent * e) { - if (m_bIsOverRightBound && m_rctNextIcon.contains(e->pos())) { scrollTabsLeft(); return; @@ -474,21 +473,23 @@ void KviNotifierWindowTabs::mouseReleaseEvent(QMouseEvent * e) } -void KviNotifierWindowTabs::scrollTabsLeft() { +void KviNotifierWindowTabs::scrollTabsLeft() +{ if (m_bIsOverRightBound) { m_iTabToStartFrom++; } needToRedraw(); g_pNotifierWindow->update(); -}; +} -void KviNotifierWindowTabs::scrollTabsRight() { +void KviNotifierWindowTabs::scrollTabsRight() +{ if (m_bIsOverLeftBound) { m_iTabToStartFrom--; } needToRedraw(); g_pNotifierWindow->update(); -}; +} void KviNotifierWindowTabs::setCloseTabIcon(int state) { @@ -510,7 +511,7 @@ void KviNotifierWindowTabs::resetIcons() } void KviNotifierWindowTabs::setFocusOn(KviNotifierWindowTab * tab) -{ +{ if(m_pTabFocused)m_pTabFocused->setFocused(false); m_pTabFocused = tab; if(m_pTabFocused)m_pTabFocused->setFocused(); @@ -628,7 +629,6 @@ void KviNotifierWindowTabs::draw(QPainter * p) p->drawPixmap(m_rct.x(), m_rct.y(), *m_pPixmap, 0, 0, m_pPixmap->width(), m_pPixmap->height()); m_bNeedToRedraw = false; - } void KviNotifierWindowTabs::markAllMessagesAsHistoric() @@ -705,4 +705,3 @@ void KviNotifierWindowTabs::closeTab(KviWindow * pWnd, KviNotifierWindowTab * pT #ifndef COMPILE_USE_STANDALONE_MOC_SOURCES #include "m_notifierwindowtabs.moc" #endif //!COMPILE_USE_STANDALONE_MOC_SOURCES - diff --git a/src/modules/notifier/notifierwindowtabs.h b/src/modules/notifier/notifierwindowtabs.h index cc22f9589..38064c9a6 100644 --- a/src/modules/notifier/notifierwindowtabs.h +++ b/src/modules/notifier/notifierwindowtabs.h @@ -24,19 +24,19 @@ // //============================================================================= -#include -#include -#include -#include -#include -#include -#include "kvi_settings.h" -#include "kvi_pointerlist.h" +#include "notifiermessage.h" #include "notifiersettings.h" #include "notifierwindow.h" -#include "notifiermessage.h" +#include "kvi_settings.h" +#include "kvi_pointerlist.h" +#include +#include +#include +#include +#include +#include class QPainter; class KviWindow; diff --git a/src/modules/objects/libkviobjects.cpp b/src/modules/objects/libkviobjects.cpp index a0347db92..29fe60724 100644 --- a/src/modules/objects/libkviobjects.cpp +++ b/src/modules/objects/libkviobjects.cpp @@ -22,26 +22,6 @@ // //============================================================================= -#include "kvi_tal_listview.h" -#include -#include "kvi_iconmanager.h" -#include "kvi_window.h" -#include "kvi_out.h" -#include "kvi_mirccntrl.h" - -#include "kvi_app.h" - -#include "kvi_module.h" - -#include "kvi_locale.h" -#include "kvi_error.h" -#include "kvi_cmdformatter.h" -#include "kvi_out.h" -#include "kvi_app.h" -#include "kvi_fileutils.h" - -#include - #include "class_button.h" #include "class_checkbox.h" #include "class_urllabel.h" @@ -82,6 +62,25 @@ #include "class_dockwindow.h" #include "class_vbox.h" #include "class_hbox.h" + +#include "kvi_iconmanager.h" +#include "kvi_window.h" +#include "kvi_out.h" +#include "kvi_mirccntrl.h" +#include "kvi_app.h" +#include "kvi_module.h" +#include "kvi_locale.h" +#include "kvi_error.h" +#include "kvi_cmdformatter.h" +#include "kvi_out.h" +#include "kvi_app.h" +#include "kvi_fileutils.h" +#include "kvi_tal_listview.h" + +#include +#include + + static void dumpChildObjects(KviWindow *pWnd, QObject *parent, const char *spacing, bool bWidgetsOnly, KviKvsArray *n, int &idx); static bool objects_module_cleanup(KviModule *m) @@ -131,9 +130,8 @@ static bool objects_module_cleanup(KviModule *m) return true; } - static bool objects_kvs_cmd_killClass(KviKvsModuleCommandCall * c) -{ +{ /* @doc: objects.killclass @title: @@ -178,9 +176,8 @@ static bool objects_kvs_cmd_killClass(KviKvsModuleCommandCall * c) return true; } - static bool objects_kvs_cmd_clearObjects(KviKvsModuleCommandCall * c) -{ +{ /* @doc: objects.clear @title: @@ -209,9 +206,8 @@ static bool objects_kvs_cmd_clearObjects(KviKvsModuleCommandCall * c) return true; } - static bool objects_kvs_cmd_connect(KviKvsModuleCommandCall * c) -{ +{ /* @doc: objects.connect @@ -262,9 +258,8 @@ static bool objects_kvs_cmd_connect(KviKvsModuleCommandCall * c) return true; } - static bool objects_kvs_fnc_exists(KviKvsModuleFunctionCall * c) -{ +{ /* @doc: objects.exists @title: @@ -292,7 +287,7 @@ static bool objects_kvs_fnc_exists(KviKvsModuleFunctionCall * c) } static bool objects_kvs_fnc_instances(KviKvsModuleFunctionCall * c) -{ +{ /* @doc: objects.instances @title: @@ -373,21 +368,22 @@ static bool objects_kvs_fnc_instances(KviKvsModuleFunctionCall * c) } return true; } + /* - @doc: objects.variables - @title: - objects.variables - @type: - command - @short: - List object's variables. - @syntax: - objects.variables() - @description: - Returns an hash with the object's variables(useful only for debugging). - @seealso: - [doc:objects]objects documentation[/doc] - */ + @doc: objects.variables + @title: + objects.variables + @type: + command + @short: + List object's variables. + @syntax: + objects.variables() + @description: + Returns an hash with the object's variables(useful only for debugging). + @seealso: + [doc:objects]objects documentation[/doc] +*/ static bool objects_kvs_fnc_variables(KviKvsModuleFunctionCall * c) { kvs_hobject_t hObj; @@ -414,20 +410,21 @@ static bool objects_kvs_fnc_variables(KviKvsModuleFunctionCall * c) } /* - @doc: objects.classAllHandlers - @title: - objects.classAllHandlers - @type: - function - @short: - List all the functions . - @syntax: - objects.classAllHandlers() - @description: - Returns an hash with the class's functions(useful only for debugging). - @seealso: - [doc:objects]objects documentation[/doc] - */ + @doc: objects.classAllHandlers + @title: + objects.classAllHandlers + @type: + function + @short: + List all the functions . + @syntax: + objects.classAllHandlers() + @description: + Returns an hash with the class's functions(useful only for debugging). + @seealso: + [doc:objects]objects documentation[/doc] +*/ + static bool objects_kvs_fnc_classAllHandlers(KviKvsModuleFunctionCall * c) { QString szClassName; @@ -455,8 +452,9 @@ static bool objects_kvs_fnc_classAllHandlers(KviKvsModuleFunctionCall * c) return true; } + static bool objects_kvs_fnc_classes(KviKvsModuleFunctionCall * c) -{ +{ /* @doc: objects.classes @@ -635,17 +633,13 @@ static bool objects_kvs_cmd_bitBlt(KviKvsModuleCommandCall * c) ((KviKvsObject_pixmap *)obDst)->pixmapChanged(); } - //FIX ME -#ifdef COMPILE_USE_QT4 - /*QPainter p(pdDest); + /*FIXME + QPainter p(pdDest); QRect rectdest(iXdst,iYdst,uW,uH); QRect rectsrc(iXsrc,iYsrc,uW,uH); p.drawPixmap(rectdest,pdSource,rectsrc); -*/ - #else - bitBlt(pdDest,iXdst,iYdst,pdSource,iXsrc,iYsrc,uW,uH); -#endif + */ return true; } /* @@ -670,7 +664,6 @@ static bool objects_kvs_cmd_bitBlt(KviKvsModuleCommandCall * c) static bool objects_kvs_cmd_blend(KviKvsModuleCommandCall * c) { - KviKvsObject *obFor; KviKvsObject *obBck; KviKvsObject *obDest; @@ -784,34 +777,34 @@ static bool objects_kvs_cmd_blend(KviKvsModuleCommandCall * c) } -// ASSASSINI! LA DOVETE INDENTARE PER BENE :D +// ASSASSINS! YOU MUST INDENT IT WELL :D static bool objects_kvs_fnc_listObjects(KviKvsModuleFunctionCall * cmd) -{ +{ /* - @doc: objects.dump - @type: - function - @title: + @doc: objects.dump + @type: + function + @title: $objects.dump - @keyterms: - dump objects - @short: - Dump the kvirc widgets. - @syntax: - $objects.dump() - @description: - This function returns the tree of the widgets of the kvirc, if the flag is planned to 1,[br] - will return it on the currente window, if it' is planned to 0 instead it will return it as a string.[br] - ES: - %A[]=$str.split("\|",$objects.dump(0)) - %i=0 - while (%i != %A[]#) - { - echo %A[%i] - %i++ - } + @keyterms: + dump objects + @short: + Dump the kvirc widgets. + @syntax: + $objects.dump() + @description: + This function returns the tree of the widgets of the kvirc, if the flag is planned to 1,[br] + will return it on the currente window, if it' is planned to 0 instead it will return it as a string.[br] + ES: + %A[]=$str.split("\|",$objects.dump(0)) + %i=0 + while (%i != %A[]#) + { + echo %A[%i] + %i++ + } */ @@ -899,6 +892,7 @@ static bool objects_module_can_unload(KviModule *m) // FIXME: unlock when no more instances & derived classes! return false; } + static bool objects_module_init(KviModule * m) { // functions @@ -970,7 +964,7 @@ static bool objects_module_init(KviModule * m) KVIRC_MODULE( "Objects", - "2.0.0", + "4.0.0", "Copyright (C) 2000-2006:\n" \ " Szymon Stefanek (pragma at kvirc dot net)\n" \ " Krzysztof Godlewski (kristoff at poczta dot wprost dot pl)\n" \ diff --git a/src/modules/perl/libkviperl.cpp b/src/modules/perl/libkviperl.cpp index e9b122975..1f9e51ff0 100644 --- a/src/modules/perl/libkviperl.cpp +++ b/src/modules/perl/libkviperl.cpp @@ -24,7 +24,6 @@ #include "kvi_settings.h" #include "kvi_module.h" - #include "kvi_fileutils.h" #include "kvi_locale.h" #include "kvi_app.h" @@ -442,7 +441,6 @@ static bool perl_kvs_cmd_begin(KviKvsModuleCommandCall * c) KVS_CHECK_MODULE_STATE(m,c) #ifdef COMPILE_PERL_SUPPORT - KviPerlCoreCtrlCommand_execute ex; ex.uSize = sizeof(KviPerlCoreCtrlCommand_execute); ex.pKvsContext = c->context(); @@ -590,7 +588,7 @@ static bool perl_module_cleanup(KviModule *m) KVIRC_MODULE( "Perl", // module name - "1.0.0", // module version + "4.0.0", // module version "Copyright (C) 2004 Szymon Stefanek (pragma at kvirc dot net)", // author & (C) "Perl scripting engine", perl_module_init, diff --git a/src/modules/perlcore/libkviperlcore.cpp b/src/modules/perlcore/libkviperlcore.cpp index d58ca19c8..8bf0cf610 100644 --- a/src/modules/perlcore/libkviperlcore.cpp +++ b/src/modules/perlcore/libkviperlcore.cpp @@ -28,7 +28,6 @@ #include "kvi_out.h" #include "kvi_window.h" #include "kvi_app.h" - #include "kvi_kvs_script.h" #include "kvi_kvs_variant.h" #include "kvi_userinput.h" @@ -404,7 +403,7 @@ static bool perlcore_module_can_unload(KviModule *m) KVIRC_MODULE( "Perl", // module name - "1.0.0", // module version + "4.0.0", // module version "Copyright (C) 2004 Szymon Stefanek (pragma at kvirc dot net)", // author & (C) "Perl scripting engine core", perlcore_module_init, diff --git a/src/modules/perlcore/perlcoreinterface.h b/src/modules/perlcore/perlcoreinterface.h index b44994e5d..45b58eb2b 100644 --- a/src/modules/perlcore/perlcoreinterface.h +++ b/src/modules/perlcore/perlcoreinterface.h @@ -29,7 +29,7 @@ #include "kvi_qstring.h" #include "kvi_kvs_runtimecontext.h" -#include +#include #define KVI_PERLCORECTRLCOMMAND_EXECUTE "execute" diff --git a/src/modules/popupeditor/libkvipopupeditor.cpp b/src/modules/popupeditor/libkvipopupeditor.cpp index 2659bf74d..7c67499ea 100644 --- a/src/modules/popupeditor/libkvipopupeditor.cpp +++ b/src/modules/popupeditor/libkvipopupeditor.cpp @@ -20,13 +20,12 @@ // Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // -#include "kvi_module.h" +#include "popupeditor.h" +#include "kvi_module.h" #include "kvi_locale.h" - #include "kvi_frame.h" -#include "popupeditor.h" KviPopupEditorWindow * g_pPopupEditorWindow = 0; @@ -46,7 +45,7 @@ KviPopupEditorWindow * g_pPopupEditorWindow = 0; */ static bool popupeditor_kvs_cmd_open(KviKvsModuleCommandCall * c) -{ +{ if(!g_pPopupEditorWindow) { g_pPopupEditorWindow = new KviPopupEditorWindow(c->window()->frame()); @@ -72,13 +71,13 @@ static bool popupeditor_module_can_unload(KviModule * m) static bool popupeditor_module_cleanup(KviModule *m) { if(g_pPopupEditorWindow)delete g_pPopupEditorWindow; - g_pPopupEditorWindow = 0; + g_pPopupEditorWindow = 0; return true; } KVIRC_MODULE( "PopupEditor", // module name - "1.0.0", // module version + "4.0.0", // module version "Copyright (C) 2002 Szymon Stefanek (pragma at kvirc dot net)", // author & (C) "Editor for the script popups", popupeditor_module_init, diff --git a/src/modules/popupeditor/popupeditor.cpp b/src/modules/popupeditor/popupeditor.cpp index 9ebbb7e67..8b648a513 100644 --- a/src/modules/popupeditor/popupeditor.cpp +++ b/src/modules/popupeditor/popupeditor.cpp @@ -39,17 +39,18 @@ #include "kvi_kvs_popupmenu.h" #include "kvi_kvs_variantlist.h" //#include "kvi_parameterlist.h" - -#include -#include -#include -#include -#include -#include #include "kvi_pointerhashtable.h" -#include #include "kvi_tal_vbox.h" +#include +#include +#include +#include +#include +#include +#include + + extern KviPopupEditorWindow * g_pPopupEditorWindow; @@ -174,16 +175,6 @@ void KviPopupListViewItem::setIcon(const QString & szIcon) } - - - - - - - - - - KviSinglePopupEditor::KviSinglePopupEditor(QWidget * par) : QWidget(par) { @@ -202,12 +193,8 @@ KviSinglePopupEditor::KviSinglePopupEditor(QWidget * par) m_pMenuButton = new QPushButton(__tr2qs("Test"),this); g->addWidget(m_pMenuButton,0,2); connect(m_pMenuButton,SIGNAL(clicked()),this,SLOT(testPopup())); -#ifdef COMPILE_USE_QT4 QSplitter * spl = new QSplitter(Qt::Vertical,this,"popupeditor"); spl->setOpaqueResize(false); -#else - QSplitter * spl = new QSplitter(QSplitter::Vertical,this); -#endif m_pListView = new KviTalListView(spl); m_pListView->addColumn(__tr2qs("Item")); @@ -217,8 +204,6 @@ KviSinglePopupEditor::KviSinglePopupEditor(QWidget * par) m_pListView->setRootIsDecorated(true); m_pListView->setShowSortIndicator(false); m_pListView->setSorting(-1); - - connect(m_pListView,SIGNAL(selectionChanged(KviTalListViewItem *)),this,SLOT(selectionChanged(KviTalListViewItem *))); connect(m_pListView,SIGNAL(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)), this,SLOT(itemPressed(KviTalListViewItem *,const QPoint &,int))); @@ -272,11 +257,8 @@ KviSinglePopupEditor::KviSinglePopupEditor(QWidget * par) QToolTip::add(m_pIdEditor, __tr2qs("
Item id
This will allow you to use delpopupitem later.
")); g->addMultiCellWidget(m_pIdEditor,6,6,1,2); - - g->setColStretch(1,1); g->setRowStretch(1,1); - } KviSinglePopupEditor::~KviSinglePopupEditor() @@ -369,7 +351,6 @@ void KviSinglePopupEditor::testModeMenuItemClicked(KviKvsPopupMenuItem * it) } - void KviSinglePopupEditor::itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col) { m_pContextPopup->clear(); @@ -649,7 +630,6 @@ void KviSinglePopupEditor::contextCut() if(!m_pLastSelectedItem)selectionChanged(0); } - void KviSinglePopupEditor::contextPasteBelow() { if(!m_pClipboard)return; @@ -949,8 +929,6 @@ void KviSinglePopupEditor::populateMenu(KviKvsPopupMenu * pop,KviPopupListViewIt } } - - void KviSinglePopupEditor::edit(KviMenuListViewItem * it) { saveLastSelectedItem(); @@ -989,21 +967,6 @@ void KviSinglePopupEditor::edit(KviMenuListViewItem * it) } - - - - - - - - - - - - - - - KviMenuListViewItem::KviMenuListViewItem(KviTalListView * par,KviKvsPopupMenu * popup) : KviTalListViewItem(par) { @@ -1023,17 +986,12 @@ void KviMenuListViewItem::replacePopup(KviKvsPopupMenu * popup) m_pPopup = popup; } - KviPopupEditor::KviPopupEditor(QWidget * par) : QWidget(par) { QGridLayout * l = new QGridLayout(this,1,1,0,2); -#ifdef COMPILE_USE_QT4 QSplitter * spl = new QSplitter(Qt::Horizontal,this,"popupeditor"); spl->setOpaqueResize(false); -#else - QSplitter * spl = new QSplitter(QSplitter::Horizontal,this); -#endif l->addWidget(spl,0,0); KviTalVBox * box = new KviTalVBox(spl); @@ -1086,7 +1044,6 @@ void KviPopupEditor::oneTimeSetup() connect(m_pListView,SIGNAL(currentChanged(KviTalListViewItem *)),this,SLOT(currentItemChanged(KviTalListViewItem *))); connect(m_pListView,SIGNAL(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)), this,SLOT(itemPressed(KviTalListViewItem *,const QPoint &,int))); - } void KviPopupEditor::itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col) @@ -1116,7 +1073,6 @@ void KviPopupEditor::itemPressed(KviTalListViewItem *it,const QPoint &pnt,int co m_pContextPopup->popup(pnt); } - void KviPopupEditor::exportCurrentPopup() { if(!m_pLastEditedItem)return; @@ -1192,7 +1148,6 @@ void KviPopupEditor::exportPopups(bool bSelectedOnly) } } - void KviPopupEditor::removeCurrentPopup() { if(m_pLastEditedItem) @@ -1282,7 +1237,6 @@ void KviPopupEditor::commit() g_pApp->savePopups(); } - void KviPopupEditor::getUniquePopupName(KviMenuListViewItem *item,QString &buffer) { __range_valid(m_bOneTimeSetupDone); @@ -1314,7 +1268,6 @@ void KviPopupEditor::getUniquePopupName(KviMenuListViewItem *item,QString &buffe } - KviPopupEditorWindow::KviPopupEditorWindow(KviFrame * lpFrm) : KviWindow(KVI_WINDOW_TYPE_SCRIPTEDITOR,lpFrm,"popupeditor",0) { @@ -1364,7 +1317,6 @@ void KviPopupEditorWindow::cancelClicked() close(); } - QPixmap * KviPopupEditorWindow::myIconPtr() { return g_pIconManager->getSmallIcon(KVI_SMALLICON_POPUP); @@ -1396,7 +1348,6 @@ void KviPopupEditorWindow::fillCaptionBuffers() m_szHtmlInactiveCaption += p2; m_szHtmlInactiveCaption += m_szPlainTextCaption; m_szHtmlInactiveCaption += p3; - } @@ -1405,7 +1356,6 @@ void KviPopupEditorWindow::getConfigGroupName(KviStr &szName) szName = "popupeditor"; } - void KviPopupEditorWindow::saveProperties(KviConfig *cfg) { /* diff --git a/src/modules/popupeditor/popupeditor.h b/src/modules/popupeditor/popupeditor.h index d2047eca2..c542b9dac 100644 --- a/src/modules/popupeditor/popupeditor.h +++ b/src/modules/popupeditor/popupeditor.h @@ -24,16 +24,17 @@ #include "kvi_window.h" #include "kvi_string.h" - - -#include #include "kvi_tal_listview.h" -#include #include "kvi_tal_popupmenu.h" -#include + +#include +#include +#include class KviKvsPopupMenu; class KviKvsPopupMenuItem; +class KviScriptEditor; +class KviMenuListViewItem; // KviPopupListViewItem class KviPopupListViewItem : public KviTalListViewItem @@ -61,11 +62,6 @@ public: }; - -class KviScriptEditor; - -class KviMenuListViewItem; - class KviSinglePopupEditor : public QWidget { Q_OBJECT diff --git a/src/modules/raweditor/libkviraweditor.cpp b/src/modules/raweditor/libkviraweditor.cpp index 7b217d6e4..859cd303e 100644 --- a/src/modules/raweditor/libkviraweditor.cpp +++ b/src/modules/raweditor/libkviraweditor.cpp @@ -20,11 +20,12 @@ // Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // +#include "raweditor.h" + #include "kvi_module.h" #include "kvi_locale.h" #include "kvi_frame.h" -#include "raweditor.h" KviRawEditorWindow * g_pRawEditorWindow = 0; @@ -44,7 +45,7 @@ KviRawEditorWindow * g_pRawEditorWindow = 0; */ static bool raweditor_kvs_cmd_open(KviKvsModuleCommandCall * c) -{ +{ if(!g_pRawEditorWindow) { g_pRawEditorWindow = new KviRawEditorWindow(c->window()->frame()); @@ -54,10 +55,8 @@ static bool raweditor_kvs_cmd_open(KviKvsModuleCommandCall * c) return true; } - static bool raweditor_module_init(KviModule * m) { - KVSM_REGISTER_SIMPLE_COMMAND(m,"open",raweditor_kvs_cmd_open); g_pRawEditorWindow = 0; return true; @@ -71,13 +70,13 @@ static bool raweditor_module_can_unload(KviModule * m) static bool raweditor_module_cleanup(KviModule *m) { if(g_pRawEditorWindow)delete g_pRawEditorWindow; - g_pRawEditorWindow = 0; + g_pRawEditorWindow = 0; return true; } KVIRC_MODULE( "RawEditor", // module name - "1.0.0", // module version + "4.0.0", // module version "Copyright (C) 2002 Szymon Stefanek (pragma at kvirc dot net)", // author & (C) "Editor for the script raw events", raweditor_module_init, diff --git a/src/modules/raweditor/raweditor.cpp b/src/modules/raweditor/raweditor.cpp index 6601a7004..2a4f5d649 100644 --- a/src/modules/raweditor/raweditor.cpp +++ b/src/modules/raweditor/raweditor.cpp @@ -35,18 +35,17 @@ #include "kvi_cmdformatter.h" #include "kvi_kvs_eventmanager.h" #include "kvi_kvs_eventhandler.h" - -#include -#include -#include #include "kvi_tal_vbox.h" #include "kvi_tal_popupmenu.h" -#include -#include -#include -extern KviRawEditorWindow * g_pRawEditorWindow; +#include +#include +#include +#include +#include +#include +extern KviRawEditorWindow * g_pRawEditorWindow; KviRawListViewItem::KviRawListViewItem(KviTalListView *par,int idx) @@ -69,17 +68,12 @@ const QPixmap * KviRawHandlerListViewItem::pixmap(int col) const } - KviRawEditor::KviRawEditor(QWidget * par) : QWidget(par,"raw_event_editor") { QGridLayout * l = new QGridLayout(this,1,1,2,2); -#ifdef COMPILE_USE_QT4 QSplitter * spl = new QSplitter(Qt::Horizontal,this,"raweditorv"); spl->setOpaqueResize(false); -#else - QSplitter * spl = new QSplitter(QSplitter::Horizontal,this); -#endif l->addWidget(spl,0,0); KviTalVBox * boxi = new KviTalVBox(spl); @@ -443,8 +437,6 @@ void KviRawEditor::exportAllEvents() } - - KviRawEditorWindow::KviRawEditorWindow(KviFrame * lpFrm) : KviWindow(KVI_WINDOW_TYPE_SCRIPTEDITOR,lpFrm,"raweditor",0) { @@ -494,7 +486,6 @@ void KviRawEditorWindow::cancelClicked() close(); } - QPixmap * KviRawEditorWindow::myIconPtr() { return g_pIconManager->getSmallIcon(KVI_SMALLICON_RAWEVENT); @@ -529,35 +520,33 @@ void KviRawEditorWindow::fillCaptionBuffers() } - void KviRawEditorWindow::getConfigGroupName(KviStr &szName) { szName = "raweditor"; } - void KviRawEditorWindow::saveProperties(KviConfig *cfg) { -/* -#ifdef COMPILE_SCRIPTTOOLBAR - cfg->writeEntry("Sizes",m_pEditor->sizes()); - cfg->writeEntry("LastRaw",m_pEditor->lastEditedRaw().ptr()); - //debug("LAST EDITED=%s",m_pEditor->lastEditedRaw().ptr()); -#endif // COMPILE_SCRIPTTOOLBAR -*/ + /* + #ifdef COMPILE_SCRIPTTOOLBAR + cfg->writeEntry("Sizes",m_pEditor->sizes()); + cfg->writeEntry("LastRaw",m_pEditor->lastEditedRaw().ptr()); + //debug("LAST EDITED=%s",m_pEditor->lastEditedRaw().ptr()); + #endif // COMPILE_SCRIPTTOOLBAR + */ } void KviRawEditorWindow::loadProperties(KviConfig *cfg) { -/* -#ifdef COMPILE_SCRIPTTOOLBAR - QValueList def; - def.append(20); - def.append(80); - m_pEditor->setSizes(cfg->readIntListEntry("Sizes",def)); - KviStr tmp = cfg->readEntry("LastRaw",""); - m_pEditor->editRaw(tmp); - //debug("LAST EDITED WAS %s",tmp.ptr()); -#endif // COMPILE_SCRIPTTOOLBAR -*/ + /* + #ifdef COMPILE_SCRIPTTOOLBAR + QValueList def; + def.append(20); + def.append(80); + m_pEditor->setSizes(cfg->readIntListEntry("Sizes",def)); + KviStr tmp = cfg->readEntry("LastRaw",""); + m_pEditor->editRaw(tmp); + //debug("LAST EDITED WAS %s",tmp.ptr()); + #endif // COMPILE_SCRIPTTOOLBAR + */ } diff --git a/src/modules/raweditor/raweditor.h b/src/modules/raweditor/raweditor.h index a228ab17b..6d1a20472 100644 --- a/src/modules/raweditor/raweditor.h +++ b/src/modules/raweditor/raweditor.h @@ -24,12 +24,13 @@ #include "kvi_window.h" #include "kvi_qstring.h" - -#include #include "kvi_tal_listview.h" -#include + +#include +#include class KviScriptEditor; +class KviTalPopupMenu; class KviRawListViewItem : public KviTalListViewItem { @@ -58,8 +59,6 @@ public: virtual const QPixmap * pixmap(int col) const; }; -class KviTalPopupMenu; - class KviRawEditor : public QWidget { Q_OBJECT diff --git a/src/modules/rijndael/libkvirijndael.cpp b/src/modules/rijndael/libkvirijndael.cpp index 5faa74471..360e134bd 100644 --- a/src/modules/rijndael/libkvirijndael.cpp +++ b/src/modules/rijndael/libkvirijndael.cpp @@ -21,13 +21,11 @@ // #include "libkvirijndael.h" - #include "rijndael.h" #include "kvi_module.h" #include "kvi_debug.h" #include "kvi_locale.h" - #include "kvi_mirccntrl.h" #include "kvi_time.h" @@ -61,17 +59,13 @@ #ifdef COMPILE_CRYPT_SUPPORT - #include "kvi_memmove.h" #include "kvi_malloc.h" - #include "kvi_pointerlist.h" static KviPointerList * g_pEngineList = 0; - - KviRijndaelEngine::KviRijndaelEngine() : KviCryptEngine() { @@ -349,9 +343,6 @@ } - - - // Mircryption stuff #include "ablowfish.h" @@ -839,7 +830,7 @@ static bool rijndael_module_can_unload(KviModule *) // ======================================= KVIRC_MODULE( "Rijndael crypt engine", - "1.0.0", + "4.0.0", "Szymon Stefanek " , "Exports the rijndael crypt engine", rijndael_module_init , diff --git a/src/modules/rijndael/rijndael.cpp b/src/modules/rijndael/rijndael.cpp index 5e7af1f20..41f67f3f2 100644 --- a/src/modules/rijndael/rijndael.cpp +++ b/src/modules/rijndael/rijndael.cpp @@ -3,7 +3,7 @@ // Creation date : Sun Nov 5 2000 03:22:10 CEST by Szymon Stefanek // // This file is part of the KVirc irc client distribution -// Copyright (C) 1999-2000 Szymon Stefanek (pragma at kvirc dot net) +// Copyright (C) 1999-2008 Szymon Stefanek (pragma at kvirc dot net) // // This program is FREE software. You can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/src/modules/rijndael/rijndael.h b/src/modules/rijndael/rijndael.h index 619925c7d..4a5b9e506 100644 --- a/src/modules/rijndael/rijndael.h +++ b/src/modules/rijndael/rijndael.h @@ -6,7 +6,7 @@ // Creation date : Sun Nov 5 2000 15:42:14 CEST by Szymon Stefanek // // This file is part of the KVirc irc client distribution -// Copyright (C) 1999-2000 Szymon Stefanek (pragma at kvirc dot net) +// Copyright (C) 1999-2008 Szymon Stefanek (pragma at kvirc dot net) // // This program is FREE software. You can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -103,7 +103,7 @@ typedef unsigned short UINT16; #define RIJNDAEL_CORRUPTED_DATA -7 class Rijndael -{ +{ public: enum Direction { Encrypt , Decrypt }; enum Mode { ECB , CBC , CFB1 }; @@ -119,7 +119,7 @@ protected: Direction m_direction; UINT8 m_initVector[MAX_IV_SIZE]; UINT32 m_uRounds; - UINT8 m_expandedKey[_MAX_ROUNDS+1][4][4]; + UINT8 m_expandedKey[_MAX_ROUNDS+1][4][4]; public: // Initializes the crypt session // Returns RIJNDAEL_SUCCESS or an error code diff --git a/src/modules/sharedfile/libkvisharedfile.cpp b/src/modules/sharedfile/libkvisharedfile.cpp index 4095af0b3..77609b826 100644 --- a/src/modules/sharedfile/libkvisharedfile.cpp +++ b/src/modules/sharedfile/libkvisharedfile.cpp @@ -23,20 +23,18 @@ //============================================================================= #include "kvi_module.h" - #include "kvi_sharedfiles.h" #include "kvi_ircmask.h" #include "kvi_fileutils.h" #include "kvi_locale.h" - #include "kvi_out.h" #include "kvi_mirccntrl.h" #include "kvi_window.h" #include "kvi_frame.h" - +#include "kvi_pointerhashtable.h" #include -#include "kvi_pointerhashtable.h" + extern KVIRC_API KviSharedFilesManager * g_pSharedFilesManager; @@ -239,7 +237,7 @@ static bool sharedfile_kvs_cmd_list(KviKvsModuleCommandCall * c) ++it; } -//#warning "FIND A BETTER KVI_OUT_*" + //#warning "FIND A BETTER KVI_OUT_*" if(idx == 0)c->window()->outputNoFmt(KVI_OUT_NONE,__tr2qs_ctx("No active file sharedfile","sharedfile")); else c->window()->output(KVI_OUT_NONE,__tr2qs_ctx("Total: %d sharedfile","sharedfile"),idx); @@ -247,7 +245,6 @@ static bool sharedfile_kvs_cmd_list(KviKvsModuleCommandCall * c) return true; } - static bool sharedfile_module_init(KviModule * m) { @@ -270,8 +267,8 @@ static bool sharedfile_module_cleanup(KviModule *m) } KVIRC_MODULE( - "Offer", // module name - "1.0.0", // module version + "SharedFiles", // module name + "4.0.0", // module version "Copyright (C) 2000-2003 Szymon Stefanek (pragma at kvirc dot net)", // author & (C) "User interface to the file sharing system", sharedfile_module_init, diff --git a/src/modules/sharedfileswindow/libkvisharedfileswindow.cpp b/src/modules/sharedfileswindow/libkvisharedfileswindow.cpp index 2d637b88b..2f5604a39 100644 --- a/src/modules/sharedfileswindow/libkvisharedfileswindow.cpp +++ b/src/modules/sharedfileswindow/libkvisharedfileswindow.cpp @@ -21,18 +21,16 @@ // //================================================================================== -#include "kvi_module.h" - - #include "sharedfileswindow.h" +#include "kvi_module.h" #include "kvi_app.h" #include "kvi_frame.h" #include "kvi_window.h" #include "kvi_locale.h" #include "kvi_iconmanager.h" -#include +#include #define KVI_SHARED_FILES_WINDOW_EXTENSION_NAME "Shared files window extension" @@ -102,7 +100,7 @@ static KviModuleExtension * sharedfileswindow_extension_alloc(KviModuleExtension */ static bool sharedfileswindow_kvs_cmd_open(KviKvsModuleCommandCall * c) -{ +{ KviModuleExtensionDescriptor * d = c->module()->findExtensionDescriptor("tool",KVI_SHARED_FILES_WINDOW_EXTENSION_NAME); if(d) { @@ -148,7 +146,7 @@ static bool sharedfileswindow_module_can_unload(KviModule *m) KVIRC_MODULE( "SharedFilesWindow", - "1.0.0", + "4.0.0", "Copyright (C) 2003 Szymon Stefanek (pragma at kvirc dot net)", "Shared files window extension", sharedfileswindow_module_init, diff --git a/src/modules/sharedfileswindow/sharedfileswindow.cpp b/src/modules/sharedfileswindow/sharedfileswindow.cpp index 6931397ce..a0d553b41 100644 --- a/src/modules/sharedfileswindow/sharedfileswindow.cpp +++ b/src/modules/sharedfileswindow/sharedfileswindow.cpp @@ -36,18 +36,18 @@ #include "kvi_input.h" #include "kvi_filedialog.h" #include "kvi_styled_controls.h" - -#include -#include -#include -#include -#include #include "kvi_tal_hbox.h" #include "kvi_tal_vbox.h" -#include -#include -#include -#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include extern KviSharedFilesWindow * g_pSharedFilesWindow; extern KVIRC_API KviSharedFilesManager * g_pSharedFilesManager; @@ -206,11 +206,7 @@ KviSharedFilesWindow::KviSharedFilesWindow(KviModuleExtensionDescriptor * d,KviF : KviWindow(KVI_WINDOW_TYPE_TOOL,lpFrm,"shared files window",0) , KviModuleExtension(d) { g_pSharedFilesWindow = this; -#ifdef COMPILE_USE_QT4 m_pSplitter = new QSplitter(Qt::Horizontal,this,"splitter"); -#else - m_pSplitter = new QSplitter(QSplitter::Horizontal,this,"splitter"); -#endif KviTalVBox * vbox = new KviTalVBox(m_pSplitter); @@ -742,4 +738,3 @@ void KviSharedFilesWindow::die() #ifndef COMPILE_USE_STANDALONE_MOC_SOURCES #include "m_sharedfileswindow.moc" #endif //!COMPILE_USE_STANDALONE_MOC_SOURCES - diff --git a/src/modules/sharedfileswindow/sharedfileswindow.h b/src/modules/sharedfileswindow/sharedfileswindow.h index 5a7d66b4a..1e76a3ec9 100644 --- a/src/modules/sharedfileswindow/sharedfileswindow.h +++ b/src/modules/sharedfileswindow/sharedfileswindow.h @@ -31,9 +31,9 @@ #include "kvi_moduleextension.h" #include "kvi_sharedfiles.h" #include "kvi_styled_controls.h" - #include "kvi_tal_listview.h" -#include + +#include class QGridLayout; class QDateTimeEdit; @@ -53,9 +53,8 @@ public: }; - class KviSharedFileEditDialog : public QDialog -{ +{ Q_OBJECT public: KviSharedFileEditDialog(QWidget* par,KviSharedFile * f = 0); @@ -75,8 +74,6 @@ protected slots: }; - - class KviSharedFilesWindow : public KviWindow , public KviModuleExtension { friend class KviSharedFilesItem; diff --git a/src/modules/socketspy/libkvisocketspy.cpp b/src/modules/socketspy/libkvisocketspy.cpp index 2e8e632d7..d2d9b0d16 100644 --- a/src/modules/socketspy/libkvisocketspy.cpp +++ b/src/modules/socketspy/libkvisocketspy.cpp @@ -19,17 +19,14 @@ // Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // - -#include "kvi_module.h" - - #include "socketspywindow.h" +#include "kvi_module.h" #include "kvi_frame.h" #include "kvi_window.h" #include "kvi_locale.h" -#include +#include KviPointerList * g_pSocketSpyWindowList = 0; @@ -51,7 +48,7 @@ KviPointerList * g_pSocketSpyWindowList = 0; */ static bool socketspy_kvs_cmd_open(KviKvsModuleCommandCall * c) -{ +{ if(!c->window()->console())return c->context()->errorNoIrcContext(); KviSocketSpyWindow *w = new KviSocketSpyWindow(c->window()->frame(),c->window()->console()); c->window()->frame()->addWindow(w); @@ -82,7 +79,7 @@ static bool socketspy_module_can_unload(KviModule *m) KVIRC_MODULE( "SocketSpy", // module name - "1.0.0", // module version + "4.0.0", // module version "Copyright (C) 2000 Szymon Stefanek (pragma at kvirc dot net)", // author & (C) "SocketSpy irc socket traffic monitor", socketspy_module_init, diff --git a/src/modules/socketspy/socketspywindow.cpp b/src/modules/socketspy/socketspywindow.cpp index 75693bba2..f0460aba3 100644 --- a/src/modules/socketspy/socketspywindow.cpp +++ b/src/modules/socketspy/socketspywindow.cpp @@ -27,21 +27,18 @@ #include "kvi_options.h" #include "kvi_locale.h" #include "kvi_console.h" - -#include //#include "kvi_module.h" +#include + + extern KviPointerList * g_pSocketSpyWindowList; KviSocketSpyWindow::KviSocketSpyWindow(KviFrame * lpFrm,KviConsole * lpConsole) : KviWindow(KVI_WINDOW_TYPE_SOCKETSPY,lpFrm,"socket_spy",lpConsole) , KviIrcDataStreamMonitor(lpConsole->context()) { g_pSocketSpyWindowList->append(this); - #ifdef COMPILE_USE_QT4 m_pSplitter = new QSplitter(Qt::Horizontal,this,"splitter"); - #else - m_pSplitter = new QSplitter(QSplitter::Horizontal,this,"splitter"); -#endif m_pIrcView = new KviIrcView(m_pSplitter,lpFrm,this); // Ensure proper focusing //setFocusHandler(m_pIrcView,this); @@ -126,4 +123,3 @@ void KviSocketSpyWindow::applyOptions() #ifndef COMPILE_USE_STANDALONE_MOC_SOURCES #include "m_socketspywindow.moc" #endif //!COMPILE_USE_STANDALONE_MOC_SOURCES - diff --git a/src/modules/spaste/controller.cpp b/src/modules/spaste/controller.cpp index cf6924275..438b82938 100644 --- a/src/modules/spaste/controller.cpp +++ b/src/modules/spaste/controller.cpp @@ -20,24 +20,26 @@ // Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "controller.h" + #include "kvi_window.h" #include "kvi_console.h" #include "kvi_mirccntrl.h" #include "kvi_app.h" #include "kvi_options.h" -#include -#include -#include +#include +#include +#include +#include extern KviPointerList * g_pControllerList; SPasteController::SPasteController(KviWindow * w,int id) - : m_pClipBuff(NULL),m_pFile(NULL),m_pId(id),m_pWindow(w) +: m_pClipBuff(NULL),m_pFile(NULL),m_pId(id),m_pWindow(w) { - g_pControllerList->append(this); - //m_pWindow = w; - m_pTimer = new QTimer(this); + g_pControllerList->append(this); + //m_pWindow = w; + m_pTimer = new QTimer(this); } SPasteController::~SPasteController() @@ -86,22 +88,7 @@ bool SPasteController::pasteClipboardInit(void) void SPasteController::pasteFile(void) { -#ifndef COMPILE_USE_QT4 - QString line; - if(m_pFile->readLine(line,999) != -1) - { - if(line.isEmpty()) - line = QChar(KVI_TEXT_RESET); - if( (!g_pApp->windowExists(m_pWindow)) || m_pWindow->console()->isNotConnected() ) - { - m_pFile->close(); - delete this; - } else m_pWindow->ownMessage(line.ascii()); - } else { //File finished - m_pFile->close(); - delete this; - } -#endif + } void SPasteController::pasteClipboard(void) @@ -121,4 +108,3 @@ void SPasteController::pasteClipboard(void) #ifndef COMPILE_USE_STANDALONE_MOC_SOURCES #include "controller.moc" #endif //!COMPILE_USE_STANDALONE_MOC_SOURCES - diff --git a/src/modules/spaste/controller.h b/src/modules/spaste/controller.h index 00d50e692..22172e24a 100644 --- a/src/modules/spaste/controller.h +++ b/src/modules/spaste/controller.h @@ -1,3 +1,5 @@ +#ifndef _SPASTE_CONTROLLER_H_ +#define _SPASTE_CONTROLLER_H_ // File : controller.h // Creation date : Thu Apr 30 2002 17:13:12 GMT by Juanjo Álvarez // @@ -19,41 +21,38 @@ // along with this program. If not, write to the Free Software Foundation, // Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#ifndef SPASTE_CONTROLLER_H -#define SPASTE_CONTROLLER_H + #include "kvi_window.h" #include "kvi_string.h" -#include -#include -#include +#include +#include +#include class SPasteController : public QObject { - Q_OBJECT + Q_OBJECT public: - SPasteController(KviWindow * w,int id); - ~SPasteController(); - - //bool pasteFileInit(KviStr * fileName); - bool pasteFileInit(QString &fileName); - bool pasteClipboardInit(void); - int getId(void){return m_pId;}; - KviWindow * window(void){return m_pWindow;}; - //void stop(void); + SPasteController(KviWindow * w,int id); + ~SPasteController(); + + //bool pasteFileInit(KviStr * fileName); + bool pasteFileInit(QString &fileName); + bool pasteClipboardInit(void); + int getId(void){return m_pId;}; + KviWindow * window(void){return m_pWindow;}; + //void stop(void); protected slots: - void pasteFile(void); - void pasteClipboard(void); - + void pasteFile(void); + void pasteClipboard(void); private: - QStringList *m_pClipBuff; - QFile *m_pFile; - int m_pId; - KviWindow *m_pWindow; - QTimer *m_pTimer; - QStringList::Iterator m_clipBuffIterator; + QStringList *m_pClipBuff; + QFile *m_pFile; + int m_pId; + KviWindow *m_pWindow; + QTimer *m_pTimer; + QStringList::Iterator m_clipBuffIterator; }; #endif //SPASTE_CONTROLLER_H - diff --git a/src/modules/spaste/libkvispaste.cpp b/src/modules/spaste/libkvispaste.cpp index 9603fa68a..4b8c5215a 100644 --- a/src/modules/spaste/libkvispaste.cpp +++ b/src/modules/spaste/libkvispaste.cpp @@ -207,7 +207,7 @@ static bool spaste_kvs_cmd_stop(KviKvsModuleCommandCall * c) } else { KviPointerListIterator it(*g_pControllerList); SPasteController *item; - + if(!iId) //Delete all spaste's from the current window { if((c->window()->type() != KVI_WINDOW_TYPE_CHANNEL) && (c->window()->type() != KVI_WINDOW_TYPE_QUERY) && (c->window()->type() != KVI_WINDOW_TYPE_DCCCHAT)) @@ -222,10 +222,10 @@ static bool spaste_kvs_cmd_stop(KviKvsModuleCommandCall * c) if(kvi_strEqualCS(item->window()->id(),c->window()->id()))delete item; } } - } else //Delete the spaste with the given id - { + } else { + //Delete the spaste with the given id while( (item = it.current()) != 0) - { + { ++it; if(item->getId() == iId)delete item; } @@ -258,7 +258,7 @@ static bool spaste_kvs_cmd_stop(KviKvsModuleCommandCall * c) //-------------------------------------------------- static bool spaste_kvs_cmd_list(KviKvsModuleCommandCall * c) -{ +{ KviPointerListIterator it(*g_pControllerList); SPasteController *item; @@ -295,7 +295,7 @@ static bool spaste_kvs_cmd_list(KviKvsModuleCommandCall * c) static bool spaste_kvs_cmd_setdelay(KviKvsModuleCommandCall * c) -{ +{ kvs_int_t delay; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("delay",KVS_PT_INTEGER,0,delay) @@ -334,7 +334,7 @@ static bool spaste_module_can_unload(KviModule *m) //------------------------------------------------- KVIRC_MODULE( "SPaste", // module name - "1.0.0", // module version + "4.0.0", // module version " (C) 2002 Juanjo Alvarez (juanjux@yahoo.es)", // author & (C) "Delayed paste commands", spaste_module_init, diff --git a/src/modules/spaste/libkvispaste.h b/src/modules/spaste/libkvispaste.h index 53724c2de..90d5a9a17 100644 --- a/src/modules/spaste/libkvispaste.h +++ b/src/modules/spaste/libkvispaste.h @@ -1,13 +1,32 @@ -#ifndef KVISPASTE_H -#define KVISPASTE_H +#ifndef _KVISPASTE_H_ +#define _KVISPASTE_H_ +// File : libkvispaste.h +// Creation date : Thu Dec 27 2002 17:13:12 GMT by Juanjo �varez +// +// This file is part of the KVirc irc client distribution +// Copyright (C) 2002 Juanjo �varez (juanjux@yahoo.es) +// Copyright (C) 2002 Szymon Stefanek (kvirc@tin.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. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// #include "kvi_window.h" typedef struct _SPasteThreadData { - QString * strData; - KviWindow * win; + QString * strData; + KviWindow * win; } SPasteThreadData; - - #endif -- cgit v1.3.1-10-gc9f91