aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar staticfox2016-04-17 09:51:36 -0400
committerGravatar staticfox2016-04-17 10:02:47 -0400
commit14a358c455061fee498bc19dde7916ddbe1c5ea8 (patch)
tree7d00c5568ab0fc13c8868d7f6e65df0dfd5cd4f2 /src
parentCMake: Add error handling MSVC flags (diff)
downloadKVIrc-14a358c455061fee498bc19dde7916ddbe1c5ea8.tar.gz
KVIrc-14a358c455061fee498bc19dde7916ddbe1c5ea8.tar.bz2
KVIrc-14a358c455061fee498bc19dde7916ddbe1c5ea8.zip
general: Refactoring and cleanups
Diffstat (limited to 'src')
-rw-r--r--src/kvilib/irc/KviIrcUserDataBase.cpp16
-rw-r--r--src/kvilib/irc/KviIrcUserEntry.cpp17
-rw-r--r--src/kvilib/irc/KviIrcUserEntry.h15
-rw-r--r--src/kvilib/tal/KviTalApplication.cpp2
-rw-r--r--src/kvirc/kernel/KviApplication.cpp8
-rw-r--r--src/kvirc/sparser/KviIrcServerParser_tables.cpp6
-rw-r--r--src/kvirc/ui/KviMainWindow.cpp68
-rw-r--r--src/modules/trayicon/libkvitrayicon.cpp64
-rw-r--r--src/modules/trayicon/libkvitrayicon.h5
9 files changed, 91 insertions, 110 deletions
diff --git a/src/kvilib/irc/KviIrcUserDataBase.cpp b/src/kvilib/irc/KviIrcUserDataBase.cpp
index d1b99a0e9..010bf689a 100644
--- a/src/kvilib/irc/KviIrcUserDataBase.cpp
+++ b/src/kvilib/irc/KviIrcUserDataBase.cpp
@@ -58,7 +58,7 @@ bool KviIrcUserDataBase::haveCustomColor(const QString & szNick)
return false;
if(pEntry->m_szLastRegisteredMatchNick != szNick)
registeredUser(szNick);
- if(!pEntry->m_bNotFoundRegUserLoockup)
+ if(!pEntry->m_bNotFoundRegUserLookup)
return pEntry->m_bUseCustomColor;
return false;
@@ -72,7 +72,7 @@ QColor * KviIrcUserDataBase::customColor(const QString & szNick)
if(pEntry->m_szLastRegisteredMatchNick != szNick)
registeredUser(szNick);
- if(!pEntry->m_bNotFoundRegUserLoockup)
+ if(!pEntry->m_bNotFoundRegUserLookup)
return &(pEntry->m_cachedColor);
return 0;
@@ -89,7 +89,7 @@ KviRegisteredUser * KviIrcUserDataBase::registeredUser(const QString & szNick, c
KviRegisteredUser * pUser = 0;
- if(pEntry->m_bNotFoundRegUserLoockup && pEntry->m_szLastRegisteredMatchNick == szNick)
+ if(pEntry->m_bNotFoundRegUserLookup && pEntry->m_szLastRegisteredMatchNick == szNick)
return 0;
if(!pEntry->m_szRegisteredUserName.isEmpty() && pEntry->m_szLastRegisteredMatchNick == szNick)
@@ -110,10 +110,10 @@ KviRegisteredUser * KviIrcUserDataBase::registeredUser(const QString & szNick, c
QString szTmp = pUser->getProperty("customColor");
KviStringConversion::fromString(szTmp,pEntry->m_cachedColor);
- pEntry->m_bNotFoundRegUserLoockup = false; //to be sure
+ pEntry->m_bNotFoundRegUserLookup = false; //to be sure
} else {
pEntry->m_szLastRegisteredMatchNick = szNick;
- pEntry->m_bNotFoundRegUserLoockup = true;
+ pEntry->m_bNotFoundRegUserLookup = true;
}
}
}
@@ -183,7 +183,7 @@ void KviIrcUserDataBase::registeredUserChanged(const QString & szUser)
if(it.current()->m_szRegisteredUserName == szUser)
{
it.current()->m_szRegisteredUserName = "";
- it.current()->m_bNotFoundRegUserLoockup = false;
+ it.current()->m_bNotFoundRegUserLookup = false;
}
}
}
@@ -195,7 +195,7 @@ void KviIrcUserDataBase::registeredUserAdded(const QString &)
{
if(it.current()->m_szRegisteredUserName.isEmpty())
{
- it.current()->m_bNotFoundRegUserLoockup = false;
+ it.current()->m_bNotFoundRegUserLookup = false;
}
}
}
@@ -206,6 +206,6 @@ void KviIrcUserDataBase::registeredDatabaseCleared()
for( ; it.current(); ++it )
{
it.current()->m_szRegisteredUserName = "";
- it.current()->m_bNotFoundRegUserLoockup = false;
+ it.current()->m_bNotFoundRegUserLookup = false;
}
}
diff --git a/src/kvilib/irc/KviIrcUserEntry.cpp b/src/kvilib/irc/KviIrcUserEntry.cpp
index 374f5ef51..6e98268ce 100644
--- a/src/kvilib/irc/KviIrcUserEntry.cpp
+++ b/src/kvilib/irc/KviIrcUserEntry.cpp
@@ -30,26 +30,19 @@ KviIrcUserEntry::KviIrcUserEntry(const QString & szUser, const QString & szHost)
{
m_szUser = szUser;
m_szHost = szHost;
- m_pAvatar = 0;
m_nRefs = 1;
m_iHops = -1;
m_bAway = false;
m_bIrcOp = false;
m_eGender = Unknown;
m_bBot = false;
- m_bNotFoundRegUserLoockup = false;
+ m_bNotFoundRegUserLookup = false;
m_bUseCustomColor = false;
m_bAvatarRequested = false;
m_iSmartNickColor = -1;
m_szAccountName = QString();
}
-KviIrcUserEntry::~KviIrcUserEntry()
-{
- if(m_pAvatar)
- delete m_pAvatar;
-}
-
void KviIrcUserEntry::setRealName(const QString & szReal)
{
m_szRealName = szReal.trimmed();
@@ -102,14 +95,10 @@ void KviIrcUserEntry::setRealName(const QString & szReal)
void KviIrcUserEntry::setAvatar(KviAvatar * pAvatar)
{
- if(m_pAvatar)
- delete m_pAvatar;
- m_pAvatar = pAvatar;
+ m_pAvatar.reset(pAvatar);
}
KviAvatar * KviIrcUserEntry::forgetAvatar()
{
- KviAvatar * pAvatar = m_pAvatar;
- m_pAvatar = 0;
- return pAvatar;
+ return m_pAvatar.release();
}
diff --git a/src/kvilib/irc/KviIrcUserEntry.h b/src/kvilib/irc/KviIrcUserEntry.h
index 89d89ccf9..3b4e8c997 100644
--- a/src/kvilib/irc/KviIrcUserEntry.h
+++ b/src/kvilib/irc/KviIrcUserEntry.h
@@ -33,6 +33,8 @@
* This file was originally part of KviIrcUserDataBase.h
*/
+#include <memory>
+
#include "kvi_settings.h"
#include "KviAvatar.h"
@@ -75,11 +77,6 @@ public:
* \return KviIrcUserEntry
*/
KviIrcUserEntry(const QString & user, const QString & host);
-
- /**
- * \brief Destroys the object
- */
- ~KviIrcUserEntry();
protected:
QString m_szUser;
QString m_szHost;
@@ -93,13 +90,13 @@ protected:
bool m_bAway;
bool m_bIrcOp;
- KviAvatar * m_pAvatar;
+ std::unique_ptr<KviAvatar> m_pAvatar;
int m_nRefs;
bool m_bBot;
bool m_bAvatarRequested;
- bool m_bNotFoundRegUserLoockup; //wtf?
+ bool m_bNotFoundRegUserLookup; //wtf?
QString m_szRegisteredUserName;
QString m_szLastRegisteredMatchNick;
@@ -197,7 +194,7 @@ public:
* \return void
* \warning The ownership passes to this class!
*/
- void setAvatar(KviAvatar * pAvatar = 0);
+ void setAvatar(KviAvatar * pAvatar = nullptr);
/**
* \brief Sets the user global flags (eg: "G*")
@@ -294,7 +291,7 @@ public:
* \brief Returns the avatar of the user
* \return KviAvatar
*/
- KviAvatar * avatar(){ return m_pAvatar; };
+ KviAvatar * avatar(){ return m_pAvatar.get(); };
/**
* \brief Returns the number of references of the user in the database
diff --git a/src/kvilib/tal/KviTalApplication.cpp b/src/kvilib/tal/KviTalApplication.cpp
index 05ec0de59..a07c62be0 100644
--- a/src/kvilib/tal/KviTalApplication.cpp
+++ b/src/kvilib/tal/KviTalApplication.cpp
@@ -49,5 +49,3 @@ void KviTalApplication::commitData(QSessionManager & manager)
KApplication::commitData(manager);
#endif //defined(COMPILE_KDE4_SUPPORT)
}
-
-
diff --git a/src/kvirc/kernel/KviApplication.cpp b/src/kvirc/kernel/KviApplication.cpp
index 81c5514f0..83d578bee 100644
--- a/src/kvirc/kernel/KviApplication.cpp
+++ b/src/kvirc/kernel/KviApplication.cpp
@@ -650,16 +650,16 @@ void KviApplication::notifierMessage(KviWindow * pWnd, int iIconId, const QStrin
We have different behaviour depending on support enabled at compile time (env)
and options enabled by the user (opt).
Let's see the scheme to understand which is chosen:
-
+
1: env: DBus, KDE
opt: a: enabled, enabled -> KDE
b: enabled, disabled -> DBus
c: disabled, disabled -> KVIrc
-
+
2: env: DBus, no KDE
opt: a: enabled -> DBus
b: disabled -> KVIrc
-
+
3: env: no DBus, no KDE -> KVIrc
______ __________ ______________
| | | Want KDE | | Scheme 1a |
@@ -679,7 +679,7 @@ void KviApplication::notifierMessage(KviWindow * pWnd, int iIconId, const QStrin
| Schemes 1c - 2b - 3 |
| KVIrc |
|___________________________|
-
+
:)
*/
diff --git a/src/kvirc/sparser/KviIrcServerParser_tables.cpp b/src/kvirc/sparser/KviIrcServerParser_tables.cpp
index f506c5b76..b545fc634 100644
--- a/src/kvirc/sparser/KviIrcServerParser_tables.cpp
+++ b/src/kvirc/sparser/KviIrcServerParser_tables.cpp
@@ -25,7 +25,7 @@
#include "KviIrcServerParser.h"
-#define PTM(__m) KVI_PTR2MEMBER(KviIrcServerParser::__m)
+#define PTM(m) KVI_PTR2MEMBER(KviIrcServerParser::m)
KviLiteralMessageParseStruct KviIrcServerParser::m_literalParseProcTable[]=
{
@@ -51,8 +51,8 @@ KviLiteralMessageParseStruct KviIrcServerParser::m_literalParseProcTable[]=
{ 0 , 0 }
};
-#define REQ(__f) parseCtcpRequest##__f
-#define RPL(__f) parseCtcpReply##__f
+#define REQ(f) parseCtcpRequest##f
+#define RPL(f) parseCtcpReply##f
KviCtcpMessageParseStruct KviIrcServerParser::m_ctcpParseProcTable[]=
{
diff --git a/src/kvirc/ui/KviMainWindow.cpp b/src/kvirc/ui/KviMainWindow.cpp
index a3d44c38e..61ea58ee6 100644
--- a/src/kvirc/ui/KviMainWindow.cpp
+++ b/src/kvirc/ui/KviMainWindow.cpp
@@ -131,7 +131,7 @@ KviMainWindow::KviMainWindow()
m_pWindowStack = new KviWindowStack(m_pSplitter,"mdi_manager");
// This theoretically had to exists before KviWindowStack (that uses enterSdiMode)
- m_pAccellerators = new KviPointerList<QShortcut>;
+ m_pAccellerators = new KviPointerList<QShortcut>;
m_pMenuBar = new KviMenuBar(this,"main_menu_bar");
setMenuWidget(m_pMenuBar);
#ifndef COMPILE_ON_MAC
@@ -212,13 +212,13 @@ KviMainWindow::~KviMainWindow()
if(m_pTrayIcon)
{
m_pTrayIcon->die();
- m_pTrayIcon = NULL;
+ m_pTrayIcon = nullptr;
}
if(m_pStatusBar)
{
delete m_pStatusBar;
- m_pStatusBar = NULL;
+ m_pStatusBar = nullptr;
}
//close all not console windows
@@ -236,7 +236,7 @@ KviMainWindow::~KviMainWindow()
delete m_pWinList;
delete m_pAccellerators;
- g_pMainWindow = 0;
+ g_pMainWindow = nullptr;
}
void KviMainWindow::registerModuleExtensionToolBar(KviMexToolBar * t)
@@ -366,12 +366,12 @@ void KviMainWindow::accelActivated()
void KviMainWindow::executeInternalCommand(int index)
{
- KviConsoleWindow *pConsole=0;
- if(activeContext() && activeContext()->console())
- pConsole=activeContext()->console();
- else
- pConsole=firstConsole();
- KviKvsScript::run(kvi_getInternalCommandBuffer(index),pConsole);
+ KviConsoleWindow *pConsole=0;
+ if(activeContext() && activeContext()->console())
+ pConsole=activeContext()->console();
+ else
+ pConsole=firstConsole();
+ KviKvsScript::run(kvi_getInternalCommandBuffer(index),pConsole);
}
@@ -835,7 +835,7 @@ void KviMainWindow::closeEvent(QCloseEvent *e)
{
if(!trayIcon())
{
- executeInternalCommand(KVI_INTERNALCOMMAND_TRAYICON_SHOW);
+ executeInternalCommand(KVI_INTERNALCOMMAND_TRAYICON_SHOW);
}
if(trayIcon())
{
@@ -988,7 +988,7 @@ void KviMainWindow::toggleStatusBar()
if(m_pStatusBar)
{
delete m_pStatusBar;
- m_pStatusBar = 0;
+ m_pStatusBar = nullptr;
} else {
m_pStatusBar = new KviStatusBar(this);
m_pStatusBar->load();
@@ -1036,10 +1036,10 @@ void KviMainWindow::fillToolBarsPopup(QMenu * p)
{
p->clear();
- disconnect(p,SIGNAL(triggered(QAction *)),this,SLOT(toolbarsPopupSelected(QAction *))); // just to be sure
- connect(p,SIGNAL(triggered(QAction *)),this,SLOT(toolbarsPopupSelected(QAction *)));
+ disconnect(p,SIGNAL(triggered(QAction *)),this,SLOT(toolbarsPopupSelected(QAction *))); // just to be sure
+ connect(p,SIGNAL(triggered(QAction *)),this,SLOT(toolbarsPopupSelected(QAction *)));
- QAction *pAction=0;
+ QAction *pAction=0;
int cnt = 0;
KviModuleExtensionDescriptorList * l = g_pModuleExtensionManager->getExtensionList("toolbar");
@@ -1048,13 +1048,13 @@ void KviMainWindow::fillToolBarsPopup(QMenu * p)
for(KviModuleExtensionDescriptor * d = l->first();d;d = l->next())
{
QString label = __tr2qs("Show %1").arg(d->visibleName());
- if(d->icon())
- pAction = p->addAction(*(d->icon()),label);
- else
- pAction = p->addAction(label);
- pAction->setCheckable(true);
- pAction->setChecked(moduleExtensionToolBar(d->id()));
- pAction->setData(d->id());
+ if(d->icon())
+ pAction = p->addAction(*(d->icon()),label);
+ else
+ pAction = p->addAction(label);
+ pAction->setCheckable(true);
+ pAction->setChecked(moduleExtensionToolBar(d->id()));
+ pAction->setData(d->id());
cnt++;
}
}
@@ -1064,7 +1064,7 @@ void KviMainWindow::fillToolBarsPopup(QMenu * p)
if(it2.current())
{
if(cnt > 0)
- p->addSeparator();
+ p->addSeparator();
while(KviCustomToolBarDescriptor * d = it2.current())
{
@@ -1075,23 +1075,23 @@ void KviMainWindow::fillToolBarsPopup(QMenu * p)
QPixmap * pix = g_pIconManager->getImage(d->iconId());
if(pix)
{
- pAction = p->addAction(*pix,label);
+ pAction = p->addAction(*pix,label);
} else {
- pAction = p->addAction(label);
+ pAction = p->addAction(label);
}
} else {
- pAction = p->addAction(label);
+ pAction = p->addAction(label);
}
- pAction->setData(d->internalId());
- pAction->setCheckable(true);
- pAction->setChecked(d->toolBar());
+ pAction->setData(d->internalId());
+ pAction->setCheckable(true);
+ pAction->setChecked(d->toolBar());
++it2;
cnt++;
}
}
if(cnt > 0)
- p->addSeparator();
+ p->addSeparator();
p->addAction(
*(g_pIconManager->getSmallIcon(KviIconManager::ToolBarEditor)),
@@ -1108,10 +1108,10 @@ void KviMainWindow::customizeToolBars()
void KviMainWindow::toolbarsPopupSelected(QAction *pAction)
{
- bool bOk=false;
- int idext=pAction->data().toInt(&bOk);
- if(!bOk)
- return;
+ bool bOk=false;
+ int idext=pAction->data().toInt(&bOk);
+ if(!bOk)
+ return;
KviCustomToolBarDescriptor * dd = KviCustomToolBarManager::instance()->findDescriptorByInternalId(idext);
if(dd)
diff --git a/src/modules/trayicon/libkvitrayicon.cpp b/src/modules/trayicon/libkvitrayicon.cpp
index f919de909..09f55f138 100644
--- a/src/modules/trayicon/libkvitrayicon.cpp
+++ b/src/modules/trayicon/libkvitrayicon.cpp
@@ -61,17 +61,17 @@
#endif
extern KVIRC_API KviPointerHashTable<QString,KviWindow> * g_pGlobalWindowDict;
-static KviTrayIconWidget * g_pTrayIcon = 0;
+static KviTrayIconWidget * g_pTrayIcon = nullptr;
-static QPixmap * g_pDock1 = 0;
-static QPixmap * g_pDock2 = 0;
-static QPixmap * g_pDock3 = 0;
+static QPixmap * g_pDock1 = nullptr;
+static QPixmap * g_pDock2 = nullptr;
+static QPixmap * g_pDock3 = nullptr;
KviTrayIconWidget::KviTrayIconWidget()
-: QSystemTrayIcon(g_pMainWindow), m_CurrentPixmap(ICON_SIZE,ICON_SIZE)
+: QSystemTrayIcon(g_pMainWindow), m_CurrentPixmap(ICON_SIZE,ICON_SIZE), m_pTip(g_pMainWindow,"dock_tooltip")
{
g_pTrayIcon = this;
- m_pContextPopup = new QMenu(0);
+ m_pContextPopup = new QMenu(0);
setContextMenu(m_pContextPopup);
m_iConsoles = 0;
@@ -81,13 +81,12 @@ KviTrayIconWidget::KviTrayIconWidget()
m_pFlashingTimer = new QTimer(this);
m_pFlashingTimer->setObjectName("flashing_timer");
- connect( m_pFlashingTimer, SIGNAL(timeout()), this, SLOT(flashingTimerShot()) );
- m_bFlashed=0;
+ connect(m_pFlashingTimer, SIGNAL(timeout()), this, SLOT(flashingTimerShot()));
+ m_bFlashed=false;
g_pMainWindow->setTrayIcon(this);
- m_pTip = new KviDynamicToolTip(g_pMainWindow,"dock_tooltip");
- m_pAwayPopup = new QMenu(0);
+ m_pAwayPopup = new QMenu(0);
#ifndef COMPILE_ON_MAC
m_pTitleLabel = new QLabel(__tr2qs("<b>KVIrc Tray Options</b>"),m_pContextPopup);
@@ -109,10 +108,10 @@ KviTrayIconWidget::KviTrayIconWidget()
id = m_pContextPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Info)),__tr2qs("&About KVIrc"),this,SLOT(executeInternalCommand(bool)));
id->setData(KVI_INTERNALCOMMAND_ABOUT_ABOUTKVIRC);
- m_pContextPopup->addSeparator();
+ m_pContextPopup->addSeparator();
m_pToggleFrame = m_pContextPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::DefaultIcon)),__tr2qs("Hide / Show"),this,SLOT(toggleParentFrame()));
- m_pContextPopup->addSeparator();
+ m_pContextPopup->addSeparator();
id = m_pContextPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::TrayIcon)),__tr2qs("&Hide Tray Icon"),this,SLOT(disableTrayIcon()));
@@ -122,19 +121,18 @@ KviTrayIconWidget::KviTrayIconWidget()
setIcon(*g_pDock1);
- connect(this,SIGNAL(activated ( QSystemTrayIcon::ActivationReason )),this,SLOT(activatedSlot ( QSystemTrayIcon::ActivationReason )));
+ connect(this,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(activatedSlot(QSystemTrayIcon::ActivationReason)));
}
KviTrayIconWidget::~KviTrayIconWidget()
{
- g_pTrayIcon=0;
+ g_pTrayIcon=nullptr;
g_pMainWindow->setTrayIcon(0);
delete m_pAwayPopup;
#ifndef COMPILE_ON_MAC
delete m_pTitleLabel;
#endif
- delete m_pTip;
delete m_pFlashingTimer;
m_pContextPopup->deleteLater();
}
@@ -144,10 +142,11 @@ void KviTrayIconWidget::executeInternalCommand(bool)
{
int iCmd;
bool bOk;
- iCmd=(((QAction*)QObject::sender())->data()).toInt(&bOk);
+ iCmd=dynamic_cast<QAction *>(QObject::sender())->data().toInt(&bOk);
if(bOk)
g_pMainWindow->executeInternalCommand(iCmd);
}
+
void KviTrayIconWidget::die()
{
delete this;
@@ -233,7 +232,7 @@ bool KviTrayIconWidget::event(QEvent *e)
if(tmp.isEmpty())tmp = __tr2qs_no_xgettext(idlemsgs[(int)(rand() % NIDLEMSGS)]);
- m_pTip->tip(QRect(pos,QSize(0,0)),tmp);
+ m_pTip.tip(QRect(pos,QSize(0,0)),tmp);
return true;
}
return false;
@@ -250,7 +249,7 @@ void KviTrayIconWidget::doAway(bool)
{
int id;
bool ok;
- QAction * act = (QAction*)QObject::sender();
+ QAction * act = dynamic_cast<QAction *>(QObject::sender());
if(act)
{
@@ -284,7 +283,7 @@ void KviTrayIconWidget::doAway(bool)
++it;
}
} else {
- KviConsoleWindow* pConsole=g_pApp->findConsole((unsigned int)id);
+ KviConsoleWindow* pConsole=g_pApp->findConsole(static_cast<unsigned int>(id));
if(pConsole)
{
if(pConsole->isConnected())
@@ -319,8 +318,8 @@ void KviTrayIconWidget::fillContextPopup()
QAction* pSeparator=m_pAwayPopup->addSeparator();
KviPointerHashTableIterator<QString,KviWindow> it(*g_pGlobalWindowDict);
- bool bAllAway=1;
- bool bAllUnaway=1;
+ bool bAllAway=true;
+ bool bAllUnaway=true;
int iNetCount=0;
while(KviWindow * wnd = it.current())
{
@@ -334,11 +333,11 @@ void KviTrayIconWidget::fillContextPopup()
{
id=m_pAwayPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::NotAway)),__tr2qs("Back on %1").arg(pConsole->currentNetworkName()),this,SLOT(doAway(bool)));
id->setData(pConsole->context()->id());
- bAllUnaway=0;
+ bAllUnaway=false;
} else {
id=m_pAwayPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Away)),__tr2qs("Away on %1").arg(pConsole->currentNetworkName()),this,SLOT(doAway(bool)));
id->setData(pConsole->context()->id());
- bAllAway=0;
+ bAllAway=false;
}
id->setData(pConsole->context()->id());
iNetCount++;
@@ -606,7 +605,7 @@ void KviTrayIconWidget::updateIcon()
static bool trayicon_kvs_cmd_show(KviKvsModuleCommandCall *)
{
- if(g_pTrayIcon==0)
+ if(!g_pTrayIcon)
{
KviTrayIconWidget * w = new KviTrayIconWidget();
w->show();
@@ -632,9 +631,8 @@ static bool trayicon_kvs_cmd_show(KviKvsModuleCommandCall *)
static bool trayicon_kvs_cmd_hide(KviKvsModuleCommandCall *)
{
- if(g_pTrayIcon)
- delete g_pTrayIcon;
- g_pTrayIcon=0;
+ delete g_pTrayIcon;
+ g_pTrayIcon=nullptr;
// show the parent frame.. otherwise there will be no way to get it back
if(!g_pMainWindow->isVisible())
@@ -685,7 +683,7 @@ static bool trayicon_kvs_cmd_hidewindow(KviKvsModuleCommandCall *)
static bool trayicon_kvs_fnc_isvisible(KviKvsModuleFunctionCall * c)
{
- c->returnValue()->setBoolean(g_pTrayIcon!=0);
+ c->returnValue()->setBoolean(g_pTrayIcon!=nullptr);
return true;
}
@@ -721,23 +719,23 @@ static bool trayicon_module_init(KviModule * m)
static bool trayicon_module_cleanup(KviModule *)
{
delete g_pTrayIcon;
- g_pTrayIcon = 0;
+ g_pTrayIcon = nullptr;
delete g_pDock1;
- g_pDock1 = 0;
+ g_pDock1 = nullptr;
delete g_pDock2;
- g_pDock2 = 0;
+ g_pDock2 = nullptr;
delete g_pDock3;
- g_pDock3 = 0;
+ g_pDock3 = nullptr;
return true;
}
static bool trayicon_module_can_unload(KviModule *)
{
- return g_pTrayIcon==0;
+ return g_pTrayIcon==nullptr;
}
// =======================================
diff --git a/src/modules/trayicon/libkvitrayicon.h b/src/modules/trayicon/libkvitrayicon.h
index dc9609c87..2e5eb24cd 100644
--- a/src/modules/trayicon/libkvitrayicon.h
+++ b/src/modules/trayicon/libkvitrayicon.h
@@ -27,6 +27,7 @@
//=============================================================================
#include "kvi_settings.h"
+#include "KviDynamicToolTip.h"
#include "KviMainWindow.h"
#include "KviTrayIcon.h"
@@ -36,8 +37,6 @@
class QPixmap;
class QTimer;
class QMenu;
-class KviDynamicToolTip;
-//class KviMainWindow;
class KviTrayIconWidget : public QSystemTrayIcon, public KviTrayIcon
{
@@ -46,7 +45,7 @@ public:
KviTrayIconWidget();
~KviTrayIconWidget();
protected:
- KviDynamicToolTip * m_pTip;
+ KviDynamicToolTip m_pTip;
QMenu * m_pContextPopup;
QMenu * m_pAwayPopup;
#ifndef COMPILE_ON_MAC