[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [assemblygen] tools/uics: add member access modifier option
From: Dimitar Dobrev <dpldobrev () yahoo ! com>
Date: 2013-01-31 21:01:45
Message-ID: 20130131210145.28E7CA6091 () git ! kde ! org
[Download RAW message or body]
Git commit 58b7befae0703808a9b748abc9e5ccee3e10be2f by Dimitar Dobrev, on behalf of \
David Lechner. Committed on 31/01/2013 at 19:50.
Pushed by ddobrev into branch 'master'.
add member access modifier option
M +23 -5 tools/uics/cs/cswritedeclaration.cpp
M +9 -1 tools/uics/main.cpp
M +1 -0 tools/uics/option.h
http://commits.kde.org/assemblygen/58b7befae0703808a9b748abc9e5ccee3e10be2f
diff --git a/tools/uics/cs/cswritedeclaration.cpp \
b/tools/uics/cs/cswritedeclaration.cpp index ccfb3ef..efccdf1 100644
--- a/tools/uics/cs/cswritedeclaration.cpp
+++ b/tools/uics/cs/cswritedeclaration.cpp
@@ -163,10 +163,13 @@ void WriteDeclaration::acceptUI(DomUI *node)
void WriteDeclaration::acceptWidget(DomWidget *node)
{
QString className = QLatin1String("QWidget");
+ QString memberAccess = QString("public").trimmed();
if (node->hasAttributeClass())
className = node->attributeClass();
+ if (!option.memberAccess.isEmpty())
+ memberAccess = option.memberAccess;
- output << option.indent << "public " << \
uic->customWidgetsInfo()->realClassName(className) << " " << \
driver->findOrInsertWidget(node) << ";\n"; + output << option.indent << \
memberAccess << " " << uic->customWidgetsInfo()->realClassName(className) << " " << \
driver->findOrInsertWidget(node) << ";\n";
TreeWalker::acceptWidget(node);
}
@@ -174,31 +177,46 @@ void WriteDeclaration::acceptWidget(DomWidget *node)
void WriteDeclaration::acceptLayout(DomLayout *node)
{
QString className = QLatin1String("QLayout");
+ QString memberAccess = QString("public").trimmed();
if (node->hasAttributeClass())
className = node->attributeClass();
+ if (!option.memberAccess.isEmpty())
+ memberAccess = option.memberAccess;
- output << option.indent << "public " << className << " " << \
driver->findOrInsertLayout(node) << ";\n"; + output << option.indent << \
memberAccess << " " << className << " " << driver->findOrInsertLayout(node) << ";\n"; \
TreeWalker::acceptLayout(node);
}
void WriteDeclaration::acceptSpacer(DomSpacer *node)
{
- output << option.indent << "public QSpacerItem " << \
driver->findOrInsertSpacer(node) << ";\n"; + QString memberAccess = \
QString("public").trimmed(); + if (!option.memberAccess.isEmpty())
+ memberAccess = option.memberAccess;
+
+ output << option.indent << memberAccess << " QSpacerItem " << \
driver->findOrInsertSpacer(node) << ";\n";
TreeWalker::acceptSpacer(node);
}
void WriteDeclaration::acceptActionGroup(DomActionGroup *node)
{
- output << option.indent << "public QActionGroup " << \
driver->findOrInsertActionGroup(node) << ";\n"; + QString memberAccess = \
QString("public").trimmed(); + if (!option.memberAccess.isEmpty())
+ memberAccess = option.memberAccess;
+
+ output << option.indent << memberAccess << " QActionGroup " << \
driver->findOrInsertActionGroup(node) << ";\n";
TreeWalker::acceptActionGroup(node);
}
void WriteDeclaration::acceptAction(DomAction *node)
{
- output << option.indent << "public QAction " << driver->findOrInsertAction(node) \
<< ";\n"; + QString memberAccess = QString("public").trimmed();
+ if (!option.memberAccess.isEmpty())
+ memberAccess = option.memberAccess;
+
+ output << option.indent << memberAccess << " QAction " << \
driver->findOrInsertAction(node) << ";\n";
TreeWalker::acceptAction(node);
}
diff --git a/tools/uics/main.cpp b/tools/uics/main.cpp
index 719b227..4dc3153 100644
--- a/tools/uics/main.cpp
+++ b/tools/uics/main.cpp
@@ -45,7 +45,8 @@ void showHelp(const char *appName)
" -x generate extra code to test the class\n"
" -n, -namespace generate the class in this namespace\n"
" -c, -class generate the class with this name\n"
- " -a, -access the access modofier of the class\n"
+ " -a, -access the access modifier of the class\n"
+ " -ma, -member-access the access modifier of the member \
variables\n" "\n", appName);
}
@@ -129,6 +130,13 @@ int main(int argc, char *argv[])
return 1;
}
driver.option().access = QLatin1String(argv[arg]);
+ } else if (opt == QLatin1String("-ma") || opt == \
QLatin1String("-member-access")) { + ++arg;
+ if (!argv[arg]) {
+ showHelp(argv[0]);
+ return 1;
+ }
+ driver.option().memberAccess = QLatin1String(argv[arg]);
} else if (!fileName) {
fileName = argv[arg];
} else {
diff --git a/tools/uics/option.h b/tools/uics/option.h
index a785452..867ed52 100644
--- a/tools/uics/option.h
+++ b/tools/uics/option.h
@@ -49,6 +49,7 @@ struct Option
QString name_space;
QString klass;
QString access;
+ QString memberAccess;
QString translateFunction;
QString uic3;
#ifdef QT_UIC_JAVA_GENERATOR
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic