<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><br><span class="tab"> Pushed. Thanks.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br><span class="tab"></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span class="tab"> Regards,</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span class="tab"> Dimitar Dobrev</span><span class="tab"><br></span></div><div><br></div> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div
style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> <hr size="1"> <b><span style="font-weight:bold;">From:</span></b> David Lechner <david@lechnology.com><br> <b><span style="font-weight: bold;">To:</span></b> kde-bindings@kde.org <br> <b><span style="font-weight: bold;">Sent:</span></b> Thursday, January 31, 2013 9:42 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> [Kde-bindings] qyoto - patch - member variable access modifier<br> </font> </div> <br>
<div id="yiv97972913">
<div>
<div class="yiv97972913moz-text-flowed" style="font-family:-moz-fixed;font-size:14px;" lang="x-western">I just started using qyoto and
I am really liking it. I have a patch to submit.
<br>
<br>
The most recent commit added some options to the uics tool, so
this should be fresh in someones memory. I would like to add one
more option. Namely the ability to specify the access modifier for
member variables.
<br>
<br>
Here is the patch:
<br>
<br>
From 128e12578f4ee20a9491337464cc3ed9dd6ed93b Mon Sep 17 00:00:00
2001
<br>
From: David Lechner <a rel="nofollow" class="yiv97972913moz-txt-link-rfc2396E" ymailto="mailto:david@lechnology.com" target="_blank" href="mailto:david@lechnology.com"><david@lechnology.com></a>
<br>
Date: Thu, 31 Jan 2013 12:50:46 -0600
<br>
Subject: [PATCH] add member access modifier option
<br>
<br>
---
<br>
tools/uics/cs/cswritedeclaration.cpp | 28
+++++++++++++++++++++++-----
<br>
tools/uics/main.cpp | 10 +++++++++-
<br>
tools/uics/option.h | 1 +
<br>
3 files changed, 33 insertions(+), 6 deletions(-)
<br>
<br>
diff --git a/tools/uics/cs/cswritedeclaration.cpp
b/tools/uics/cs/cswritedeclaration.cpp
<br>
index ccfb3ef..efccdf1 100644
<br>
--- a/tools/uics/cs/cswritedeclaration.cpp
<br>
+++ b/tools/uics/cs/cswritedeclaration.cpp
<br>
@@ -163,10 +163,13 @@ void WriteDeclaration::acceptUI(DomUI *node)
<br>
void WriteDeclaration::acceptWidget(DomWidget *node)
<br>
{
<br>
QString className = QLatin1String("QWidget");
<br>
+ QString memberAccess = QString("public").trimmed();
<br>
if (node->hasAttributeClass())
<br>
className = node->attributeClass();
<br>
+ if (!option.memberAccess.isEmpty())
<br>
+ memberAccess = option.memberAccess;
<br>
<br>
- output << option.indent << "public " <<
uic->customWidgetsInfo()->realClassName(className) <<
" " << driver->findOrInsertWidget(node) << ";\n";
<br>
+ output << option.indent << memberAccess <<
" " <<
uic->customWidgetsInfo()->realClassName(className) <<
" " << driver->findOrInsertWidget(node) << ";\n";
<br>
<br>
TreeWalker::acceptWidget(node);
<br>
}
<br>
@@ -174,31 +177,46 @@ void
WriteDeclaration::acceptWidget(DomWidget *node)
<br>
void WriteDeclaration::acceptLayout(DomLayout *node)
<br>
{
<br>
QString className = QLatin1String("QLayout");
<br>
+ QString memberAccess = QString("public").trimmed();
<br>
if (node->hasAttributeClass())
<br>
className = node->attributeClass();
<br>
+ if (!option.memberAccess.isEmpty())
<br>
+ memberAccess = option.memberAccess;
<br>
<br>
- output << option.indent << "public " <<
className << " " <<
driver->findOrInsertLayout(node) << ";\n";
<br>
+ output << option.indent << memberAccess <<
" " << className << " " <<
driver->findOrInsertLayout(node) << ";\n";
<br>
<br>
TreeWalker::acceptLayout(node);
<br>
}
<br>
<br>
void WriteDeclaration::acceptSpacer(DomSpacer *node)
<br>
{
<br>
- output << option.indent << "public QSpacerItem "
<< driver->findOrInsertSpacer(node) << ";\n";
<br>
+ QString memberAccess = QString("public").trimmed();
<br>
+ if (!option.memberAccess.isEmpty())
<br>
+ memberAccess = option.memberAccess;
<br>
+
<br>
+ output << option.indent << memberAccess <<
" QSpacerItem " << driver->findOrInsertSpacer(node)
<< ";\n";
<br>
<br>
TreeWalker::acceptSpacer(node);
<br>
}
<br>
<br>
void WriteDeclaration::acceptActionGroup(DomActionGroup *node)
<br>
{
<br>
- output << option.indent << "public QActionGroup "
<< driver->findOrInsertActionGroup(node) << ";\n";
<br>
+ QString memberAccess = QString("public").trimmed();
<br>
+ if (!option.memberAccess.isEmpty())
<br>
+ memberAccess = option.memberAccess;
<br>
+
<br>
+ output << option.indent << memberAccess <<
" QActionGroup " << driver->findOrInsertActionGroup(node)
<< ";\n";
<br>
<br>
TreeWalker::acceptActionGroup(node);
<br>
}
<br>
<br>
void WriteDeclaration::acceptAction(DomAction *node)
<br>
{
<br>
- output << option.indent << "public QAction "
<< driver->findOrInsertAction(node) << ";\n";
<br>
+ QString memberAccess = QString("public").trimmed();
<br>
+ if (!option.memberAccess.isEmpty())
<br>
+ memberAccess = option.memberAccess;
<br>
+
<br>
+ output << option.indent << memberAccess <<
" QAction " << driver->findOrInsertAction(node) <<
";\n";
<br>
<br>
TreeWalker::acceptAction(node);
<br>
}
<br>
diff --git a/tools/uics/main.cpp b/tools/uics/main.cpp
<br>
index 719b227..4dc3153 100644
<br>
--- a/tools/uics/main.cpp
<br>
+++ b/tools/uics/main.cpp
<br>
@@ -45,7 +45,8 @@ void showHelp(const char *appName)
<br>
" -x generate extra code to
test the class\n"
<br>
" -n, -namespace generate the class in
this namespace\n"
<br>
" -c, -class generate the class with
this name\n"
<br>
- " -a, -access the access modofier of
the class\n"
<br>
+ " -a, -access the access modifier of
the class\n"
<br>
+ " -ma, -member-access the access modifier of
the member variables\n"
<br>
"\n", appName);
<br>
}
<br>
<br>
@@ -129,6 +130,13 @@ int main(int argc, char *argv[])
<br>
return 1;
<br>
}
<br>
driver.option().access = QLatin1String(argv[arg]);
<br>
+ } else if (opt == QLatin1String("-ma") || opt ==
QLatin1String("-member-access")) {
<br>
+ ++arg;
<br>
+ if (!argv[arg]) {
<br>
+ showHelp(argv[0]);
<br>
+ return 1;
<br>
+ }
<br>
+ driver.option().memberAccess =
QLatin1String(argv[arg]);
<br>
} else if (!fileName) {
<br>
fileName = argv[arg];
<br>
} else {
<br>
diff --git a/tools/uics/option.h b/tools/uics/option.h
<br>
index a785452..867ed52 100644
<br>
--- a/tools/uics/option.h
<br>
+++ b/tools/uics/option.h
<br>
@@ -49,6 +49,7 @@ struct Option
<br>
QString name_space;
<br>
QString klass;
<br>
QString access;
<br>
+ QString memberAccess;
<br>
QString translateFunction;
<br>
QString uic3;
<br>
#ifdef QT_UIC_JAVA_GENERATOR
<br>
<div class="yiv97972913moz-txt-sig"><span class="yiv97972913moz-txt-tag">-- <br>
</span>1.7.10.4
<br>
<br>
<br>
</div>
</div>
</div>
</div><br>_______________________________________________<br>Kde-bindings mailing list<br><a ymailto="mailto:Kde-bindings@kde.org" href="mailto:Kde-bindings@kde.org">Kde-bindings@kde.org</a><br><a href="https://mail.kde.org/mailman/listinfo/kde-bindings" target="_blank">https://mail.kde.org/mailman/listinfo/kde-bindings</a><br><br><br> </div> </div> </div></body></html>