Bug 149341 - [Qyoto][PATCH] a dirty hack to enable "using QScintilla;" directive if a ui file use QScintilla Widget
Summary: [Qyoto][PATCH] a dirty hack to enable "using QScintilla;" directive if a ui f...
Status: RESOLVED WORKSFORME
Alias: None
Product: bindings
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kde-bindings
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-29 17:29 UTC by cjacker
Modified: 2023-01-06 05:23 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cjacker 2007-08-29 17:29:51 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

QScintilla for Qt4 provide a customwidget for Qt4 designer, I can use it to add a special QScintilla Widget in a Form, then get a ui file include QScintilla Widget.

if I use uics to generate the csharp code, it did not add "using QScintilla;" driective automatically. so I had to modify the result by hand.

It is not a good idea to modify a intermediate file.

So I hacked the uics and add a dirty hack here.

dirty but works(uics's codes are also not so clean:-D)

diff -Nur qt4-qyoto-1.0.0/csharp/qyoto/tools/uics/cs/cswriteincludes.cpp qt4-qyoto-1.0.0new/csharp/qyoto/tools/uics/cs/cswriteincludes.cpp
--- qt4-qyoto-1.0.0/csharp/qyoto/tools/uics/cs/cswriteincludes.cpp	2007-06-26 23:24:24.000000000 +0800
+++ qt4-qyoto-1.0.0new/csharp/qyoto/tools/uics/cs/cswriteincludes.cpp	2007-08-29 22:52:46.000000000 +0800
@@ -55,7 +55,10 @@
         ++it;
     }
 }
-
+void WriteIncludes::addScintilla()
+{
+    output << "using QScintilla;\n\n";
+}
 void WriteIncludes::acceptUI(DomUI *node)
 {
 /*    m_includes.clear();
diff -Nur qt4-qyoto-1.0.0/csharp/qyoto/tools/uics/cs/cswriteincludes.h qt4-qyoto-1.0.0new/csharp/qyoto/tools/uics/cs/cswriteincludes.h
--- qt4-qyoto-1.0.0/csharp/qyoto/tools/uics/cs/cswriteincludes.h	2007-06-26 23:24:24.000000000 +0800
+++ qt4-qyoto-1.0.0new/csharp/qyoto/tools/uics/cs/cswriteincludes.h	2007-08-29 22:52:46.000000000 +0800
@@ -39,6 +39,7 @@
     WriteIncludes(Uic *uic);
 
     void acceptUI(DomUI *node);
+    void addScintilla();
     void acceptWidget(DomWidget *node);
     void acceptLayout(DomLayout *node);
     void acceptSpacer(DomSpacer *node);
diff -Nur qt4-qyoto-1.0.0/csharp/qyoto/tools/uics/uic.cpp qt4-qyoto-1.0.0new/csharp/qyoto/tools/uics/uic.cpp
--- qt4-qyoto-1.0.0/csharp/qyoto/tools/uics/uic.cpp	2007-06-26 23:24:25.000000000 +0800
+++ qt4-qyoto-1.0.0new/csharp/qyoto/tools/uics/uic.cpp	2007-08-29 22:52:33.000000000 +0800
@@ -60,6 +60,50 @@
 {
 }
 
+bool Uic::useScintilla()
+{
+    QString fileName = opt.inputFile;
+
+    QFile f;
+    if (fileName.isEmpty())
+        f.open(stdin, QIODevice::ReadOnly);
+    else {
+        f.setFileName(fileName);
+        if (!f.open(QIODevice::ReadOnly))
+            return false;
+    }
+
+    QDomDocument doc;                        // ### generalize. share more code with the other tools!
+    if (!doc.setContent(&f))
+        return false;
+
+    QDomElement root = doc.firstChild().toElement();
+    DomUI *ui = new DomUI();
+    ui->read(root);
+
+    double version = ui->attributeVersion().toDouble();
+    if (version < 4.0) {
+        delete ui;
+
+        fprintf(stderr, "uic: File generated with too old version of Qt Designer\n");
+        return false;
+    }
+
+    if (DomCustomWidgets *customWidgets = ui->elementCustomWidgets()) {
+        foreach (DomCustomWidget *customWidget, customWidgets->elementCustomWidget()) {
+            if (DomHeader *header = customWidget->elementHeader()) {
+                QString file = header->text();
+                if (file.isEmpty())
+                    continue;
+	            if(file.contains("scintilla"))
+                	return true;
+            }
+        }
+    }
+    delete ui;
+    return false;
+}
+
 bool Uic::printDependencies()
 {
     QString fileName = opt.inputFile;
@@ -201,6 +245,8 @@
     info.acceptUI(ui);
     cWidgetsInfo.acceptUI(ui);
     WriteIncludes(this).acceptUI(ui);
+	if(useScintilla())
+		WriteIncludes(this).addScintilla();
 
     Validator(this).acceptUI(ui);
 
diff -Nur qt4-qyoto-1.0.0/csharp/qyoto/tools/uics/uic.h qt4-qyoto-1.0.0new/csharp/qyoto/tools/uics/uic.h
--- qt4-qyoto-1.0.0/csharp/qyoto/tools/uics/uic.h	2007-06-26 23:24:24.000000000 +0800
+++ qt4-qyoto-1.0.0new/csharp/qyoto/tools/uics/uic.h	2007-08-29 22:52:33.000000000 +0800
@@ -49,6 +49,7 @@
     ~Uic();
 
     bool printDependencies();
+    bool useScintilla();
 
     inline Driver *driver() const
     { return drv; }
Comment 1 Andrew Crouthamel 2018-11-02 04:26:22 UTC
Dear Bug Submitter,

This bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? I am setting the status to NEEDSINFO pending your response, please change the Status back to REPORTED when you respond.

Thank you for helping us make KDE software even better for everyone!
Comment 2 Andrew Crouthamel 2018-11-16 02:41:06 UTC
Dear Bug Submitter,

This is a reminder that this bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version?

Thank you for helping us make KDE software even better for everyone!
Comment 3 Justin Zobel 2022-12-07 00:23:42 UTC
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 4 Bug Janitor Service 2022-12-22 05:19:07 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 5 Bug Janitor Service 2023-01-06 05:23:01 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!