diff options
| author | 2010-11-16 22:33:28 +0000 | |
|---|---|---|
| committer | 2010-11-16 22:33:28 +0000 | |
| commit | 9835195771d8d95ab3737539723a24593d60ddb1 (patch) | |
| tree | 3bb5f831f4e02d43d2956fb0db8c8be030a9340e /src/modules | |
| parent | fix for #1020, hopefully compatible cross-os (diff) | |
| download | KVIrc-9835195771d8d95ab3737539723a24593d60ddb1.tar.gz KVIrc-9835195771d8d95ab3737539723a24593d60ddb1.tar.bz2 KVIrc-9835195771d8d95ab3737539723a24593d60ddb1.zip | |
don't try to reuse already opened option widgets (fixes #1018)
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@5143 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/options/instances.cpp | 18 | ||||
| -rwxr-xr-x | src/modules/options/mkcreateinstanceproc.sh | 20 | ||||
| -rw-r--r-- | src/modules/options/optw_servers.cpp | 30 |
3 files changed, 40 insertions, 28 deletions
diff --git a/src/modules/options/instances.cpp b/src/modules/options/instances.cpp index 2b158c984..8ae532156 100644 --- a/src/modules/options/instances.cpp +++ b/src/modules/options/instances.cpp @@ -3580,18 +3580,24 @@ void KviOptionsInstanceManager::widgetDestroyed() KviOptionsWidget * KviOptionsInstanceManager::getInstance(KviOptionsWidgetInstanceEntry * e,QWidget * par) { if(!e)return 0; + if(e->pWidget) + { + if(e->pWidget->parent() != par) + { + QWidget * oldPar = (QWidget *)e->pWidget->parent(); + e->pWidget->setParent(par); + oldPar->deleteLater(); + e->pWidget=0; + } + } + if(!(e->pWidget)) { e->pWidget = e->createProc(par); g_iOptionWidgetInstances++; connect(e->pWidget,SIGNAL(destroyed()),this,SLOT(widgetDestroyed())); } - if(e->pWidget->parent() != par) - { - QWidget * oldPar = (QWidget *)e->pWidget->parent(); - e->pWidget->setParent(par); //reparent(par,QPoint(0,0)); - delete oldPar; - } + if(e->bIsContainer) { // need to create the container structure! diff --git a/src/modules/options/mkcreateinstanceproc.sh b/src/modules/options/mkcreateinstanceproc.sh index f0d700b6b..deefa509e 100755 --- a/src/modules/options/mkcreateinstanceproc.sh +++ b/src/modules/options/mkcreateinstanceproc.sh @@ -191,7 +191,7 @@ KviOptionsInstanceManager::KviOptionsInstanceManager() { //qDebug("Instantiating"); - // Create the global widget dict : case sensitive , do not copy keys + // Create the global widget dict : case sensitive, do not copy keys m_pInstanceTree = new KviPointerList<KviOptionsWidgetInstanceEntry>; m_pInstanceTree->setAutoDelete(true); @@ -350,18 +350,24 @@ void KviOptionsInstanceManager::widgetDestroyed() KviOptionsWidget * KviOptionsInstanceManager::getInstance(KviOptionsWidgetInstanceEntry * e,QWidget * par) { if(!e)return 0; + if(e->pWidget) + { + if(e->pWidget->parent() != par) + { + QWidget * oldPar = (QWidget *)e->pWidget->parent(); + e->pWidget->setParent(par); + oldPar->deleteLater(); + e->pWidget=0; + } + } + if(!(e->pWidget)) { e->pWidget = e->createProc(par); g_iOptionWidgetInstances++; connect(e->pWidget,SIGNAL(destroyed()),this,SLOT(widgetDestroyed())); } - if(e->pWidget->parent() != par) - { - QWidget * oldPar = (QWidget *)e->pWidget->parent(); - e->pWidget->setParent(par); //reparent(par,QPoint(0,0)); - delete oldPar; - } + if(e->bIsContainer) { // need to create the container structure! diff --git a/src/modules/options/optw_servers.cpp b/src/modules/options/optw_servers.cpp index ece9675a6..cda2e9545 100644 --- a/src/modules/options/optw_servers.cpp +++ b/src/modules/options/optw_servers.cpp @@ -1336,7 +1336,7 @@ KviServerOptionsWidget::KviServerOptionsWidget(QWidget * parent) tb->setMenu(m_pRecentPopup); tb->setAutoRaise(true); tb->setPopupMode(QToolButton::InstantPopup); - + KviTalToolTip::add(tb,__tr2qs_ctx("<center>This button shows a list of recently used servers. It allows you to quickly find them in the list.</center>","options")); @@ -1346,7 +1346,7 @@ KviServerOptionsWidget::KviServerOptionsWidget(QWidget * parent) m_pConnectCurrent = new QPushButton(__tr2qs_ctx("Connect &Now","options"),this); addWidgetToLayout(m_pConnectCurrent,0,2,1,2); connect(m_pConnectCurrent,SIGNAL(clicked()),this,SLOT(connectCurrentClicked())); - + QPalette pal(QColor(0,0,128)); pal.setColor(QPalette::Active,QPalette::Button,QColor(0,0,220)); @@ -1367,14 +1367,14 @@ KviServerOptionsWidget::KviServerOptionsWidget(QWidget * parent) if(pWindowsStyle) m_pConnectCurrent->setStyle(pWindowsStyle); #endif //COMPILE_ON_WINDOWS || COMPILE_ON_MINGW - + m_pConnectCurrent->setPalette(pal); - + QFont fnt = m_pConnectCurrent->font(); fnt.setPointSizeF(fnt.pointSizeF() * 1.4); fnt.setBold(true); m_pConnectCurrent->setFont(fnt); - + KviTalToolTip::add(m_pConnectCurrent,__tr2qs_ctx("<center>Hit this button to connect to the currently selected server.</center>","options")); KviOptionsWidgetContainer * pContainer = dynamic_cast<KviOptionsWidgetContainer *>(parent); @@ -1455,36 +1455,36 @@ void KviServerOptionsWidget::selectBestServerByUrl(const QString &szUrl) int uCount = m_pTreeWidget->topLevelItemCount(); int uIdx = 0; - + KviServerOptionsTreeWidgetItem * pBestCandidate = NULL; kvi_u32_t uBestCandidateScore = 0; - + while(uIdx < uCount) { KviServerOptionsTreeWidgetItem * pNet = static_cast<KviServerOptionsTreeWidgetItem *>(m_pTreeWidget->topLevelItem(uIdx)); - + uIdx++; - + if(!pNet) continue; // huh ? - + int uServerCount = pNet->childCount(); int uChildIdx = 0; while(uChildIdx < uServerCount) { KviServerOptionsTreeWidgetItem * pServer = static_cast<KviServerOptionsTreeWidgetItem *>(pNet->child(uChildIdx)); uChildIdx++; - + if(!pServer) continue; // huh ? - + KviServer * pServerData = pServer->serverData(); - + if(!pServerData) continue; // umphf... kvi_u32_t uScore = 0; - + if(pServerData->hostName().toLower() == oParts.szHost.toLower()) uScore++; if(pServerData->port() == oParts.iPort) @@ -1493,7 +1493,7 @@ void KviServerOptionsWidget::selectBestServerByUrl(const QString &szUrl) uScore++; if(pServerData->useSSL() == oParts.bSsl) uScore++; - + if(uScore > uBestCandidateScore) { uBestCandidateScore = uScore; |
