aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/classeditor/ClassEditorWindow.cpp
diff options
context:
space:
mode:
authorGravatar Alexey Sokolov2016-04-29 23:57:30 +0100
committerGravatar Alexey Sokolov2016-04-29 23:57:48 +0100
commit690dd7a33ddc90678367d73adf313533536e10f2 (patch)
tree2276fe7c384ebbc222b40a19c536d5c3c5606ce8 /src/modules/classeditor/ClassEditorWindow.cpp
parentAdd config for clang-format. (diff)
downloadKVIrc-690dd7a33ddc90678367d73adf313533536e10f2.tar.gz
KVIrc-690dd7a33ddc90678367d73adf313533536e10f2.tar.bz2
KVIrc-690dd7a33ddc90678367d73adf313533536e10f2.zip
Apply clang-format
Diffstat (limited to 'src/modules/classeditor/ClassEditorWindow.cpp')
-rw-r--r--src/modules/classeditor/ClassEditorWindow.cpp834
1 files changed, 431 insertions, 403 deletions
diff --git a/src/modules/classeditor/ClassEditorWindow.cpp b/src/modules/classeditor/ClassEditorWindow.cpp
index 6d7c407f6..ec54bfe20 100644
--- a/src/modules/classeditor/ClassEditorWindow.cpp
+++ b/src/modules/classeditor/ClassEditorWindow.cpp
@@ -22,7 +22,6 @@
//
//=============================================================================
-
#include "ClassEditorWindow.h"
#include "KviIconManager.h"
@@ -65,10 +64,10 @@ extern ClassEditorWindow * g_pClassEditorWindow;
extern KviModule * g_pClassEditorModule;
ClassEditorTreeWidget::ClassEditorTreeWidget(QWidget * pParent)
-: QTreeWidget(pParent)
+ : QTreeWidget(pParent)
{
- setColumnCount (1);
- setHeaderLabel(__tr2qs_ctx("Class","editor"));
+ setColumnCount(1);
+ setHeaderLabel(__tr2qs_ctx("Class", "editor"));
setSelectionMode(QAbstractItemView::ExtendedSelection);
setRootIsDecorated(true);
setAnimated(true);
@@ -86,39 +85,39 @@ void ClassEditorTreeWidget::mousePressEvent(QMouseEvent * e)
{
QTreeWidgetItem * pItem = itemAt(e->pos());
if(pItem)
- emit rightButtonPressed(pItem,QCursor::pos());
+ emit rightButtonPressed(pItem, QCursor::pos());
}
QTreeWidget::mousePressEvent(e);
}
ClassEditorTreeWidgetItem::ClassEditorTreeWidgetItem(QTreeWidget * pTreeWidget, Type eType, const QString & szName)
-: QTreeWidgetItem(pTreeWidget), KviHeapObject(), m_eType(eType)
+ : QTreeWidgetItem(pTreeWidget), KviHeapObject(), m_eType(eType)
{
setName(szName);
m_szInheritsClassName = "";
- m_iPos = 0;
- m_bInternal = false;
- m_bClassModified = false;
- QPixmap * pIcon = nullptr;
+ m_iPos = 0;
+ m_bInternal = false;
+ m_bClassModified = false;
+ QPixmap * pIcon = nullptr;
if(eType == ClassEditorTreeWidgetItem::Namespace)
pIcon = g_pIconManager->getSmallIcon(KviIconManager::NameSpace);
else
pIcon = g_pIconManager->getSmallIcon(KviIconManager::Class);
- setIcon(0,QIcon(*pIcon));
+ setIcon(0, QIcon(*pIcon));
}
ClassEditorTreeWidgetItem::ClassEditorTreeWidgetItem(ClassEditorTreeWidgetItem * pParentItem, Type eType, const QString & szName)
-: QTreeWidgetItem(pParentItem), m_eType(eType)
+ : QTreeWidgetItem(pParentItem), m_eType(eType)
{
- setFlags(Qt::ItemIsEditable|Qt::ItemIsEnabled|Qt::ItemIsSelectable);
+ setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
setName(szName);
m_szInheritsClassName = "";
- m_bInternal = false;
- m_iPos = 0;
- m_bClassModified = false;
- QPixmap * pIcon = nullptr;
+ m_bInternal = false;
+ m_iPos = 0;
+ m_bClassModified = false;
+ QPixmap * pIcon = nullptr;
if(eType == ClassEditorTreeWidgetItem::Namespace)
pIcon = g_pIconManager->getSmallIcon(KviIconManager::NameSpace);
@@ -127,7 +126,7 @@ ClassEditorTreeWidgetItem::ClassEditorTreeWidgetItem(ClassEditorTreeWidgetItem *
else
pIcon = g_pIconManager->getSmallIcon(KviIconManager::Function);
- setIcon(0,QIcon(*pIcon));
+ setIcon(0, QIcon(*pIcon));
}
void ClassEditorTreeWidgetItem::setClassNotBuilt(bool bModified)
@@ -140,13 +139,13 @@ void ClassEditorTreeWidgetItem::setClassNotBuilt(bool bModified)
else
pIcon = g_pIconManager->getSmallIcon(KviIconManager::Class);
- setIcon(0,QIcon(*pIcon));
+ setIcon(0, QIcon(*pIcon));
}
void ClassEditorTreeWidgetItem::setName(const QString & szName)
{
m_szName = szName;
- setText(0,m_szName);
+ setText(0, m_szName);
}
void ClassEditorTreeWidgetItem::setType(Type eType)
@@ -161,13 +160,13 @@ void ClassEditorTreeWidgetItem::setType(Type eType)
else
pIcon = g_pIconManager->getSmallIcon(KviIconManager::Function);
- setIcon(0,QIcon(*pIcon));
+ setIcon(0, QIcon(*pIcon));
}
ClassEditorWidget::ClassEditorWidget(QWidget * pParent)
-: QWidget(pParent)
+ : QWidget(pParent)
{
- m_pClasses = new KviPointerHashTable<QString,ClassEditorTreeWidgetItem>(100,false);
+ m_pClasses = new KviPointerHashTable<QString, ClassEditorTreeWidgetItem>(100, false);
m_pClasses->setAutoDelete(false);
m_pLastEditedItem = 0;
m_pLastClickedItem = 0;
@@ -175,9 +174,9 @@ ClassEditorWidget::ClassEditorWidget(QWidget * pParent)
QGridLayout * pLayout = new QGridLayout(this);
- m_pSplitter = new QSplitter(Qt::Horizontal,this);
+ m_pSplitter = new QSplitter(Qt::Horizontal, this);
m_pSplitter->setChildrenCollapsible(false);
- pLayout->addWidget(m_pSplitter,0,0);
+ pLayout->addWidget(m_pSplitter, 0, 0);
KviTalVBox * pVBox = new KviTalVBox(m_pSplitter);
pVBox->setSpacing(0);
@@ -189,13 +188,13 @@ ClassEditorWidget::ClassEditorWidget(QWidget * pParent)
KviTalHBox * pHBox = new KviTalHBox(pVBox);
pHBox->setSpacing(0);
pHBox->setMargin(0);
- m_pClassNameLabel = new QLabel(__tr2qs_ctx("No item selected","editor"),pHBox);
- pHBox->setStretchFactor(m_pClassNameLabel,2);
+ m_pClassNameLabel = new QLabel(__tr2qs_ctx("No item selected", "editor"), pHBox);
+ pHBox->setStretchFactor(m_pClassNameLabel, 2);
m_pClassNameLabel->setWordWrap(true);
- m_pClassNameRenameButton = new QPushButton(__tr2qs_ctx("Rename","editor"),pHBox);
- m_pClassNameRenameButton->setToolTip(__tr2qs_ctx("Edit the class or namespace name","editor"));
+ m_pClassNameRenameButton = new QPushButton(__tr2qs_ctx("Rename", "editor"), pHBox);
+ m_pClassNameRenameButton->setToolTip(__tr2qs_ctx("Edit the class or namespace name", "editor"));
m_pClassNameRenameButton->setEnabled(false);
- connect(m_pClassNameRenameButton,SIGNAL(clicked()),this,SLOT(renameItem()));
+ connect(m_pClassNameRenameButton, SIGNAL(clicked()), this, SLOT(renameItem()));
pHBox = new KviTalHBox(pVBox);
pHBox->setSpacing(0);
@@ -204,26 +203,26 @@ ClassEditorWidget::ClassEditorWidget(QWidget * pParent)
pHBox = new KviTalHBox(pVBox);
pHBox->setSpacing(0);
pHBox->setMargin(0);
- m_pFunctionNameLabel = new QLabel(__tr2qs_ctx("No item selected","editor"),pHBox);
- pHBox->setStretchFactor(m_pFunctionNameLabel,2);
- m_pFunctionNameRenameButton = new QPushButton(__tr2qs_ctx("Rename","editor"),pHBox);
- m_pFunctionNameRenameButton->setToolTip(__tr2qs_ctx("Edit the function member name","editor"));
+ m_pFunctionNameLabel = new QLabel(__tr2qs_ctx("No item selected", "editor"), pHBox);
+ pHBox->setStretchFactor(m_pFunctionNameLabel, 2);
+ m_pFunctionNameRenameButton = new QPushButton(__tr2qs_ctx("Rename", "editor"), pHBox);
+ m_pFunctionNameRenameButton->setToolTip(__tr2qs_ctx("Edit the function member name", "editor"));
m_pFunctionNameRenameButton->setEnabled(false);
- connect(m_pFunctionNameRenameButton,SIGNAL(clicked()),this,SLOT(renameFunction()));
+ connect(m_pFunctionNameRenameButton, SIGNAL(clicked()), this, SLOT(renameFunction()));
- m_pReminderLabel = new QLabel(__tr2qs_ctx("No item selected","editor"),pVBox);
+ m_pReminderLabel = new QLabel(__tr2qs_ctx("No item selected", "editor"), pVBox);
m_pReminderLabel->hide();
m_pReminderLabel->setWordWrap(true);
m_pEditor = KviScriptEditor::createInstance(pVBox);
m_pEditor->setFocus();
- connect(m_pEditor,SIGNAL(find(const QString &)),this,SLOT(slotFindWord(const QString &)));
- connect(m_pEditor,SIGNAL(replaceAll(const QString &,const QString &)),this,SLOT(slotReplaceAll(const QString &,const QString &)));
- m_pContextPopup = new QMenu(this);
+ connect(m_pEditor, SIGNAL(find(const QString &)), this, SLOT(slotFindWord(const QString &)));
+ connect(m_pEditor, SIGNAL(replaceAll(const QString &, const QString &)), this, SLOT(slotReplaceAll(const QString &, const QString &)));
+ m_pContextPopup = new QMenu(this);
oneTimeSetup();
m_pTreeWidget->setSortingEnabled(true);
- currentItemChanged(0,0);
+ currentItemChanged(0, 0);
}
ClassEditorWidget::~ClassEditorWidget()
@@ -271,9 +270,9 @@ QString ClassEditorWidget::buildFullClassName(ClassEditorTreeWidgetItem * pItem)
ClassEditorTreeWidgetItem * ClassEditorWidget::findTopLevelItem(const QString & szName)
{
- for(int i=0; i < m_pTreeWidget->topLevelItemCount(); i++)
+ for(int i = 0; i < m_pTreeWidget->topLevelItemCount(); i++)
{
- if(KviQString::equalCI(m_pTreeWidget->topLevelItem(i)->text(0),szName))
+ if(KviQString::equalCI(m_pTreeWidget->topLevelItem(i)->text(0), szName))
return (ClassEditorTreeWidgetItem *)m_pTreeWidget->topLevelItem(i);
}
return nullptr;
@@ -289,14 +288,14 @@ ClassEditorTreeWidgetItem * ClassEditorWidget::findItem(const QString & szFullNa
if(!pItem)
return nullptr;
- for(int i=1; i < lNamespaces.count(); i++)
+ for(int i = 1; i < lNamespaces.count(); i++)
{
bFound = false;
- for(int j=0; j < pItem->childCount(); j++)
+ for(int j = 0; j < pItem->childCount(); j++)
{
- if (KviQString::equalCI(pItem->child(j)->text(0),lNamespaces.at(i)))
+ if(KviQString::equalCI(pItem->child(j)->text(0), lNamespaces.at(i)))
{
- pItem=( ClassEditorTreeWidgetItem *)pItem->child(j);
+ pItem = (ClassEditorTreeWidgetItem *)pItem->child(j);
bFound = true;
break;
}
@@ -320,18 +319,18 @@ ClassEditorTreeWidgetItem * ClassEditorWidget::createFullItem(const QString & sz
ClassEditorTreeWidgetItem * pItem = findTopLevelItem(lNamespaces.at(0));
if(pItem)
return pItem;
- return new ClassEditorTreeWidgetItem(m_pTreeWidget,ClassEditorTreeWidgetItem::Class,lNamespaces.at(0));
+ return new ClassEditorTreeWidgetItem(m_pTreeWidget, ClassEditorTreeWidgetItem::Class, lNamespaces.at(0));
}
ClassEditorTreeWidgetItem * pItem = findTopLevelItem(lNamespaces.at(0));
if(!pItem)
- pItem = new ClassEditorTreeWidgetItem(m_pTreeWidget,ClassEditorTreeWidgetItem::Namespace,lNamespaces.at(0));
+ pItem = new ClassEditorTreeWidgetItem(m_pTreeWidget, ClassEditorTreeWidgetItem::Namespace, lNamespaces.at(0));
- for(i=1; i < lNamespaces.count()-1; i++)
+ for(i = 1; i < lNamespaces.count() - 1; i++)
{
bFound = false;
- for(int j=0; j < pItem->childCount();j++)
+ for(int j = 0; j < pItem->childCount(); j++)
{
- if(KviQString::equalCI(pItem->child(j)->text(0),lNamespaces.at(i)))
+ if(KviQString::equalCI(pItem->child(j)->text(0), lNamespaces.at(i)))
{
pItem = (ClassEditorTreeWidgetItem *)pItem->child(j);
bFound = true;
@@ -339,9 +338,9 @@ ClassEditorTreeWidgetItem * ClassEditorWidget::createFullItem(const QString & sz
}
}
if(!bFound)
- pItem = new ClassEditorTreeWidgetItem(pItem,ClassEditorTreeWidgetItem::Namespace,lNamespaces.at(i));
+ pItem = new ClassEditorTreeWidgetItem(pItem, ClassEditorTreeWidgetItem::Namespace, lNamespaces.at(i));
}
- return new ClassEditorTreeWidgetItem(pItem,ClassEditorTreeWidgetItem::Class,lNamespaces.at(i));
+ return new ClassEditorTreeWidgetItem(pItem, ClassEditorTreeWidgetItem::Class, lNamespaces.at(i));
}
ClassEditorTreeWidgetItem * ClassEditorWidget::createFullNamespace(const QString & szFullName)
@@ -354,16 +353,16 @@ ClassEditorTreeWidgetItem * ClassEditorWidget::createFullNamespace(const QString
return nullptr;
ClassEditorTreeWidgetItem * pItem = findTopLevelItem(lNamespaces.at(0));
if(!pItem)
- pItem = new ClassEditorTreeWidgetItem(m_pTreeWidget,ClassEditorTreeWidgetItem::Namespace,lNamespaces.at(0));
+ pItem = new ClassEditorTreeWidgetItem(m_pTreeWidget, ClassEditorTreeWidgetItem::Namespace, lNamespaces.at(0));
if(lNamespaces.count() == 1)
return pItem;
- for(i=1; i < lNamespaces.count(); i++)
+ for(i = 1; i < lNamespaces.count(); i++)
{
bFound = false;
- for(int j=0;j<pItem->childCount();j++)
+ for(int j = 0; j < pItem->childCount(); j++)
{
- if(KviQString::equalCI(pItem->child(j)->text(0),lNamespaces.at(i)) && (( ClassEditorTreeWidgetItem *)pItem->child(j))->isNamespace())
+ if(KviQString::equalCI(pItem->child(j)->text(0), lNamespaces.at(i)) && ((ClassEditorTreeWidgetItem *)pItem->child(j))->isNamespace())
{
pItem = (ClassEditorTreeWidgetItem *)pItem->child(j);
bFound = true;
@@ -371,7 +370,7 @@ ClassEditorTreeWidgetItem * ClassEditorWidget::createFullNamespace(const QString
}
}
if(!bFound)
- pItem = new ClassEditorTreeWidgetItem(pItem,ClassEditorTreeWidgetItem::Namespace,lNamespaces.at(i));
+ pItem = new ClassEditorTreeWidgetItem(pItem, ClassEditorTreeWidgetItem::Namespace, lNamespaces.at(i));
}
return pItem;
}
@@ -381,41 +380,41 @@ void ClassEditorWidget::oneTimeSetup()
QStringList sl;
QString szClassName;
QString szPath;
- g_pApp->getLocalKvircDirectory(szPath,KviApplication::Classes);
+ g_pApp->getLocalKvircDirectory(szPath, KviApplication::Classes);
QDir d(szPath);
QString szExtension = QString("*%1").arg(KVI_FILEEXTENSION_SCRIPT); // *.kvs
sl = d.entryList(QStringList(szExtension), QDir::Files | QDir::NoDotAndDotDot);
g_pModuleManager->getModule("objects");
- KviPointerHashTableIterator<QString,KviKvsObjectClass> it(*KviKvsKernel::instance()->objectController()->classDict());
+ KviPointerHashTableIterator<QString, KviKvsObjectClass> it(*KviKvsKernel::instance()->objectController()->classDict());
KviKvsObjectClass * pClass = nullptr;
ClassEditorTreeWidgetItem * pClassItem = nullptr;
while(KviKvsObjectClass * pClass = it.current())
{
if(pClass->isBuiltin())
- m_pClasses->insert(it.currentKey(),0);
+ m_pClasses->insert(it.currentKey(), 0);
else
{
QString szTmp;
szTmp = it.currentKey();
- szTmp.replace("::","--");
+ szTmp.replace("::", "--");
szTmp.append(".kvs");
if(sl.indexOf(szTmp) == -1)
{
szClassName = it.currentKey();
pClassItem = createFullItem(szClassName);
- createFullClass(it.current(),pClassItem,szClassName);
+ createFullClass(it.current(), pClassItem, szClassName);
}
}
++it;
}
- for(int i=0; i < sl.count(); i++)
+ for(int i = 0; i < sl.count(); i++)
{
szClassName = sl.at(i);
- szClassName.replace("--","::");
+ szClassName.replace("--", "::");
szClassName.chop(4);
pClassItem = createFullItem(szClassName);
pClass = KviKvsKernel::instance()->objectController()->lookupClass(szClassName);
@@ -423,14 +422,14 @@ void ClassEditorWidget::oneTimeSetup()
createFullClass(pClass, pClassItem, szClassName);
}
loadNotBuiltClasses();
- connect(m_pTreeWidget,SIGNAL(currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)),this,SLOT(currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)));
+ connect(m_pTreeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
m_pTreeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
- connect(m_pTreeWidget,SIGNAL(customContextMenuRequested(const QPoint &)),this,SLOT(customContextMenuRequested(const QPoint &)));
+ connect(m_pTreeWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(customContextMenuRequested(const QPoint &)));
}
void ClassEditorWidget::createFullClass(KviKvsObjectClass * pClass, ClassEditorTreeWidgetItem * pClassItem, const QString & szClassName)
{
- KviPointerHashTableIterator<QString,KviKvsObjectFunctionHandler> it(* pClass->getHandlers());
+ KviPointerHashTableIterator<QString, KviKvsObjectFunctionHandler> it(*pClass->getHandlers());
QStringList szFunctionsList;
while(it.current())
{
@@ -438,19 +437,20 @@ void ClassEditorWidget::createFullClass(KviKvsObjectClass * pClass, ClassEditorT
++it;
}
szFunctionsList.sort();
- ClassEditorTreeWidgetItem *pFunctionItem;
- m_pClasses->insert(szClassName,pClassItem);
+ ClassEditorTreeWidgetItem * pFunctionItem;
+ m_pClasses->insert(szClassName, pClassItem);
KviKvsObjectClass * pParentClass = pClass->parentClass();
pClassItem->setInheritsClass(pParentClass->name());
- for(int i=0;i<szFunctionsList.count();i++)
+ for(int i = 0; i < szFunctionsList.count(); i++)
{
QString szCode;
- KviKvsObjectFunctionHandler *pHandler=pClass->lookupFunctionHandler(szFunctionsList.at(i));
- if (pClass->isScriptHandler(szFunctionsList.at(i)) && !pHandler->isClone())
+ KviKvsObjectFunctionHandler * pHandler = pClass->lookupFunctionHandler(szFunctionsList.at(i));
+ if(pClass->isScriptHandler(szFunctionsList.at(i)) && !pHandler->isClone())
{
- pFunctionItem=findFunction(szFunctionsList.at(i), pClassItem);
- if(!pFunctionItem) pFunctionItem = new ClassEditorTreeWidgetItem(pClassItem,ClassEditorTreeWidgetItem::Method,szFunctionsList.at(i));
- pClass->getFunctionCode(szCode,*pHandler);
+ pFunctionItem = findFunction(szFunctionsList.at(i), pClassItem);
+ if(!pFunctionItem)
+ pFunctionItem = new ClassEditorTreeWidgetItem(pClassItem, ClassEditorTreeWidgetItem::Method, szFunctionsList.at(i));
+ pClass->getFunctionCode(szCode, *pHandler);
pFunctionItem->setBuffer(szCode);
pFunctionItem->setReminder(pClass->reminder(pHandler));
if(pHandler->flags() & KviKvsObjectFunctionHandler::Internal)
@@ -459,7 +459,6 @@ void ClassEditorWidget::createFullClass(KviKvsObjectClass * pClass, ClassEditorT
}
}
-
/*
void ClassEditorWidget::classRefresh(const QString & szName)
{
@@ -506,15 +505,15 @@ void ClassEditorWidget::renameFunction()
QString szFunctionName = pFunction->name();
QString szReminder = pFunction->reminder();
QString szNewReminder = szReminder;
- ClassEditorTreeWidgetItem * pParentClass = (ClassEditorTreeWidgetItem *) pFunction->parent();
+ ClassEditorTreeWidgetItem * pParentClass = (ClassEditorTreeWidgetItem *)pFunction->parent();
QString szNewFunctionName = szFunctionName;
bool bInternal = pFunction->isInternalFunction();
- if(!askForFunction(szNewFunctionName,szNewReminder,&bInternal,szClassName,true))
+ if(!askForFunction(szNewFunctionName, szNewReminder, &bInternal, szClassName, true))
return;
- if(KviQString::equalCS(szFunctionName,szNewFunctionName) && bInternal == pFunction->isInternalFunction())
+ if(KviQString::equalCS(szFunctionName, szNewFunctionName) && bInternal == pFunction->isInternalFunction())
{
- if(!KviQString::equalCS(szNewReminder,szReminder))
+ if(!KviQString::equalCS(szNewReminder, szReminder))
{
pFunction->setReminder(szNewReminder);
KviKvsObjectClass * pClass = KviKvsKernel::instance()->objectController()->lookupClass(szClassName);
@@ -523,22 +522,24 @@ void ClassEditorWidget::renameFunction()
KviKvsObjectFunctionHandler * pHandler = pClass->lookupFunctionHandler(szFunctionName);
if(pHandler)
{
- pClass->setReminder(szNewReminder,pHandler);
+ pClass->setReminder(szNewReminder, pHandler);
QString szPath;
QString szFileName = szClassName.toLower();
szFileName += ".kvs";
- szFileName.replace("::","--");
- g_pApp->getLocalKvircDirectory(szPath,KviApplication::Classes,szFileName);
+ szFileName.replace("::", "--");
+ g_pApp->getLocalKvircDirectory(szPath, KviApplication::Classes, szFileName);
pClass->save(szPath);
}
}
- currentItemChanged(pFunction,pFunction);
- } else {
+ currentItemChanged(pFunction, pFunction);
+ }
+ else
+ {
g_pClassEditorModule->lock();
QMessageBox::information(this,
- __tr2qs_ctx("Name Already Exists - KVIrc","editor"),
- __tr2qs_ctx("This function name is already in use. Please choose another one.","editor"),
- __tr2qs_ctx("OK, Let me try again...","editor"));
+ __tr2qs_ctx("Name Already Exists - KVIrc", "editor"),
+ __tr2qs_ctx("This function name is already in use. Please choose another one.", "editor"),
+ __tr2qs_ctx("OK, Let me try again...", "editor"));
g_pClassEditorModule->unlock();
return;
}
@@ -546,24 +547,24 @@ void ClassEditorWidget::renameFunction()
pFunction->setName(szNewFunctionName);
pFunction->setReminder(szNewReminder);
- currentItemChanged(pFunction,pFunction);
+ currentItemChanged(pFunction, pFunction);
pFunction->setInternalFunction(bInternal);
pParentClass->setClassNotBuilt(true);
KviPointerList<ClassEditorTreeWidgetItem> lInheritedClasses;
lInheritedClasses.setAutoDelete(false);
- searchInheritedClasses(szClassName,lInheritedClasses);
- for(unsigned int i=0; i < lInheritedClasses.count(); i++)
+ searchInheritedClasses(szClassName, lInheritedClasses);
+ for(unsigned int i = 0; i < lInheritedClasses.count(); i++)
lInheritedClasses.at(i)->setClassNotBuilt(true);
activateItem(pFunction);
}
ClassEditorTreeWidgetItem * ClassEditorWidget::findFunction(const QString & szFunctionName, ClassEditorTreeWidgetItem * pClass)
{
- for(int i=0; i < pClass->childCount(); i++)
+ for(int i = 0; i < pClass->childCount(); i++)
{
- if(KviQString::equalCI(szFunctionName,((ClassEditorTreeWidgetItem *)pClass->child(i))->name()))
- return (ClassEditorTreeWidgetItem *) pClass->child(i);
+ if(KviQString::equalCI(szFunctionName, ((ClassEditorTreeWidgetItem *)pClass->child(i))->name()))
+ return (ClassEditorTreeWidgetItem *)pClass->child(i);
}
return nullptr;
}
@@ -576,7 +577,8 @@ void ClassEditorWidget::renameItem()
renameClass(m_pLastEditedItem);
else if(m_pLastEditedItem->isNamespace())
renameNamespace(m_pLastEditedItem);
- else {
+ else
+ {
// is function
ClassEditorTreeWidgetItem * pParent = (ClassEditorTreeWidgetItem *)m_pLastEditedItem->parent();
if(pParent->isClass())
@@ -591,16 +593,16 @@ void ClassEditorWidget::renameClass(ClassEditorTreeWidgetItem * pClassItem)
QString szInheritsClassName = pClassItem->inheritsClass();
QString szNewInheritsClassName = szInheritsClassName;
- bool bOk = askForClassName(szNewClassName,szNewInheritsClassName,true);
+ bool bOk = askForClassName(szNewClassName, szNewInheritsClassName, true);
if(!bOk)
return;
- if(classExists(szNewClassName) && KviQString::equalCS(szClassName,szNewClassName) && KviQString::equalCS(szInheritsClassName,szNewInheritsClassName))
+ if(classExists(szNewClassName) && KviQString::equalCS(szClassName, szNewClassName) && KviQString::equalCS(szInheritsClassName, szNewInheritsClassName))
{
g_pClassEditorModule->lock();
QMessageBox::information(this,
- __tr2qs_ctx("Name Already Exists - KVIrc","editor"),
- __tr2qs_ctx("This class name is already in use. Please choose another one.","editor"),
- __tr2qs_ctx("OK, Let me try again...","editor"));
+ __tr2qs_ctx("Name Already Exists - KVIrc", "editor"),
+ __tr2qs_ctx("This class name is already in use. Please choose another one.", "editor"),
+ __tr2qs_ctx("OK, Let me try again...", "editor"));
g_pClassEditorModule->unlock();
return;
}
@@ -621,20 +623,22 @@ void ClassEditorWidget::renameClass(ClassEditorTreeWidgetItem * pClassItem)
if(szNewClassName.contains("::"))
{
pNewItem = createFullNamespace(szNewClassName.left(szNewClassName.lastIndexOf("::")));
- pClassItem->setName(szNewClassName.section("::",-1,-1));
+ pClassItem->setName(szNewClassName.section("::", -1, -1));
pNewItem->addChild(pClassItem);
- } else {
+ }
+ else
+ {
pClassItem->setName(szNewClassName);
m_pTreeWidget->addTopLevelItem(pClassItem);
}
- m_pClasses->insert(szNewClassName,pClassItem);
+ m_pClasses->insert(szNewClassName, pClassItem);
pClassItem->setInheritsClass(szNewInheritsClassName);
pClassItem->setClassNotBuilt(true);
KviPointerList<ClassEditorTreeWidgetItem> lInheritedClasses;
lInheritedClasses.setAutoDelete(false);
- searchInheritedClasses(szClassName,lInheritedClasses);
- for(unsigned int i=0; i < lInheritedClasses.count(); i++)
+ searchInheritedClasses(szClassName, lInheritedClasses);
+ for(unsigned int i = 0; i < lInheritedClasses.count(); i++)
{
lInheritedClasses.at(i)->setClassNotBuilt(true);
lInheritedClasses.at(i)->setExpanded(true);
@@ -645,12 +649,14 @@ void ClassEditorWidget::renameClass(ClassEditorTreeWidgetItem * pClassItem)
{
activateItem(pNewItem);
pNewItem->setExpanded(true);
- } else {
+ }
+ else
+ {
activateItem(pClassItem);
pClassItem->setExpanded(true);
}
- qDebug("delete class %s caused by rename",szClassName.toUtf8().data());
+ qDebug("delete class %s caused by rename", szClassName.toUtf8().data());
KviKvsObjectClass * pClass = KviKvsKernel::instance()->objectController()->lookupClass(szClassName);
if(pClass)
KviKvsKernel::instance()->objectController()->deleteClass(pClass);
@@ -659,9 +665,10 @@ void ClassEditorWidget::renameClass(ClassEditorTreeWidgetItem * pClassItem)
void ClassEditorWidget::cutItem(ClassEditorTreeWidgetItem * pItem)
{
int iIdx = m_pTreeWidget->indexOfTopLevelItem(pItem);
- if(iIdx!=-1)
+ if(iIdx != -1)
m_pTreeWidget->takeTopLevelItem(iIdx);
- else {
+ else
+ {
ClassEditorTreeWidgetItem * pParent = (ClassEditorTreeWidgetItem *)pItem->parent();
pParent->removeChild(pItem);
}
@@ -671,9 +678,9 @@ void ClassEditorWidget::renameNamespace(ClassEditorTreeWidgetItem * pOldNamespac
{
QString szOldNameSpaceName = buildFullClassName(m_pLastEditedItem);
QString szNewNameSpaceName;
- if(!askForNamespaceName(__tr2qs_ctx("Enter a New Name - KVIrc","editor"),__tr2qs_ctx("Please enter the new name for the namespace.","editor"),szOldNameSpaceName,szNewNameSpaceName))
+ if(!askForNamespaceName(__tr2qs_ctx("Enter a New Name - KVIrc", "editor"), __tr2qs_ctx("Please enter the new name for the namespace.", "editor"), szOldNameSpaceName, szNewNameSpaceName))
return;
- if(KviQString::equalCI(szOldNameSpaceName,szNewNameSpaceName))
+ if(KviQString::equalCI(szOldNameSpaceName, szNewNameSpaceName))
return;
ClassEditorTreeWidgetItem * pNewItem = findItem(szNewNameSpaceName);
if(pNewItem)
@@ -682,34 +689,38 @@ void ClassEditorWidget::renameNamespace(ClassEditorTreeWidgetItem * pOldNamespac
if(pNewItem->isClass())
{
QMessageBox::information(this,
- __tr2qs_ctx("Name Already Exists - KVIrc","editor"),
- __tr2qs_ctx("This class name is already in use. Please choose another one.","editor"),
- __tr2qs_ctx("OK, Let me try again...","editor"));
- } else {
+ __tr2qs_ctx("Name Already Exists - KVIrc", "editor"),
+ __tr2qs_ctx("This class name is already in use. Please choose another one.", "editor"),
+ __tr2qs_ctx("OK, Let me try again...", "editor"));
+ }
+ else
+ {
QMessageBox::information(this,
- __tr2qs_ctx("Name Already Exists - KVIrc","editor"),
- __tr2qs_ctx("This namespace name is already in use. Please choose another one.","editor"),
- __tr2qs_ctx("OK, Let me try again...","editor"));
+ __tr2qs_ctx("Name Already Exists - KVIrc", "editor"),
+ __tr2qs_ctx("This namespace name is already in use. Please choose another one.", "editor"),
+ __tr2qs_ctx("OK, Let me try again...", "editor"));
}
g_pClassEditorModule->unlock();
return;
}
KviPointerList<ClassEditorTreeWidgetItem> pList;
pList.setAutoDelete(false);
- appendAllClassItemsRecursive(&pList,pOldNamespaceItem);
+ appendAllClassItemsRecursive(&pList, pOldNamespaceItem);
cutItem(pOldNamespaceItem);
if(szNewNameSpaceName.contains("::"))
{
- pNewItem=createFullNamespace(szNewNameSpaceName.left(szNewNameSpaceName.lastIndexOf("::")));
- pOldNamespaceItem->setName(szNewNameSpaceName.section("::",-1,-1));
+ pNewItem = createFullNamespace(szNewNameSpaceName.left(szNewNameSpaceName.lastIndexOf("::")));
+ pOldNamespaceItem->setName(szNewNameSpaceName.section("::", -1, -1));
pNewItem->addChild(pOldNamespaceItem);
- } else {
+ }
+ else
+ {
m_pTreeWidget->addTopLevelItem(pOldNamespaceItem);
pOldNamespaceItem->setName(szNewNameSpaceName);
}
- for(unsigned int u=0; u < pList.count(); u++)
+ for(unsigned int u = 0; u < pList.count(); u++)
{
- KviPointerHashTableEntry<QString,ClassEditorTreeWidgetItem> * pEntry = m_pClasses->findRef(pList.at(u));
+ KviPointerHashTableEntry<QString, ClassEditorTreeWidgetItem> * pEntry = m_pClasses->findRef(pList.at(u));
if(pEntry)
{
KviPointerList<ClassEditorTreeWidgetItem> lInheritedClasses;
@@ -717,15 +728,15 @@ void ClassEditorWidget::renameNamespace(ClassEditorTreeWidgetItem * pOldNamespac
QString szOldName = pEntry->key();
QString szNewName = buildFullClassName(pList.at(u));
- searchInheritedClasses(szOldName,lInheritedClasses);
- for(unsigned int v=0; v < lInheritedClasses.count(); v++)
+ searchInheritedClasses(szOldName, lInheritedClasses);
+ for(unsigned int v = 0; v < lInheritedClasses.count(); v++)
{
lInheritedClasses.at(v)->setClassNotBuilt(true);
lInheritedClasses.at(v)->setExpanded(true);
lInheritedClasses.at(v)->setInheritsClass(szNewName);
}
m_pClasses->removeRef(pList.at(u));
- m_pClasses->insert(szNewName,pList.at(u));
+ m_pClasses->insert(szNewName, pList.at(u));
pList.at(u)->setClassNotBuilt(true);
KviKvsObjectClass * pClass = KviKvsKernel::instance()->objectController()->lookupClass(szOldName);
@@ -738,7 +749,9 @@ void ClassEditorWidget::renameNamespace(ClassEditorTreeWidgetItem * pOldNamespac
{
activateItem(pNewItem);
pNewItem->setExpanded(true);
- } else {
+ }
+ else
+ {
activateItem(pOldNamespaceItem);
pOldNamespaceItem->setExpanded(true);
}
@@ -764,7 +777,7 @@ void ClassEditorWidget::currentItemChanged(QTreeWidgetItem * pTree, QTreeWidgetI
m_pLastEditedItem = (ClassEditorTreeWidgetItem *)pTree;
if(!m_pLastEditedItem)
{
- m_pClassNameLabel->setText(__tr2qs_ctx("No item selected","editor"));
+ m_pClassNameLabel->setText(__tr2qs_ctx("No item selected", "editor"));
m_pClassNameRenameButton->setEnabled(false);
m_pEditor->setText("");
m_pEditor->setEnabled(false);
@@ -781,32 +794,32 @@ void ClassEditorWidget::currentItemChanged(QTreeWidgetItem * pTree, QTreeWidgetI
if(m_pLastEditedItem->isNamespace())
{
- QString szLabelText = __tr2qs_ctx("Namespace","editor");
+ QString szLabelText = __tr2qs_ctx("Namespace", "editor");
szLabelText += ": <b>";
szLabelText += szClassName;
szLabelText += "</b>";
m_pClassNameLabel->setText(szLabelText);
m_pClassNameRenameButton->setEnabled(true);
- m_pFunctionNameRenameButton->setEnabled(false);
+ m_pFunctionNameRenameButton->setEnabled(false);
//m_pinheritsClassNameLabel->setText("");
- m_pFunctionNameLabel->setText("");
+ m_pFunctionNameLabel->setText("");
m_pEditor->setText("");
m_pEditor->setEnabled(false);
m_pTreeWidget->setFocus();
return;
}
- QString szLabelText = __tr2qs_ctx("Class","editor");
+ QString szLabelText = __tr2qs_ctx("Class", "editor");
szLabelText += ": <b>";
szLabelText += szClassName;
szLabelText += "</b>, ";
- szLabelText += __tr2qs_ctx("inherits from class ","editor");
+ szLabelText += __tr2qs_ctx("inherits from class ", "editor");
szLabelText += ": <b>";
szLabelText += pClassItem->inheritsClass();
szLabelText += "</b>";
m_pClassNameLabel->setText(szLabelText);
- szLabelText = __tr2qs_ctx("Member Function","editor");
+ szLabelText = __tr2qs_ctx("Member Function", "editor");
if(m_pLastEditedItem->isMethod())
{
szLabelText += ": <b>";
@@ -815,8 +828,9 @@ void ClassEditorWidget::currentItemChanged(QTreeWidgetItem * pTree, QTreeWidgetI
m_pFunctionNameRenameButton->setEnabled(true);
if(m_pLastEditedItem->reminder().isEmpty())
m_pReminderLabel->hide();
- else {
- QString szReminderText =__tr2qs_ctx("Reminder text.","editor");
+ else
+ {
+ QString szReminderText = __tr2qs_ctx("Reminder text.", "editor");
szReminderText += ": <b>";
szReminderText += m_pLastEditedItem->reminder();
szReminderText += "</b>";
@@ -827,7 +841,9 @@ void ClassEditorWidget::currentItemChanged(QTreeWidgetItem * pTree, QTreeWidgetI
m_pFunctionNameLabel->setText(szLabelText);
m_pFunctionNameLabel->show();
m_pFunctionNameRenameButton->show();
- } else {
+ }
+ else
+ {
m_pReminderLabel->hide();
m_pFunctionNameLabel->hide();
m_pClassNameRenameButton->setEnabled(true);
@@ -841,23 +857,23 @@ void ClassEditorWidget::currentItemChanged(QTreeWidgetItem * pTree, QTreeWidgetI
m_pTreeWidget->setFocus();
QString szBuffer;
QStringList szFunctionsList;
- KviPointerHashTable<QString,ClassEditorTreeWidgetItem> lFunctions;
+ KviPointerHashTable<QString, ClassEditorTreeWidgetItem> lFunctions;
lFunctions.setAutoDelete(false);
ClassEditorTreeWidgetItem * pItem = 0;
- for(int i=0; i < pTree->childCount(); i++)
+ for(int i = 0; i < pTree->childCount(); i++)
{
pItem = ((ClassEditorTreeWidgetItem *)pTree->child(i));
szFunctionsList.append(pItem->name());
- lFunctions.insert(pItem->name(),pItem);
+ lFunctions.insert(pItem->name(), pItem);
}
szFunctionsList.sort();
- for(int i=0; i < szFunctionsList.count(); i++)
+ for(int i = 0; i < szFunctionsList.count(); i++)
{
szBuffer += "Member Function: <b>$" + szFunctionsList.at(i) + "</b><br>";
if(!lFunctions.find(szFunctionsList.at(i))->reminder().isEmpty())
- szBuffer+="Parameters reminder: "+lFunctions.find(szFunctionsList.at(i))->reminder()+"<br>";
- szBuffer+="<br>";
+ szBuffer += "Parameters reminder: " + lFunctions.find(szFunctionsList.at(i))->reminder() + "<br>";
+ szBuffer += "<br>";
}
m_pEditor->setUnHighlightedText(szBuffer);
m_pEditor->setReadOnly(true);
@@ -876,107 +892,109 @@ void ClassEditorWidget::customContextMenuRequested(QPoint pnt)
m_pLastClickedItem = (ClassEditorTreeWidgetItem *)m_pTreeWidget->itemAt(pnt);
- QAction *pAction = m_pContextPopup->addAction(
- *(g_pIconManager->getSmallIcon(KviIconManager::NameSpace)),
- __tr2qs_ctx("Add Namespace","editor"),
- this,SLOT(newNamespace()));
+ QAction * pAction = m_pContextPopup->addAction(
+ *(g_pIconManager->getSmallIcon(KviIconManager::NameSpace)),
+ __tr2qs_ctx("Add Namespace", "editor"),
+ this, SLOT(newNamespace()));
if(!m_pLastClickedItem)
- pAction->setEnabled(true);
+ pAction->setEnabled(true);
else
- pAction->setEnabled(m_pLastClickedItem->isNamespace());
+ pAction->setEnabled(m_pLastClickedItem->isNamespace());
- pAction = m_pContextPopup->addAction(
- *(g_pIconManager->getSmallIcon(KviIconManager::Class)),
- __tr2qs_ctx("Add Class","editor"),
- this,SLOT(newClass()));
+ pAction = m_pContextPopup->addAction(
+ *(g_pIconManager->getSmallIcon(KviIconManager::Class)),
+ __tr2qs_ctx("Add Class", "editor"),
+ this, SLOT(newClass()));
if(!m_pLastClickedItem)
- pAction->setEnabled(true);
+ pAction->setEnabled(true);
else
- pAction->setEnabled(m_pLastClickedItem->isNamespace());
+ pAction->setEnabled(m_pLastClickedItem->isNamespace());
- pAction = m_pContextPopup->addAction(
- *(g_pIconManager->getSmallIcon(KviIconManager::Function)),
- __tr2qs_ctx("Add Member Function","editor"),
- this,SLOT(newMemberFunction()));
+ pAction = m_pContextPopup->addAction(
+ *(g_pIconManager->getSmallIcon(KviIconManager::Function)),
+ __tr2qs_ctx("Add Member Function", "editor"),
+ this, SLOT(newMemberFunction()));
if(!m_pLastClickedItem)
- pAction->setEnabled(false);
+ pAction->setEnabled(false);
else
- pAction->setEnabled(m_pLastClickedItem->isClass()| m_pLastClickedItem->isMethod());
+ pAction->setEnabled(m_pLastClickedItem->isClass() | m_pLastClickedItem->isMethod());
bool bHasItems = m_pTreeWidget->topLevelItemCount();
bool bHasSelected = hasSelectedItems();
- m_pContextPopup->addSeparator();
+ m_pContextPopup->addSeparator();
- pAction = m_pContextPopup->addAction(
- *(g_pIconManager->getSmallIcon(KviIconManager::Discard)),
- __tr2qs_ctx("Remove Selected","editor"),
- this,SLOT(removeSelectedItems()));
- pAction->setEnabled(bHasSelected);
+ pAction = m_pContextPopup->addAction(
+ *(g_pIconManager->getSmallIcon(KviIconManager::Discard)),
+ __tr2qs_ctx("Remove Selected", "editor"),
+ this, SLOT(removeSelectedItems()));
+ pAction->setEnabled(bHasSelected);
- m_pContextPopup->addSeparator();
+ m_pContextPopup->addSeparator();
m_pContextPopup->addAction(
- *(g_pIconManager->getSmallIcon(KviIconManager::Save)),
- __tr2qs_ctx("Export Selected...","editor"),
- this,SLOT(exportSelected()));
- pAction->setEnabled(bHasSelected);
+ *(g_pIconManager->getSmallIcon(KviIconManager::Save)),
+ __tr2qs_ctx("Export Selected...", "editor"),
+ this, SLOT(exportSelected()));
+ pAction->setEnabled(bHasSelected);
m_pContextPopup->addAction(
- *(g_pIconManager->getSmallIcon(KviIconManager::Save)),
- __tr2qs_ctx("Export Selected in Single Files...","editor"),
- this,SLOT(exportSelectedSepFiles()));
+ *(g_pIconManager->getSmallIcon(KviIconManager::Save)),
+ __tr2qs_ctx("Export Selected in Single Files...", "editor"),
+ this, SLOT(exportSelectedSepFiles()));
- pAction->setEnabled(bHasSelected);
+ pAction->setEnabled(bHasSelected);
m_pContextPopup->addAction(
- *(g_pIconManager->getSmallIcon(KviIconManager::Save)),
- __tr2qs_ctx("Export All...","editor"),
- this,SLOT(exportAll()));
- pAction->setEnabled(bHasItems);
+ *(g_pIconManager->getSmallIcon(KviIconManager::Save)),
+ __tr2qs_ctx("Export All...", "editor"),
+ this, SLOT(exportAll()));
+ pAction->setEnabled(bHasItems);
- m_pContextPopup->addSeparator();
+ m_pContextPopup->addSeparator();
m_pContextPopup->addAction(
- *(g_pIconManager->getSmallIcon(KviIconManager::Search)),
- __tr2qs_ctx("Find in Classes...","editor"),
- this,SLOT(slotFind()));
- pAction->setEnabled(bHasItems);
+ *(g_pIconManager->getSmallIcon(KviIconManager::Search)),
+ __tr2qs_ctx("Find in Classes...", "editor"),
+ this, SLOT(slotFind()));
+ pAction->setEnabled(bHasItems);
m_pContextPopup->addAction(
- *(g_pIconManager->getSmallIcon(KviIconManager::NameSpace)),
- __tr2qs_ctx("Collapse All Items","editor"),
- this,SLOT(slotCollapseItems()));
+ *(g_pIconManager->getSmallIcon(KviIconManager::NameSpace)),
+ __tr2qs_ctx("Collapse All Items", "editor"),
+ this, SLOT(slotCollapseItems()));
- pAction->setEnabled(bHasItems);
+ pAction->setEnabled(bHasItems);
m_pContextPopup->popup(m_pTreeWidget->mapToGlobal(pnt));
}
void ClassEditorWidget::searchReplace(const QString & szSearch, bool bReplace, const QString & szReplace)
{
- KviPointerHashTableIterator<QString,ClassEditorTreeWidgetItem> it (*m_pClasses);
+ KviPointerHashTableIterator<QString, ClassEditorTreeWidgetItem> it(*m_pClasses);
while(it.current())
{
ClassEditorTreeWidgetItem * pItem = it.current();
- for(int j=0; j < pItem->childCount(); j++)
+ for(int j = 0; j < pItem->childCount(); j++)
{
bool bOpened = false;
- if(((ClassEditorTreeWidgetItem *)pItem->child(j))->buffer().indexOf(szSearch,0,Qt::CaseInsensitive) != -1)
+ if(((ClassEditorTreeWidgetItem *)pItem->child(j))->buffer().indexOf(szSearch, 0, Qt::CaseInsensitive) != -1)
{
- pItem->child(j)->setBackground(0, QColor(255,0,0,128));
+ pItem->child(j)->setBackground(0, QColor(255, 0, 0, 128));
if(bReplace)
{
- QString &buffer=(QString &)((ClassEditorTreeWidgetItem *)pItem->child(j))->buffer();
+ QString & buffer = (QString &)((ClassEditorTreeWidgetItem *)pItem->child(j))->buffer();
pItem->setClassNotBuilt(true);
- buffer.replace(szSearch,szReplace,Qt::CaseInsensitive);
+ buffer.replace(szSearch, szReplace, Qt::CaseInsensitive);
}
if(!bOpened)
{
openParentItems(pItem->child(j));
bOpened = true;
}
- } else {
- pItem->child(j)->setBackground(0, QColor(255,255,255));
+ }
+ else
+ {
+ pItem->child(j)->setBackground(0, QColor(255, 255, 255));
}
}
++it;
@@ -989,11 +1007,11 @@ void ClassEditorWidget::slotFind()
bool bOk;
QString szSearch = QInputDialog::getText(this,
- __tr2qs_ctx("Find In Classes","editor"),
- __tr2qs_ctx("Please enter the text to be searched for. The matching function will be highlighted.","editor"),
- QLineEdit::Normal,
- "",
- &bOk);
+ __tr2qs_ctx("Find In Classes", "editor"),
+ __tr2qs_ctx("Please enter the text to be searched for. The matching function will be highlighted.", "editor"),
+ QLineEdit::Normal,
+ "",
+ &bOk);
g_pClassEditorModule->unlock();
if(!bOk)
@@ -1013,7 +1031,7 @@ void ClassEditorWidget::recursiveCollapseItems(ClassEditorTreeWidgetItem * pItem
{
if(!pItem)
return;
- for(int i=0; i < pItem->childCount(); i++)
+ for(int i = 0; i < pItem->childCount(); i++)
{
if(pItem->child(i)->childCount())
{
@@ -1025,7 +1043,7 @@ void ClassEditorWidget::recursiveCollapseItems(ClassEditorTreeWidgetItem * pItem
void ClassEditorWidget::slotCollapseItems()
{
- for(int i=0; i < m_pTreeWidget->topLevelItemCount(); i++)
+ for(int i = 0; i < m_pTreeWidget->topLevelItemCount(); i++)
{
if(m_pTreeWidget->topLevelItem(i)->childCount())
{
@@ -1038,7 +1056,7 @@ void ClassEditorWidget::slotCollapseItems()
void ClassEditorWidget::slotReplaceAll(const QString & szFind, const QString & szReplace)
{
m_pEditor->setFindText(szReplace);
- searchReplace(szFind,true,szReplace);
+ searchReplace(szFind, true, szReplace);
/*
for (int i=0;i<m_pTreeWidget->topLevelItemCount();i++)
{
@@ -1061,7 +1079,7 @@ void ClassEditorWidget::exportClassBuffer(QString & szBuffer, ClassEditorTreeWid
szBuffer += pItem->inheritsClass();
}
szBuffer += "\")\n{\n";
- for(int i=0; i < pItem->childCount(); i++)
+ for(int i = 0; i < pItem->childCount(); i++)
{
ClassEditorTreeWidgetItem * pFunction = (ClassEditorTreeWidgetItem *)pItem->child(i);
if(pFunction->isMethod())
@@ -1072,7 +1090,7 @@ void ClassEditorWidget::exportClassBuffer(QString & szBuffer, ClassEditorTreeWid
szBuffer += "function ";
szBuffer += pFunction->name();
szBuffer += "(" + pFunction->reminder() + ")\n";
- QString szCode=pFunction->buffer();
+ QString szCode = pFunction->buffer();
KviCommandFormatter::blockFromBuffer(szCode);
KviCommandFormatter::indent(szCode);
@@ -1089,7 +1107,7 @@ void ClassEditorWidget::exportAll()
void ClassEditorWidget::exportSelectedSepFiles()
{
- exportClasses(true,true);
+ exportClasses(true, true);
}
void ClassEditorWidget::exportSelected()
@@ -1106,21 +1124,20 @@ void ClassEditorWidget::exportSelectionInSinglesFiles(KviPointerList<ClassEditor
if(!pList->first())
{
g_pClassEditorModule->lock();
- QMessageBox::warning(this,__tr2qs_ctx("Warning While Exporting - KVIrc","editor"),__tr2qs_ctx("Must select an entry from the list to export!","editor"),__tr2qs_ctx("OK","editor"));
+ QMessageBox::warning(this, __tr2qs_ctx("Warning While Exporting - KVIrc", "editor"), __tr2qs_ctx("Must select an entry from the list to export!", "editor"), __tr2qs_ctx("OK", "editor"));
g_pClassEditorModule->unlock();
return;
}
g_pClassEditorModule->lock();
if(!KviFileDialog::askForDirectoryName(
- m_szDir,
- __tr2qs_ctx("Choose a Directory - KVIrc","editor"),
- m_szDir,
- QString(),
- false,
- true,
- this
- ))
+ m_szDir,
+ __tr2qs_ctx("Choose a Directory - KVIrc", "editor"),
+ m_szDir,
+ QString(),
+ false,
+ true,
+ this))
{
g_pClassEditorModule->unlock();
return;
@@ -1132,24 +1149,24 @@ void ClassEditorWidget::exportSelectionInSinglesFiles(KviPointerList<ClassEditor
for(ClassEditorTreeWidgetItem * pItem = pList->first(); pItem; pItem = pList->next())
{
QString szTmp;
- exportClassBuffer(szTmp,pItem);
+ exportClassBuffer(szTmp, pItem);
QString szFileName = buildFullClassName(pItem);
szFileName += ".kvs";
- szFileName.replace("::","_");
- QString szCompletePath = m_szDir+szFileName;
+ szFileName.replace("::", "_");
+ QString szCompletePath = m_szDir + szFileName;
if(KviFileUtils::fileExists(szCompletePath) && !bReplaceAll)
{
- QString szMsg = __tr2qs_ctx("The file \"%1\" exists. Do you want to replace it?","editor").arg(szFileName);
- int iRet = QMessageBox::question(this,__tr2qs_ctx("Confirm Replacing File - KVIrc","editor"),szMsg,__tr2qs_ctx("Yes","editor"),__tr2qs_ctx("Yes to All","editor"),__tr2qs_ctx("No","editor"));
+ QString szMsg = __tr2qs_ctx("The file \"%1\" exists. Do you want to replace it?", "editor").arg(szFileName);
+ int iRet = QMessageBox::question(this, __tr2qs_ctx("Confirm Replacing File - KVIrc", "editor"), szMsg, __tr2qs_ctx("Yes", "editor"), __tr2qs_ctx("Yes to All", "editor"), __tr2qs_ctx("No", "editor"));
if(iRet != 2)
{
- KviFileUtils::writeFile(szCompletePath,szTmp);
+ KviFileUtils::writeFile(szCompletePath, szTmp);
if(iRet == 1)
bReplaceAll = true;
}
}
else
- KviFileUtils::writeFile(szCompletePath,szTmp);
+ KviFileUtils::writeFile(szCompletePath, szTmp);
}
g_pClassEditorModule->unlock();
}
@@ -1183,23 +1200,24 @@ void ClassEditorWidget::exportClasses(bool bSelectedOnly, bool bSingleFiles)
for(ClassEditorTreeWidgetItem * pItem = list.first(); pItem; pItem = list.next())
{
pTempItem = pItem;
- if(skiplist.findRef(pItem)!=-1) continue;
- ClassEditorTreeWidgetItem *pParentClass = m_pClasses->find(pItem->inheritsClass());
+ if(skiplist.findRef(pItem) != -1)
+ continue;
+ ClassEditorTreeWidgetItem * pParentClass = m_pClasses->find(pItem->inheritsClass());
KviPointerList<ClassEditorTreeWidgetItem> linkedClasses;
linkedClasses.setAutoDelete(false);
linkedClasses.append(pItem);
while(pParentClass)
{
- if(skiplist.findRef(pParentClass)!=-1)
+ if(skiplist.findRef(pParentClass) != -1)
break;
linkedClasses.append(pParentClass);
pParentClass = m_pClasses->find(pParentClass->inheritsClass());
}
- for(int i = linkedClasses.count()-1; i >= 0; i--)
+ for(int i = linkedClasses.count() - 1; i >= 0; i--)
{
iCount++;
QString szTmp;
- exportClassBuffer(szTmp,linkedClasses.at(i));
+ exportClassBuffer(szTmp, linkedClasses.at(i));
skiplist.append(linkedClasses.at(i));
szOut += szTmp;
szOut += "\n";
@@ -1209,7 +1227,7 @@ void ClassEditorWidget::exportClasses(bool bSelectedOnly, bool bSingleFiles)
if(szOut.isEmpty())
{
g_pClassEditorModule->lock();
- QMessageBox::warning(this,__tr2qs_ctx("Warning While Exporting - KVIrc","editor"),__tr2qs_ctx("The exported class file could be empty: cowardly refusing to write it","editor"),__tr2qs_ctx("OK","editor"));
+ QMessageBox::warning(this, __tr2qs_ctx("Warning While Exporting - KVIrc", "editor"), __tr2qs_ctx("The exported class file could be empty: cowardly refusing to write it", "editor"), __tr2qs_ctx("OK", "editor"));
g_pClassEditorModule->unlock();
return;
}
@@ -1223,45 +1241,45 @@ void ClassEditorWidget::exportClasses(bool bSelectedOnly, bool bSingleFiles)
if(iCount != 1)
szNameFile = "classes";
- else {
+ else
+ {
QString szTmp = buildFullClassName(pTempItem);
- szNameFile = szTmp.replace("::","_");
+ szNameFile = szTmp.replace("::", "_");
}
szName += szNameFile;
szName += ".kvs";
if(!KviFileDialog::askForSaveFileName(
- szFile,
- __tr2qs_ctx("Choose a Filename - KVIrc","editor"),
- szName,
- KVI_FILTER_SCRIPT,
- false,
- true,
- true,
- this
- ))
+ szFile,
+ __tr2qs_ctx("Choose a Filename - KVIrc", "editor"),
+ szName,
+ KVI_FILTER_SCRIPT,
+ false,
+ true,
+ true,
+ this))
{
g_pClassEditorModule->unlock();
return;
}
- m_szDir=QFileInfo(szFile).absolutePath();
+ m_szDir = QFileInfo(szFile).absolutePath();
g_pClassEditorModule->unlock();
- if(!KviFileUtils::writeFile(szFile,szOut))
+ if(!KviFileUtils::writeFile(szFile, szOut))
{
g_pClassEditorModule->lock();
- QMessageBox::warning(this,__tr2qs_ctx("Write to Classes File Failed - KVIrc","editor"),__tr2qs_ctx("Unable to write to the classes file.","editor"),__tr2qs_ctx("OK","editor"));
+ QMessageBox::warning(this, __tr2qs_ctx("Write to Classes File Failed - KVIrc", "editor"), __tr2qs_ctx("Unable to write to the classes file.", "editor"), __tr2qs_ctx("OK", "editor"));
g_pClassEditorModule->unlock();
}
}
void ClassEditorWidget::saveProperties(KviConfigurationFile * pCfg)
{
- pCfg->writeEntry("Sizes",m_pSplitter->sizes());
+ pCfg->writeEntry("Sizes", m_pSplitter->sizes());
QString szName;
if(m_pLastEditedItem)
szName = buildFullClassName(m_pLastEditedItem);
- pCfg->writeEntry("LastClass",szName);
+ pCfg->writeEntry("LastClass", szName);
}
void ClassEditorWidget::loadProperties(KviConfigurationFile * pCfg)
@@ -1269,8 +1287,8 @@ void ClassEditorWidget::loadProperties(KviConfigurationFile * pCfg)
QList<int> def;
def.append(20);
def.append(80);
- m_pSplitter->setSizes(pCfg->readIntListEntry("Sizes",def));
- QString szTmp = pCfg->readEntry("LastClass",QString());
+ m_pSplitter->setSizes(pCfg->readIntListEntry("Sizes", def));
+ QString szTmp = pCfg->readEntry("LastClass", QString());
ClassEditorTreeWidgetItem * pItem = findItem(szTmp);
activateItem(pItem);
@@ -1279,28 +1297,29 @@ void ClassEditorWidget::loadProperties(KviConfigurationFile * pCfg)
void ClassEditorWidget::appendSelectedClassItems(KviPointerList<ClassEditorTreeWidgetItem> * pList)
{
QList<QTreeWidgetItem *> list = m_pTreeWidget->selectedItems();
- for(int i=0; i < list.count(); i++)
+ for(int i = 0; i < list.count(); i++)
{
if(((ClassEditorTreeWidgetItem *)list.at(i))->isClass())
pList->append((ClassEditorTreeWidgetItem *)list.at(i));
- else appendSelectedClassItemsRecursive(pList,list.at(i));
+ else
+ appendSelectedClassItemsRecursive(pList, list.at(i));
}
}
void ClassEditorWidget::appendSelectedClassItemsRecursive(KviPointerList<ClassEditorTreeWidgetItem> * pList, QTreeWidgetItem * pStartFrom)
{
- for(int i=0; i < pStartFrom->childCount(); i++)
+ for(int i = 0; i < pStartFrom->childCount(); i++)
{
if(((ClassEditorTreeWidgetItem *)pStartFrom->child(i))->isClass())
pList->append(((ClassEditorTreeWidgetItem *)pStartFrom->child(i)));
else
- appendSelectedClassItemsRecursive(pList,pStartFrom->child(i));
+ appendSelectedClassItemsRecursive(pList, pStartFrom->child(i));
}
}
void ClassEditorWidget::appendAllClassItems(KviPointerList<ClassEditorTreeWidgetItem> * pList)
{
- KviPointerHashTableIterator<QString,ClassEditorTreeWidgetItem> it (*m_pClasses);
+ KviPointerHashTableIterator<QString, ClassEditorTreeWidgetItem> it(*m_pClasses);
while(it.current())
{
pList->append(it.current());
@@ -1310,25 +1329,27 @@ void ClassEditorWidget::appendAllClassItems(KviPointerList<ClassEditorTreeWidget
void ClassEditorWidget::appendAllClassItemsRecursive(KviPointerList<ClassEditorTreeWidgetItem> * pList, QTreeWidgetItem * pStartFrom)
{
- for(int i=0; i < pStartFrom->childCount(); i++)
+ for(int i = 0; i < pStartFrom->childCount(); i++)
{
if(((ClassEditorTreeWidgetItem *)pStartFrom->child(i))->isClass())
{
pList->append((ClassEditorTreeWidgetItem *)pStartFrom->child(i));
- } else {
- appendAllClassItemsRecursive(pList,pStartFrom->child(i));
+ }
+ else
+ {
+ appendAllClassItemsRecursive(pList, pStartFrom->child(i));
}
}
}
-void ClassEditorWidget::removeItemChildren(ClassEditorTreeWidgetItem * pItem, KviPointerList <ClassEditorTreeWidgetItem> & lRemovedItems)
+void ClassEditorWidget::removeItemChildren(ClassEditorTreeWidgetItem * pItem, KviPointerList<ClassEditorTreeWidgetItem> & lRemovedItems)
{
if(pItem->isClass())
{
KviPointerList<ClassEditorTreeWidgetItem> lInheritedClasses;
lInheritedClasses.setAutoDelete(false);
- searchInheritedClasses(buildFullClassName(pItem),lInheritedClasses);
- for(unsigned int u=0; u < lInheritedClasses.count(); u++)
+ searchInheritedClasses(buildFullClassName(pItem), lInheritedClasses);
+ for(unsigned int u = 0; u < lInheritedClasses.count(); u++)
{
lInheritedClasses.at(u)->setClassNotBuilt(true);
lInheritedClasses.at(u)->setExpanded(true);
@@ -1340,14 +1361,14 @@ void ClassEditorWidget::removeItemChildren(ClassEditorTreeWidgetItem * pItem, Kv
{
ClassEditorTreeWidgetItem * pChild = (ClassEditorTreeWidgetItem *)(pItem->child(0));
if(pChild->childCount())
- removeItemChildren(pChild,lRemovedItems);
+ removeItemChildren(pChild, lRemovedItems);
if(pChild->isClass())
{
m_pClasses->removeRef(pChild);
KviKvsObjectClass * pClass = KviKvsKernel::instance()->objectController()->lookupClass(buildFullClassName(pChild));
if(pClass)
KviKvsKernel::instance()->objectController()->deleteClass(pClass);
- qDebug("removing class %s %p",buildFullClassName(pChild).toUtf8().data(), pClass);
+ qDebug("removing class %s %p", buildFullClassName(pChild).toUtf8().data(), pClass);
}
pItem->removeChild(pChild);
lRemovedItems.append(pItem);
@@ -1355,7 +1376,7 @@ void ClassEditorWidget::removeItemChildren(ClassEditorTreeWidgetItem * pItem, Kv
}
}
-bool ClassEditorWidget::removeItem(ClassEditorTreeWidgetItem * pItem, KviPointerList <ClassEditorTreeWidgetItem> & lRemovedItems, bool * pbYesToAll)
+bool ClassEditorWidget::removeItem(ClassEditorTreeWidgetItem * pItem, KviPointerList<ClassEditorTreeWidgetItem> & lRemovedItems, bool * pbYesToAll)
{
if(!pItem)
return true;
@@ -1367,31 +1388,33 @@ bool ClassEditorWidget::removeItem(ClassEditorTreeWidgetItem * pItem, KviPointer
saveLastEditedItem();
if(pItem->isClass())
{
- szMsg = QString(__tr2qs_ctx("Do you really want to remove the class \"%1\"?","editor")).arg(szName);
- } else if(pItem->isNamespace())
+ szMsg = QString(__tr2qs_ctx("Do you really want to remove the class \"%1\"?", "editor")).arg(szName);
+ }
+ else if(pItem->isNamespace())
{
- szMsg = QString(__tr2qs_ctx("Do you really want to remove the namespace \"%1\"?","editor")).arg(szName);
+ szMsg = QString(__tr2qs_ctx("Do you really want to remove the namespace \"%1\"?", "editor")).arg(szName);
szMsg += "<br>";
- szMsg += __tr2qs_ctx("Please note that all the child classes/functions will also be deleted.","editor");
- } else if(pItem->isMethod())
+ szMsg += __tr2qs_ctx("Please note that all the child classes/functions will also be deleted.", "editor");
+ }
+ else if(pItem->isMethod())
{
- szMsg = QString(__tr2qs_ctx("Do you really want to remove the function \"%1\"?","editor")).arg(szName);
+ szMsg = QString(__tr2qs_ctx("Do you really want to remove the function \"%1\"?", "editor")).arg(szName);
}
g_pClassEditorModule->lock();
- int iRet = QMessageBox::question(this,__tr2qs_ctx("Confirm Removing Item - KVIrc","editor"),szMsg,__tr2qs_ctx("Yes","editor"),__tr2qs_ctx("Yes to All","editor"),__tr2qs_ctx("No","editor"));
+ int iRet = QMessageBox::question(this, __tr2qs_ctx("Confirm Removing Item - KVIrc", "editor"), szMsg, __tr2qs_ctx("Yes", "editor"), __tr2qs_ctx("Yes to All", "editor"), __tr2qs_ctx("No", "editor"));
g_pClassEditorModule->unlock();
switch(iRet)
{
case 0:
// nothing
- break;
+ break;
case 1:
*pbYesToAll = true;
- break;
+ break;
default:
return false;
- break;
+ break;
}
}
@@ -1400,25 +1423,25 @@ bool ClassEditorWidget::removeItem(ClassEditorTreeWidgetItem * pItem, KviPointer
if(pItem == m_pLastClickedItem)
m_pLastClickedItem = 0;
if(pItem->childCount())
- removeItemChildren(pItem,lRemovedItems);
+ removeItemChildren(pItem, lRemovedItems);
if(pItem->isClass())
{
m_pClasses->removeRef(pItem);
KviKvsObjectClass * pClass = KviKvsKernel::instance()->objectController()->lookupClass(buildFullClassName(pItem));
- qDebug("removing class %s %p",buildFullClassName(pItem).toUtf8().data(), pClass);
+ qDebug("removing class %s %p", buildFullClassName(pItem).toUtf8().data(), pClass);
if(pClass)
KviKvsKernel::instance()->objectController()->deleteClass(pClass);
else
{
QString szFileName = buildFullClassName(pItem);
- szFileName.replace("::","--");
+ szFileName.replace("::", "--");
szFileName.append(KVI_FILEEXTENSION_SCRIPT);
QString szPath;
- g_pApp->getLocalKvircDirectory(szPath,KviApplication::Classes);
+ g_pApp->getLocalKvircDirectory(szPath, KviApplication::Classes);
QDir d(szPath);
if(d.exists(szFileName))
{
- qDebug("Removing file %s from disk",szFileName.toUtf8().data());
+ qDebug("Removing file %s from disk", szFileName.toUtf8().data());
d.remove(szFileName);
}
}
@@ -1437,8 +1460,8 @@ void ClassEditorWidget::updateClassHierarchy(ClassEditorTreeWidgetItem * pClass)
pClass->setClassNotBuilt(true);
KviPointerList<ClassEditorTreeWidgetItem> lInheritedClasses;
lInheritedClasses.setAutoDelete(false);
- searchInheritedClasses(pClass->name(),lInheritedClasses);
- for(unsigned int u=0; u < lInheritedClasses.count(); u++)
+ searchInheritedClasses(pClass->name(), lInheritedClasses);
+ for(unsigned int u = 0; u < lInheritedClasses.count(); u++)
{
lInheritedClasses.at(u)->setClassNotBuilt(true);
lInheritedClasses.at(u)->setInheritsClass(pClass->name());
@@ -1452,18 +1475,18 @@ void ClassEditorWidget::removeSelectedItems()
lRemovedItems.setAutoDelete(false);
QList<QTreeWidgetItem *> list = m_pTreeWidget->selectedItems();
bool bYesToAll = false;
- for(int i=0; i < list.count(); i++)
+ for(int i = 0; i < list.count(); i++)
{
- if(lRemovedItems.findRef((ClassEditorTreeWidgetItem *) list.at(i)) != -1)
+ if(lRemovedItems.findRef((ClassEditorTreeWidgetItem *)list.at(i)) != -1)
continue;
- if(!removeItem((ClassEditorTreeWidgetItem *) list.at(i),lRemovedItems,&bYesToAll))
+ if(!removeItem((ClassEditorTreeWidgetItem *)list.at(i), lRemovedItems, &bYesToAll))
return;
}
}
bool ClassEditorWidget::askForClassName(QString & szClassName, QString & szInheritsClassName, bool bEdit)
{
- KviClassEditorDialog * pDialog = new KviClassEditorDialog(this,"classdialog",m_pClasses,szClassName,szInheritsClassName,bEdit);
+ KviClassEditorDialog * pDialog = new KviClassEditorDialog(this, "classdialog", m_pClasses, szClassName, szInheritsClassName, bEdit);
szClassName = "";
g_pClassEditorModule->lock();
bool bOk = pDialog->exec();
@@ -1481,7 +1504,7 @@ bool ClassEditorWidget::askForClassName(QString & szClassName, QString & szInher
bool ClassEditorWidget::askForFunction(QString & szFunctionName, QString & szReminder, bool * bInternal, const QString & szClassName, bool bRenameMode)
{
- KviClassEditorFunctionDialog * pDialog = new KviClassEditorFunctionDialog(this,"function",szClassName,szFunctionName,szReminder,*bInternal, bRenameMode);
+ KviClassEditorFunctionDialog * pDialog = new KviClassEditorFunctionDialog(this, "function", szClassName, szFunctionName, szReminder, *bInternal, bRenameMode);
szFunctionName = "";
g_pClassEditorModule->lock();
bool bOk = pDialog->exec();
@@ -1505,11 +1528,11 @@ bool ClassEditorWidget::askForNamespaceName(const QString & szAction, const QStr
{
g_pClassEditorModule->lock();
szNewName = QInputDialog::getText(this,
- szAction,
- szText,
- QLineEdit::Normal,
- szInitialText,
- &bOk);
+ szAction,
+ szText,
+ QLineEdit::Normal,
+ szInitialText,
+ &bOk);
g_pClassEditorModule->unlock();
if(!bOk)
return false;
@@ -1517,9 +1540,9 @@ bool ClassEditorWidget::askForNamespaceName(const QString & szAction, const QStr
{
g_pClassEditorModule->lock();
QMessageBox::warning(this,
- __tr2qs_ctx("Invalid or Missing Name - KVIrc","editor"),
- __tr2qs_ctx("You must specify a valid name for the namespace.","editor"),
- __tr2qs_ctx("OK, Let me try again...","editor"));
+ __tr2qs_ctx("Invalid or Missing Name - KVIrc", "editor"),
+ __tr2qs_ctx("You must specify a valid name for the namespace.", "editor"),
+ __tr2qs_ctx("OK, Let me try again...", "editor"));
g_pClassEditorModule->unlock();
continue;
}
@@ -1530,34 +1553,34 @@ bool ClassEditorWidget::askForNamespaceName(const QString & szAction, const QStr
{
g_pClassEditorModule->lock();
QMessageBox::information(this,
- __tr2qs_ctx("Invalid Name - KVIrc","editor"),
- __tr2qs_ctx("Namespace names can contain only letters, digits, underscores and '::' namespace separators.","editor"),
- __tr2qs_ctx("OK, Let me try again...","editor"));
+ __tr2qs_ctx("Invalid Name - KVIrc", "editor"),
+ __tr2qs_ctx("Namespace names can contain only letters, digits, underscores and '::' namespace separators.", "editor"),
+ __tr2qs_ctx("OK, Let me try again...", "editor"));
g_pClassEditorModule->unlock();
szNewName = "";
continue;
}
// make sure that we have only doubled "::" and not ":" or ":::..."
QString szTmp = szNewName;
- szTmp.replace("::","@"); // @ is not allowed by the rule above
- if(szTmp.indexOf(":",Qt::CaseInsensitive) != -1)
+ szTmp.replace("::", "@"); // @ is not allowed by the rule above
+ if(szTmp.indexOf(":", Qt::CaseInsensitive) != -1)
{
g_pClassEditorModule->lock();
QMessageBox::information(this,
- __tr2qs_ctx("Invalid Name - KVIrc","editor"),
- __tr2qs_ctx("Stray ':' character in namespace name: did you mean ...<namespace>::<name>?","editor"),
- __tr2qs_ctx("OK, Let me try again...","editor"));
+ __tr2qs_ctx("Invalid Name - KVIrc", "editor"),
+ __tr2qs_ctx("Stray ':' character in namespace name: did you mean ...<namespace>::<name>?", "editor"),
+ __tr2qs_ctx("OK, Let me try again...", "editor"));
g_pClassEditorModule->unlock();
szNewName = "";
continue;
}
- if(szTmp.indexOf("@@",Qt::CaseInsensitive) != -1)
+ if(szTmp.indexOf("@@", Qt::CaseInsensitive) != -1)
{
g_pClassEditorModule->lock();
QMessageBox::information(this,
- __tr2qs_ctx("Invalid Name - KVIrc","editor"),
- __tr2qs_ctx("Found an empty namespace in namespace name.","editor"),
- __tr2qs_ctx("OK, Let me try again...","editor"));
+ __tr2qs_ctx("Invalid Name - KVIrc", "editor"),
+ __tr2qs_ctx("Found an empty namespace in namespace name.", "editor"),
+ __tr2qs_ctx("OK, Let me try again...", "editor"));
g_pClassEditorModule->unlock();
szNewName = "";
continue;
@@ -1587,10 +1610,10 @@ void ClassEditorWidget::newClass()
{
QString szClassName;
QString szinheritsClassName;
- askForClassName(szClassName,szinheritsClassName,false);
+ askForClassName(szClassName, szinheritsClassName, false);
if(szClassName.isEmpty())
return;
- ClassEditorTreeWidgetItem * pItem = newItem(szClassName,ClassEditorTreeWidgetItem::Class);
+ ClassEditorTreeWidgetItem * pItem = newItem(szClassName, ClassEditorTreeWidgetItem::Class);
KviQString::escapeKvs(&szClassName, KviQString::EscapeSpace);
KviQString::escapeKvs(&szinheritsClassName, KviQString::EscapeSpace);
@@ -1600,18 +1623,18 @@ void ClassEditorWidget::newClass()
szClass += "){}\n";
pItem->setInheritsClass(szinheritsClassName);
activateItem(pItem);
- m_pClasses->insert(szClassName,pItem);
- KviKvsScript::run(szClass,g_pActiveWindow);
+ m_pClasses->insert(szClassName, pItem);
+ KviKvsScript::run(szClass, g_pActiveWindow);
}
void ClassEditorWidget::newNamespace()
{
QString szName;
- if(!askForNamespaceName(__tr2qs_ctx("Enter a Filename - KVIrc","editor"),__tr2qs_ctx("Please enter the name for the new namespace.","editor"),"mynamespace",szName))
+ if(!askForNamespaceName(__tr2qs_ctx("Enter a Filename - KVIrc", "editor"), __tr2qs_ctx("Please enter the name for the new namespace.", "editor"), "mynamespace", szName))
return;
if(szName.isEmpty())
return;
- ClassEditorTreeWidgetItem * pItem = newItem(szName,ClassEditorTreeWidgetItem::Namespace);
+ ClassEditorTreeWidgetItem * pItem = newItem(szName, ClassEditorTreeWidgetItem::Namespace);
activateItem(pItem);
}
@@ -1622,26 +1645,26 @@ void ClassEditorWidget::newMemberFunction()
QString szReminder;
if(m_pLastClickedItem->isMethod())
- m_pLastClickedItem = (ClassEditorTreeWidgetItem*)m_pLastClickedItem->parent();
+ m_pLastClickedItem = (ClassEditorTreeWidgetItem *)m_pLastClickedItem->parent();
szClassName = buildFullClassName(m_pLastClickedItem);
bool bInternal = false;
- if(!askForFunction(szFunctionName, szReminder,&bInternal,szClassName,false))
+ if(!askForFunction(szFunctionName, szReminder, &bInternal, szClassName, false))
return;
if(szFunctionName.isEmpty())
return;
- ClassEditorTreeWidgetItem * pItem = newItem(szFunctionName,ClassEditorTreeWidgetItem::Method);
+ ClassEditorTreeWidgetItem * pItem = newItem(szFunctionName, ClassEditorTreeWidgetItem::Method);
pItem->setInternalFunction(bInternal);
if(!szReminder.isEmpty())
pItem->setReminder(szReminder);
activateItem(pItem);
- ((ClassEditorTreeWidgetItem*)pItem->parent())->setClassNotBuilt(true);
+ ((ClassEditorTreeWidgetItem *)pItem->parent())->setClassNotBuilt(true);
}
ClassEditorTreeWidgetItem * ClassEditorWidget::newItem(QString & szName, ClassEditorTreeWidgetItem::Type eType)
{
if(m_pLastClickedItem)
- buildFullItemPath(m_pLastClickedItem,szName);
+ buildFullItemPath(m_pLastClickedItem, szName);
QString szTmp;
if(findItem(szName))
@@ -1664,7 +1687,7 @@ ClassEditorTreeWidgetItem * ClassEditorWidget::newItem(QString & szName, ClassEd
void ClassEditorWidget::build()
{
saveLastEditedItem();
- KviPointerHashTableIterator<QString,ClassEditorTreeWidgetItem> it (*m_pClasses);
+ KviPointerHashTableIterator<QString, ClassEditorTreeWidgetItem> it(*m_pClasses);
KviPointerList<ClassEditorTreeWidgetItem> linkedClasses;
linkedClasses.setAutoDelete(false);
KviPointerList<ClassEditorTreeWidgetItem> skipClasses;
@@ -1691,7 +1714,7 @@ void ClassEditorWidget::build()
linkedClasses.append(pParentClass);
pParentClass = m_pClasses->find(pParentClass->inheritsClass());
}
- for(int i = linkedClasses.count()-1; i >= 0; i--)
+ for(int i = linkedClasses.count() - 1; i >= 0; i--)
{
QString szFullClassName = buildFullClassName(linkedClasses.at(i));
KviKvsObjectClass * pClass = KviKvsKernel::instance()->objectController()->lookupClass(szFullClassName);
@@ -1699,29 +1722,29 @@ void ClassEditorWidget::build()
KviKvsKernel::instance()->objectController()->deleteClass(pClass);
QString szClass;
exportClassBuffer(szClass, linkedClasses.at(i));
- KviKvsScript::run(szClass,g_pActiveWindow);
+ KviKvsScript::run(szClass, g_pActiveWindow);
pClass = KviKvsKernel::instance()->objectController()->lookupClass(szFullClassName);
if(!pClass)
{
bErrorWhilecompiling = true;
- QString szError = __tr2qs_ctx("Unable to compile class: ","editor");
+ QString szError = __tr2qs_ctx("Unable to compile class: ", "editor");
szError += szFullClassName + "\n";
KviPointerList<ClassEditorTreeWidgetItem> lInheritedClasses;
lInheritedClasses.setAutoDelete(false);
- searchInheritedClasses(szFullClassName,lInheritedClasses);
+ searchInheritedClasses(szFullClassName, lInheritedClasses);
if(lInheritedClasses.count())
{
- szError += __tr2qs_ctx("These inherited classes will be not compiled too:","editor");
+ szError += __tr2qs_ctx("These inherited classes will be not compiled too:", "editor");
szError += "\n";
- for(unsigned int u=0; u < lInheritedClasses.count(); u++)
+ for(unsigned int u = 0; u < lInheritedClasses.count(); u++)
{
szError += buildFullClassName(lInheritedClasses.at(u)) + "\n";
lInheritedClasses.at(u)->setClassNotBuilt(true);
skipClasses.append(lInheritedClasses.at(u));
}
}
- QMessageBox::critical(this,__tr2qs_ctx("Compilation Error - KVIrc","editor"),szError,
- QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton);
+ QMessageBox::critical(this, __tr2qs_ctx("Compilation Error - KVIrc", "editor"), szError,
+ QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton);
break;
}
//else qDebug("class compiled %s :\n",szClass.toUtf8().data());
@@ -1733,11 +1756,12 @@ void ClassEditorWidget::build()
}
if(bErrorWhilecompiling)
saveNotBuiltClasses();
- else {
+ else
+ {
QString szFileName = "libkviclasseditortmp.kvc";
QString szBuffer;
- g_pApp->getLocalKvircDirectory(szBuffer,KviApplication::ConfigPlugins,szFileName);
- KviConfigurationFile cfg(szBuffer,KviConfigurationFile::Write);
+ g_pApp->getLocalKvircDirectory(szBuffer, KviApplication::ConfigPlugins, szFileName);
+ KviConfigurationFile cfg(szBuffer, KviConfigurationFile::Write);
cfg.clear();
cfg.sync();
}
@@ -1748,8 +1772,8 @@ void ClassEditorWidget::loadNotBuiltClasses()
{
QString szFileName = "libkviclasseditortmp.kvc";
QString szBuffer;
- g_pApp->getLocalKvircDirectory(szBuffer,KviApplication::ConfigPlugins,szFileName);
- KviConfigurationFile cfg(szBuffer,KviConfigurationFile::Read);
+ g_pApp->getLocalKvircDirectory(szBuffer, KviApplication::ConfigPlugins, szFileName);
+ KviConfigurationFile cfg(szBuffer, KviConfigurationFile::Read);
KviConfigurationFileIterator it(*(cfg.dict()));
KviPointerList<QString> l;
@@ -1765,7 +1789,7 @@ void ClassEditorWidget::loadNotBuiltClasses()
{
cfg.setGroup(*pszTmp);
ClassEditorTreeWidgetItem * pClassItem = createFullItem(*pszTmp);
- m_pClasses->insert(*pszTmp,pClassItem);
+ m_pClasses->insert(*pszTmp, pClassItem);
pClassItem->setClassNotBuilt(true);
KviConfigurationFileGroup * pDict = cfg.dict()->find(*pszTmp);
if(pDict)
@@ -1781,21 +1805,21 @@ void ClassEditorWidget::loadNotBuiltClasses()
for(QString * pszTmp = names.first(); pszTmp; pszTmp = names.next())
{
- if(KviQString::equalCI(*pszTmp,"@Inherits"))
+ if(KviQString::equalCI(*pszTmp, "@Inherits"))
{
- pClassItem->setInheritsClass(cfg.readEntry(*pszTmp,""));
+ pClassItem->setInheritsClass(cfg.readEntry(*pszTmp, ""));
continue;
}
- if((*pszTmp).left(9) == "@Reminder")
+ if((*pszTmp).left(9) == "@Reminder")
continue;
- QString szCode = cfg.readEntry(*pszTmp,"");
+ QString szCode = cfg.readEntry(*pszTmp, "");
ClassEditorTreeWidgetItem * pFunctionItem = findFunction(*pszTmp, pClassItem);
if(!pFunctionItem)
- pFunctionItem = new ClassEditorTreeWidgetItem(pClassItem,ClassEditorTreeWidgetItem::Method,*pszTmp);
+ pFunctionItem = new ClassEditorTreeWidgetItem(pClassItem, ClassEditorTreeWidgetItem::Method, *pszTmp);
pFunctionItem->setBuffer(szCode);
- QString szEntry = "@Reminder|" + (*pszTmp);
- QString szReminder = cfg.readEntry(szEntry,"");
- pFunctionItem->setReminder(szReminder);
+ QString szEntry = "@Reminder|" + (*pszTmp);
+ QString szReminder = cfg.readEntry(szEntry, "");
+ pFunctionItem->setReminder(szReminder);
}
}
}
@@ -1804,11 +1828,11 @@ void ClassEditorWidget::loadNotBuiltClasses()
void ClassEditorWidget::saveNotBuiltClasses()
{
saveLastEditedItem();
- KviPointerHashTableIterator<QString,ClassEditorTreeWidgetItem> it (*m_pClasses);
+ KviPointerHashTableIterator<QString, ClassEditorTreeWidgetItem> it(*m_pClasses);
QString szFileName = "libkviclasseditortmp.kvc";
QString szBuffer;
- g_pApp->getLocalKvircDirectory(szBuffer,KviApplication::ConfigPlugins,szFileName);
- KviConfigurationFile cfg(szBuffer,KviConfigurationFile::Write);
+ g_pApp->getLocalKvircDirectory(szBuffer, KviApplication::ConfigPlugins, szFileName);
+ KviConfigurationFile cfg(szBuffer, KviConfigurationFile::Write);
cfg.clear();
while(it.current())
@@ -1820,16 +1844,16 @@ void ClassEditorWidget::saveNotBuiltClasses()
KviKvsKernel::instance()->objectController()->deleteClass(pClass);
cfg.setGroup(it.currentKey());
- cfg.writeEntry("@Inherits",it.current()->inheritsClass());
+ cfg.writeEntry("@Inherits", it.current()->inheritsClass());
QString szReminderEntry;
- for(int i=0; i < it.current()->childCount(); i++)
+ for(int i = 0; i < it.current()->childCount(); i++)
{
if(!((ClassEditorTreeWidgetItem *)it.current()->child(i))->reminder().isEmpty())
{
- szReminderEntry="@Reminder|"+((ClassEditorTreeWidgetItem *)it.current()->child(i))->name();
- cfg.writeEntry(szReminderEntry,((ClassEditorTreeWidgetItem *)it.current()->child(i))->reminder());
+ szReminderEntry = "@Reminder|" + ((ClassEditorTreeWidgetItem *)it.current()->child(i))->name();
+ cfg.writeEntry(szReminderEntry, ((ClassEditorTreeWidgetItem *)it.current()->child(i))->reminder());
}
- cfg.writeEntry(((ClassEditorTreeWidgetItem *)it.current()->child(i))->name(),((ClassEditorTreeWidgetItem *)it.current()->child(i))->buffer());
+ cfg.writeEntry(((ClassEditorTreeWidgetItem *)it.current()->child(i))->name(), ((ClassEditorTreeWidgetItem *)it.current()->child(i))->buffer());
}
}
++it;
@@ -1839,44 +1863,44 @@ void ClassEditorWidget::saveNotBuiltClasses()
void ClassEditorWidget::searchInheritedClasses(const QString szClass, KviPointerList<ClassEditorTreeWidgetItem> & lInheritedClasses)
{
- KviPointerHashTableIterator<QString,ClassEditorTreeWidgetItem> it (*m_pClasses);
+ KviPointerHashTableIterator<QString, ClassEditorTreeWidgetItem> it(*m_pClasses);
while(it.current())
{
- if(KviQString::equalCI(szClass,it.current()->inheritsClass()))
+ if(KviQString::equalCI(szClass, it.current()->inheritsClass()))
lInheritedClasses.append(it.current());
++it;
}
}
ClassEditorWindow::ClassEditorWindow()
-: KviWindow(KviWindow::ScriptEditor,"classeditor",0)
+ : KviWindow(KviWindow::ScriptEditor, "classeditor", 0)
{
g_pClassEditorWindow = this;
- setFixedCaption(__tr2qs_ctx("Class Editor","editor"));
+ setFixedCaption(__tr2qs_ctx("Class Editor", "editor"));
QGridLayout * pLayout = new QGridLayout();
m_pEditor = new ClassEditorWidget(this);
- pLayout->addWidget(m_pEditor,0,0,1,4);
+ pLayout->addWidget(m_pEditor, 0, 0, 1, 4);
- QPushButton * pBtn = new QPushButton(__tr2qs_ctx("&Build","editor"),this);
+ QPushButton * pBtn = new QPushButton(__tr2qs_ctx("&Build", "editor"), this);
pBtn->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Accept)));
- pLayout->addWidget(pBtn,1,1);
- connect(pBtn,SIGNAL(clicked()),this,SLOT(buildClicked()));
+ pLayout->addWidget(pBtn, 1, 1);
+ connect(pBtn, SIGNAL(clicked()), this, SLOT(buildClicked()));
- pBtn = new QPushButton(__tr2qs_ctx("&Save","editor"),this);
+ pBtn = new QPushButton(__tr2qs_ctx("&Save", "editor"), this);
pBtn->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Accept)));
- pLayout->addWidget(pBtn,1,2);
- connect(pBtn,SIGNAL(clicked()),this,SLOT(saveClicked()));
+ pLayout->addWidget(pBtn, 1, 2);
+ connect(pBtn, SIGNAL(clicked()), this, SLOT(saveClicked()));
- pBtn = new QPushButton(__tr2qs_ctx("Close","editor"),this);
+ pBtn = new QPushButton(__tr2qs_ctx("Close", "editor"), this);
pBtn->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Discard)));
- pLayout->addWidget(pBtn,1,3);
- connect(pBtn,SIGNAL(clicked()),this,SLOT(cancelClicked()));
+ pLayout->addWidget(pBtn, 1, 3);
+ connect(pBtn, SIGNAL(clicked()), this, SLOT(cancelClicked()));
- pLayout->setRowStretch(0,1);
- pLayout->setColumnStretch(0,1);
+ pLayout->setRowStretch(0, 1);
+ pLayout->setColumnStretch(0, 1);
setLayout(pLayout);
}
@@ -1905,7 +1929,7 @@ QPixmap * ClassEditorWindow::myIconPtr()
return g_pIconManager->getSmallIcon(KviIconManager::ClassEditor);
}
-void ClassEditorWindow::configGroupName(QString &szName)
+void ClassEditorWindow::configGroupName(QString & szName)
{
szName = "classeditor";
}
@@ -1920,8 +1944,8 @@ void ClassEditorWindow::loadProperties(KviConfigurationFile * pCfg)
m_pEditor->loadProperties(pCfg);
}
-KviClassEditorDialog::KviClassEditorDialog(QWidget * pParent, const QString & szName, KviPointerHashTable<QString,ClassEditorTreeWidgetItem> * pClasses, const QString & szClassName, const QString & szInheritsClassName, bool bRenameMode)
-: QDialog(pParent)
+KviClassEditorDialog::KviClassEditorDialog(QWidget * pParent, const QString & szName, KviPointerHashTable<QString, ClassEditorTreeWidgetItem> * pClasses, const QString & szClassName, const QString & szInheritsClassName, bool bRenameMode)
+ : QDialog(pParent)
{
setObjectName(szName);
@@ -1930,11 +1954,11 @@ KviClassEditorDialog::KviClassEditorDialog(QWidget * pParent, const QString & sz
KviTalHBox * pHBox = new KviTalHBox(this);
pHBox->setSpacing(0);
pHBox->setMargin(0);
- pLayout->addWidget(pHBox,0,0);
+ pLayout->addWidget(pHBox, 0, 0);
QLabel * pLabel = new QLabel(pHBox);
pLabel->setObjectName("classnamelabel");
- pLabel->setText(__tr2qs_ctx("Please enter the name for the class:","editor"));
+ pLabel->setText(__tr2qs_ctx("Please enter the name for the class:", "editor"));
m_pClassNameLineEdit = new QLineEdit(pHBox);
m_pClassNameLineEdit->setObjectName("classnameineedit");
@@ -1945,38 +1969,40 @@ KviClassEditorDialog::KviClassEditorDialog(QWidget * pParent, const QString & sz
{
// we allow only [\w:]+ class name
re.setPattern("[\\w]+");
- m_pClassNameLineEdit->setToolTip(__tr2qs_ctx("Class names can contain only letters, digits and underscores","editor"));
- } else {
+ m_pClassNameLineEdit->setToolTip(__tr2qs_ctx("Class names can contain only letters, digits and underscores", "editor"));
+ }
+ else
+ {
// in editor mode we allow [\w:]+ and namespace separator
re.setPattern("[\\w]+(::[\\w]+)+");
- m_pClassNameLineEdit->setToolTip(__tr2qs_ctx("In rename mode class names can contain only letters, digits and underscores and namespaces :: separator","editor"));
+ m_pClassNameLineEdit->setToolTip(__tr2qs_ctx("In rename mode class names can contain only letters, digits and underscores and namespaces :: separator", "editor"));
}
- QRegExpValidator * pValidator = new QRegExpValidator(re,this);
+ QRegExpValidator * pValidator = new QRegExpValidator(re, this);
m_pClassNameLineEdit->setValidator(pValidator);
m_pClassNameLineEdit->setObjectName("functionameineedit");
pHBox = new KviTalHBox(this);
pHBox->setSpacing(0);
pHBox->setMargin(0);
- pLayout->addWidget(pHBox,1,0);
+ pLayout->addWidget(pHBox, 1, 0);
pLabel = new QLabel(pHBox);
pLabel->setObjectName("Inheritsclasslabel");
- pLabel->setText(__tr2qs_ctx("Inherits class:","editor"));
+ pLabel->setText(__tr2qs_ctx("Inherits class:", "editor"));
m_pInheritsClassComboBox = new QComboBox(pHBox);
pLabel->setBuddy(m_pInheritsClassComboBox);
- KviPointerHashTableIterator<QString,ClassEditorTreeWidgetItem> pClassesIt(*pClasses);
+ KviPointerHashTableIterator<QString, ClassEditorTreeWidgetItem> pClassesIt(*pClasses);
QStringList szClasses;
while(pClassesIt.current())
{
- if(!KviQString::equalCI(pClassesIt.currentKey(),szClassName))
+ if(!KviQString::equalCI(pClassesIt.currentKey(), szClassName))
szClasses.append(pClassesIt.currentKey());
++pClassesIt;
}
- KviPointerHashTableIterator<QString,KviKvsObjectClass> pBuiltinClasses(*KviKvsKernel::instance()->objectController()->classDict());
+ KviPointerHashTableIterator<QString, KviKvsObjectClass> pBuiltinClasses(*KviKvsKernel::instance()->objectController()->classDict());
while(pBuiltinClasses.current())
{
if(pBuiltinClasses.current()->isBuiltin())
@@ -1986,11 +2012,12 @@ KviClassEditorDialog::KviClassEditorDialog(QWidget * pParent, const QString & sz
int iCurrentIdx;
szClasses.sort();
- for(int i=0; i < szClasses.count(); i++)
+ for(int i = 0; i < szClasses.count(); i++)
m_pInheritsClassComboBox->addItem(szClasses.at(i));
if(szInheritsClassName.isEmpty())
iCurrentIdx = m_pInheritsClassComboBox->findText("object");
- else {
+ else
+ {
iCurrentIdx = m_pInheritsClassComboBox->findText(szInheritsClassName);
if(iCurrentIdx == -1)
iCurrentIdx = m_pInheritsClassComboBox->findText("object");
@@ -2002,21 +2029,22 @@ KviClassEditorDialog::KviClassEditorDialog(QWidget * pParent, const QString & sz
pHBox = new KviTalHBox(this);
pHBox->setSpacing(0);
pHBox->setMargin(0);
- pLayout->addWidget(pHBox,2,0);
+ pLayout->addWidget(pHBox, 2, 0);
m_pNewClassButton = new QPushButton(pHBox);
m_pNewClassButton->setObjectName("newclassbutton");
if(bRenameMode)
- m_pNewClassButton->setText(__tr2qs_ctx("&Rename Class","editor"));
- else {
- m_pNewClassButton->setText(__tr2qs_ctx("&Create Class","editor"));
+ m_pNewClassButton->setText(__tr2qs_ctx("&Rename Class", "editor"));
+ else
+ {
+ m_pNewClassButton->setText(__tr2qs_ctx("&Create Class", "editor"));
m_pNewClassButton->setEnabled(false);
}
connect(m_pNewClassButton, SIGNAL(clicked()), this, SLOT(accept()));
QPushButton * pCancelButton = new QPushButton(pHBox);
pCancelButton->setObjectName("cancelButton");
- pCancelButton->setText(__tr2qs_ctx("&Cancel","editor"));
+ pCancelButton->setText(__tr2qs_ctx("&Cancel", "editor"));
connect(pCancelButton, SIGNAL(clicked()), this, SLOT(reject()));
setLayout(pLayout);
@@ -2032,7 +2060,7 @@ void KviClassEditorDialog::textChanged(const QString & szText)
}
KviClassEditorFunctionDialog::KviClassEditorFunctionDialog(QWidget * pParent, const QString & szName, const QString & szClassName, const QString & szFunctionName, const QString & szReminder, bool bIsInternal, bool bRenameMode)
-: QDialog(pParent)
+ : QDialog(pParent)
{
setObjectName(szName);
@@ -2041,41 +2069,41 @@ KviClassEditorFunctionDialog::KviClassEditorFunctionDialog(QWidget * pParent, co
KviTalHBox * pHBox = new KviTalHBox(this);
pHBox->setSpacing(0);
pHBox->setMargin(0);
- pLayout->addWidget(pHBox,0,0);
+ pLayout->addWidget(pHBox, 0, 0);
QLabel * pLabel = new QLabel(pHBox);
pLabel->setObjectName("classnamelabel");
- pLabel->setText("Class: <b>"+szClassName+"</b>");
+ pLabel->setText("Class: <b>" + szClassName + "</b>");
pHBox = new KviTalHBox(this);
pHBox->setSpacing(0);
pHBox->setMargin(0);
- pLayout->addWidget(pHBox,1,0);
+ pLayout->addWidget(pHBox, 1, 0);
pLabel = new QLabel(pHBox);
pLabel->setObjectName("functionnamelabel");
- pLabel->setText(__tr2qs_ctx("Please enter the name for the member function:","editor"));
+ pLabel->setText(__tr2qs_ctx("Please enter the name for the member function:", "editor"));
m_pFunctionNameLineEdit = new QLineEdit(pHBox);
// we allow only [\w:]+ function name
QRegExp re("[\\w]+");
- QRegExpValidator * pValidator = new QRegExpValidator(re,this);
+ QRegExpValidator * pValidator = new QRegExpValidator(re, this);
m_pFunctionNameLineEdit->setValidator(pValidator);
m_pFunctionNameLineEdit->setObjectName("functionameineedit");
- m_pFunctionNameLineEdit->setToolTip(__tr2qs_ctx("Function names can contain only letters, digits and underscores","editor"));
+ m_pFunctionNameLineEdit->setToolTip(__tr2qs_ctx("Function names can contain only letters, digits and underscores", "editor"));
m_pFunctionNameLineEdit->setText(szFunctionName);
pLabel->setBuddy(m_pFunctionNameLineEdit);
pHBox = new KviTalHBox(this);
pHBox->setSpacing(0);
pHBox->setMargin(0);
- pLayout->addWidget(pHBox,2,0);
+ pLayout->addWidget(pHBox, 2, 0);
pLabel = new QLabel(pHBox);
pLabel->setObjectName("reminderlabel");
pLabel->setWordWrap(1);
- pLabel->setText(__tr2qs_ctx("Please enter the optional reminder string for the member function:","editor"));
+ pLabel->setText(__tr2qs_ctx("Please enter the optional reminder string for the member function:", "editor"));
m_pReminderLineEdit = new QLineEdit(pHBox);
m_pReminderLineEdit->setText(szReminder);
@@ -2084,11 +2112,11 @@ KviClassEditorFunctionDialog::KviClassEditorFunctionDialog(QWidget * pParent, co
pHBox = new KviTalHBox(this);
pHBox->setSpacing(0);
pHBox->setMargin(0);
- pLayout->addWidget(pHBox,3,0);
+ pLayout->addWidget(pHBox, 3, 0);
pLabel = new QLabel(pHBox);
pLabel->setObjectName("functionnamelabel");
- pLabel->setText(__tr2qs_ctx("Set as <b>Internal</b> Function: ","editor"));
+ pLabel->setText(__tr2qs_ctx("Set as <b>Internal</b> Function: ", "editor"));
m_pInternalCheckBox = new QCheckBox(pHBox);
m_pInternalCheckBox->setChecked(bIsInternal);
@@ -2096,21 +2124,21 @@ KviClassEditorFunctionDialog::KviClassEditorFunctionDialog(QWidget * pParent, co
pLabel->setBuddy(m_pInternalCheckBox);
connect(m_pFunctionNameLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(textChanged(const QString &)));
- pHBox->setAlignment(m_pInternalCheckBox,Qt::AlignLeft);
- pHBox->setStretchFactor(m_pInternalCheckBox,70);
- pHBox->setStretchFactor(pLabel,30);
+ pHBox->setAlignment(m_pInternalCheckBox, Qt::AlignLeft);
+ pHBox->setStretchFactor(m_pInternalCheckBox, 70);
+ pHBox->setStretchFactor(pLabel, 30);
pHBox = new KviTalHBox(this);
pHBox->setSpacing(0);
pHBox->setMargin(0);
- pLayout->addWidget(pHBox,4,0);
+ pLayout->addWidget(pHBox, 4, 0);
m_pNewFunctionButton = new QPushButton(pHBox);
m_pNewFunctionButton->setObjectName("newfunctionbutton");
if(!bRenameMode)
- m_pNewFunctionButton->setText(__tr2qs_ctx("&Add","editor"));
+ m_pNewFunctionButton->setText(__tr2qs_ctx("&Add", "editor"));
else
- m_pNewFunctionButton->setText(__tr2qs_ctx("&Rename","editor"));
+ m_pNewFunctionButton->setText(__tr2qs_ctx("&Rename", "editor"));
if(szFunctionName.isEmpty())
m_pNewFunctionButton->setEnabled(false);
@@ -2118,7 +2146,7 @@ KviClassEditorFunctionDialog::KviClassEditorFunctionDialog(QWidget * pParent, co
QPushButton * pCancelButton = new QPushButton(pHBox);
pCancelButton->setObjectName("cancelButton");
- pCancelButton->setText(__tr2qs_ctx("&Cancel","editor"));
+ pCancelButton->setText(__tr2qs_ctx("&Cancel", "editor"));
connect(pCancelButton, SIGNAL(clicked()), this, SLOT(reject()));
setLayout(pLayout);