aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/classeditor
diff options
context:
space:
mode:
authorGravatar Noldor2010-03-24 12:27:41 +0000
committerGravatar Noldor2010-03-24 12:27:41 +0000
commit9c6eba79e4dc8e086cd1d41deca2b03c1ee96fce (patch)
treec56c4396071a472abbf7c015dd005720c185e0f8 /src/modules/classeditor
parentfixed default alternative nicknames (diff)
downloadKVIrc-9c6eba79e4dc8e086cd1d41deca2b03c1ee96fce.tar.gz
KVIrc-9c6eba79e4dc8e086cd1d41deca2b03c1ee96fce.tar.bz2
KVIrc-9c6eba79e4dc8e086cd1d41deca2b03c1ee96fce.zip
More worl on classeditor
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@4210 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/classeditor')
-rw-r--r--src/modules/classeditor/classeditor.cpp92
-rw-r--r--src/modules/classeditor/classeditor.h32
2 files changed, 18 insertions, 106 deletions
diff --git a/src/modules/classeditor/classeditor.cpp b/src/modules/classeditor/classeditor.cpp
index 988047e9e..31d7849a7 100644
--- a/src/modules/classeditor/classeditor.cpp
+++ b/src/modules/classeditor/classeditor.cpp
@@ -277,13 +277,13 @@ KviClassEditorTreeWidgetItem * KviClassEditor::findItem(const QString & szFullNa
}
return (KviClassEditorTreeWidgetItem *)pItem;
}
-
+/*
bool KviClassEditor::itemExists(const QString & szFullName)
{
if (findItem(szFullName)) return true;
else return false;
}
-
+*/
KviClassEditorTreeWidgetItem * KviClassEditor::createFullItem(const QString & szFullName)
{
QStringList lNamespaces=szFullName.split("::");
@@ -416,88 +416,29 @@ void KviClassEditor::classRefresh(const QString & szName)
m_pEditor->setText(class->code());
}
-void KviClassEditor::itemRenamed(QTreeWidgetItem * it, int col)
-{
- if(it!=m_pLastEditedItem) return;
- ((KviClassEditorTreeWidgetItem *)it)->setName(it->text(col));
- QString szNam = buildFullItemName((KviClassEditorTreeWidgetItem *)it);
- QString szLabelText;
- if(((KviClassEditorTreeWidgetItem *)it)->isNamespace())
- szLabelText = __tr2qs_ctx("Namespace","editor");
- else
- szLabelText = __tr2qs_ctx("Class","editor");
- szLabelText += ": <b>";
- szLabelText += szNam;
- szLabelText += "</b>";
- m_pClassNameLabel->setText(szLabelText);
-}
*/
bool KviClassEditor::hasSelectedItems()
{
return m_pTreeWidget->selectedItems().count() ? 1 : 0;
}
-
+/*
bool KviClassEditor::itemExists(QTreeWidgetItem * pSearchFor)
{
if(!pSearchFor) return false;
if(m_pClasses->findRef((KviClassEditorTreeWidgetItem*) pSearchFor)) return true;
else return false;
}
-
-/*
-void KviClassEditor::appendAllItems(KviPointerList<KviClassEditorTreeWidgetItem> * l, KviClassEditorTreeWidgetItem::Type eType)
-{
- for (int i=0;i<m_pTreeWidget->topLevelItemCount();i++)
- {
- if (((KviClassEditorTreeWidgetItem *)m_pTreeWidget->topLevelItem(i))->type()==eType)
- {
- l->append(((KviClassEditorTreeWidgetItem *)m_pTreeWidget->topLevelItem(i)));
- }
- else
- {
- appendAllItemsRecursive(l,m_pTreeWidget->topLevelItem(i),eType);
- }
- }
-}
-
-void KviClassEditor::appendAllItemsRecursive(KviPointerList<KviClassEditorTreeWidgetItem> * l, QTreeWidgetItem * pStartFrom, KviClassEditorTreeWidgetItem::Type eType)
-{
- for (int i=0;i<pStartFrom->childCount();i++)
- {
- if (((KviClassEditorTreeWidgetItem *)pStartFrom->child(i))->type()==eType)
- {
- l->append((KviClassEditorTreeWidgetItem *)pStartFrom->child(i));
- }
- else
- {
- appendAllItemsRecursive(l,pStartFrom->child(i),eType);
- }
- }
-}
*/
+
bool KviClassEditor::classExists(QString & szFullItemName)
{
if (m_pClasses->find(szFullItemName)) return true;
else return false;
}
-bool KviClassEditor::namespaceExists(QString & szFullItemName)
-{
- /*KviPointerList<KviClassEditorTreeWidgetItem> l;
- l.setAutoDelete(false);
- appendAllItems(&l,KviClassEditorTreeWidgetItem::Namespace);
- for(KviClassEditorTreeWidgetItem * it = l.first();it;it = l.next())
- {
- if (KviQString::equalCI(buildFullItemName(it),szFullItemName))
- {
- return true;
- }
- }*/
- return false;
-}
void KviClassEditor::renameFunction()
{
KviClassEditorTreeWidgetItem *pFunction=m_pLastEditedItem;
@@ -528,10 +469,10 @@ void KviClassEditor::renameFunction()
for(unsigned int i=0;i<pInheritedClasses.count();i++)
pInheritedClasses.at(i)->setClassNotBuilt(true);
activateItem(pFunction);
- KviKvsObjectClass *pClass;
+/* KviKvsObjectClass *pClass;
pClass = KviKvsKernel::instance()->objectController()->lookupClass(szClassName);
- //if (pClass) KviKvsKernel::instance()->objectController()->deleteClass(pClass);
-
+ if (pClass) KviKvsKernel::instance()->objectController()->deleteClass(pClass);
+*/
}
bool KviClassEditor::functionExists(const QString &szFunctionName, KviClassEditorTreeWidgetItem *pClass)
{
@@ -1138,17 +1079,12 @@ void KviClassEditor::loadProperties(KviConfig * cfg)
activateItem(it);
}
-void KviClassEditor::appendSelectedClassItems(KviPointerList<KviClassEditorTreeWidgetItem> * l)
+void KviClassEditor::appendSelectedItems(KviPointerList<KviClassEditorTreeWidgetItem> * l)
{
QList<QTreeWidgetItem *> list=m_pTreeWidget->selectedItems();
for(int i=0;i<list.count();i++)
{
- if (((KviClassEditorTreeWidgetItem *)list.at(i))->isClass())
- l->append((KviClassEditorTreeWidgetItem *)list.at(i));
- else
- {
- appendSelectedClassItemsRecursive(l,list.at(i));
- }
+ l->append((KviClassEditorTreeWidgetItem *)list.at(i));
}
}
void KviClassEditor::appendSelectedClassItemsRecursive(KviPointerList<KviClassEditorTreeWidgetItem> * l,QTreeWidgetItem * pStartFrom)
@@ -1190,7 +1126,7 @@ void KviClassEditor::appendAllClassItemsRecursive(KviPointerList<KviClassEditorT
}
}
-/*
+
void KviClassEditor::removeItemChildren(KviClassEditorTreeWidgetItem *it)
{
while(it->childCount() > 0)
@@ -1212,10 +1148,12 @@ bool KviClassEditor::removeItem(KviClassEditorTreeWidgetItem *it,bool * pbYesToA
{
if(it->isClass())
KviQString::sprintf(szMsg,__tr2qs_ctx("Do you really want to remove the class \"%Q\" ?","editor"),&szName);
- else {
+ else
+ if(it->isNamespace())
+ {
KviQString::sprintf(szMsg,__tr2qs_ctx("Do you really want to remove the namespace \"%Q\" ?","editor"),&szName);
szMsg += "<br>";
- szMsg += __tr2qs_ctx("Please note that all the children items will be deleted too.","editor");
+ szMsg += __tr2qs_ctx("Please note that all the children classes/functions will be deleted too.","editor");
}
g_pClassEditorModule->lock();
@@ -1260,7 +1198,7 @@ void KviClassEditor::removeSelectedItems()
}
-*/
+
bool KviClassEditor::askForClassName(QString &szClassName,QString &szInheritsClassName, bool bEdit)
{
diff --git a/src/modules/classeditor/classeditor.h b/src/modules/classeditor/classeditor.h
index 9d95a197f..db217723c 100644
--- a/src/modules/classeditor/classeditor.h
+++ b/src/modules/classeditor/classeditor.h
@@ -133,7 +133,6 @@ public:
bool m_bSaving;
public:
//bool modified(){ return m_bModified; };
- //void setInheritedClassesNotBuilt(const QString &szInheritsClassName);
void saveProperties(KviConfig *);
void loadProperties(KviConfig *);
void loadUnbuildedFunctions();
@@ -145,8 +144,6 @@ public:
void exportClasses(bool,bool=false);
void exportSelectionInSinglesFiles(KviPointerList<KviClassEditorTreeWidgetItem> *l);
-
- //static void splitFullClassOrNamespaceName(const QString &szFullName,QStringList &lNamespaces,QString &szName);
void cutItem(KviClassEditorTreeWidgetItem *pItem);
protected slots:
@@ -166,7 +163,7 @@ protected slots:
void exportSelectedSepFiles();
void exportSelected();
/*
- void removeSelectedItems();
+
@@ -174,7 +171,6 @@ protected slots:
void slotCollapseNamespaces();
void slotFindWord(const QString &);
void slotReplaceAll(const QString &before,const QString &after);
- void itemRenamed(QTreeWidgetItem *it,int col);
void classRefresh(const QString &szName);
*/
@@ -184,13 +180,11 @@ protected:
/* void recursiveCollapseNamespaces(KviClassEditorTreeWidgetItem * it);
void recursiveSearchReplace(const QString &szSearch,KviClassEditorTreeWidgetItem * it,bool bReplace=false,const QString &szReplace="n");
- void recursiveCommit(KviClassEditorTreeWidgetItem * it);
*/
void getExportClassBuffer(QString &buffer,KviClassEditorTreeWidgetItem * it);
void oneTimeSetup();
void saveLastEditedItem();
- //void getUniqueItemName(KviClassEditorTreeWidgetItem *item,QString &buffer,KviClassEditorTreeWidgetItem::Type eType);
void appendSelectedClassItems(KviPointerList<KviClassEditorTreeWidgetItem> * l);
void appendSelectedClassItemsRecursive(KviPointerList<KviClassEditorTreeWidgetItem> * l,QTreeWidgetItem * pStartFrom);
void appendAllClassItems(KviPointerList<KviClassEditorTreeWidgetItem> * l);
@@ -204,34 +198,14 @@ protected:
bool askForFunction(QString &szFunctionName,bool * bInternal, const QString &szClassName);
void searchInheritedClasses(const QString szClass,KviPointerList<KviClassEditorTreeWidgetItem> & pInheritsedClasses);
bool classExists(QString &szFullItemName);
- //void renameClassOrNamespace();
void renameClass(KviClassEditorTreeWidgetItem *pClassItem);
void renameNamespace(KviClassEditorTreeWidgetItem *pNamespaceItem);
-bool namespaceExists(QString &szFullItemName);
+ void removeSelectedItems();
-/*
bool removeItem(KviClassEditorTreeWidgetItem *it,bool * pbYesToAll,bool bDeleteEmptyTree);
void removeItemChildren(KviClassEditorTreeWidgetItem *it);
-
-
-
-
-
-
-
+ void appendSelectedItems(KviPointerList<KviClassEditorTreeWidgetItem> * l);
void appendAllItems(KviPointerList<KviClassEditorTreeWidgetItem> * l,KviClassEditorTreeWidgetItem::Type);
- void appendAllItemsRecursive(KviPointerList<KviClassEditorTreeWidgetItem> * l,QTreeWidgetItem * pStartFrom,KviClassEditorTreeWidgetItem::Type);
-
-
-
- KviClassEditorTreeWidgetItem * createFullItemRecursive(QTreeWidgetItem *pCurrent,QStringList & lNameSpaces,int & iLevel);
- KviClassEditorTreeWidgetItem * findItemRecursive(QTreeWidgetItem *it,QStringList & lNameSpaces,int & iLevel);
-
- */
- // bool itemExistsRecursive(QTreeWidgetItem *pSearchFor,QTreeWidgetItem * pSearchAt);
- bool itemExists(QTreeWidgetItem *pSearchFor);
- bool itemExists(const QString &szFullName);
-
void buildFullItemPath(KviClassEditorTreeWidgetItem * it,QString &szBuffer);
QString buildFullClassName(KviClassEditorTreeWidgetItem * it);
KviClassEditorTreeWidgetItem * createFullItem(const QString &szFullName);