uic: Remove remains of old Java generator
Preparing the use of the option for Python. Task-number: PYSIDE-797 Change-Id: Ia1267b227ceac7f9dcbcfde6ed7c1480ef790f2a Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
parent
c6af950bfd
commit
235ea594ad
@ -1,7 +1,5 @@
|
||||
INCLUDEPATH += $$PWD $$QT_BUILD_TREE/src/tools/uic
|
||||
|
||||
DEFINES += QT_UIC_CPP_GENERATOR
|
||||
|
||||
# Input
|
||||
HEADERS += $$PWD/cppwritedeclaration.h \
|
||||
$$PWD/cppwriteincludes.h \
|
||||
|
@ -256,18 +256,11 @@ bool Driver::uic(const QString &fileName, DomUI *ui, QTextStream *out)
|
||||
m_output = out != 0 ? out : &m_stdout;
|
||||
|
||||
Uic tool(this);
|
||||
bool rtn = false;
|
||||
#ifdef QT_UIC_CPP_GENERATOR
|
||||
rtn = tool.write(ui);
|
||||
#else
|
||||
Q_UNUSED(ui);
|
||||
fprintf(stderr, "uic: option to generate cpp code not compiled in [%s:%d]\n",
|
||||
__FILE__, __LINE__);
|
||||
#endif
|
||||
const bool result = tool.write(ui);
|
||||
|
||||
m_output = oldOutput;
|
||||
|
||||
return rtn;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool Driver::uic(const QString &fileName, QTextStream *out)
|
||||
|
@ -115,7 +115,6 @@ int runUic(int argc, char *argv[])
|
||||
driver.option().postfix = parser.value(postfixOption);
|
||||
driver.option().translateFunction = parser.value(translateOption);
|
||||
driver.option().includeFile = parser.value(includeOption);
|
||||
driver.option().generator = (parser.value(generatorOption).toLower() == QLatin1String("java")) ? Option::JavaGenerator : Option::CppGenerator;
|
||||
|
||||
if (parser.isSet(noStringLiteralOption))
|
||||
fprintf(stderr, "The -s, --no-stringliteral option is deprecated and it won't take any effect.\n");
|
||||
|
@ -36,12 +36,6 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
struct Option
|
||||
{
|
||||
enum Generator
|
||||
{
|
||||
CppGenerator,
|
||||
JavaGenerator
|
||||
};
|
||||
|
||||
unsigned int headerProtection : 1;
|
||||
unsigned int copyrightHeader : 1;
|
||||
unsigned int generateImplemetation : 1;
|
||||
@ -51,7 +45,6 @@ struct Option
|
||||
unsigned int limitXPM_LineLength : 1;
|
||||
unsigned int implicitIncludes: 1;
|
||||
unsigned int idBased: 1;
|
||||
Generator generator;
|
||||
|
||||
QString inputFile;
|
||||
QString outputFile;
|
||||
@ -61,10 +54,6 @@ struct Option
|
||||
QString postfix;
|
||||
QString translateFunction;
|
||||
QString includeFile;
|
||||
#ifdef QT_UIC_JAVA_GENERATOR
|
||||
QString javaPackage;
|
||||
QString javaOutputDirectory;
|
||||
#endif
|
||||
|
||||
Option()
|
||||
: headerProtection(1),
|
||||
@ -76,7 +65,6 @@ struct Option
|
||||
limitXPM_LineLength(0),
|
||||
implicitIncludes(1),
|
||||
idBased(0),
|
||||
generator(CppGenerator),
|
||||
prefix(QLatin1String("Ui_"))
|
||||
{ indent.fill(QLatin1Char(' '), 4); }
|
||||
|
||||
|
@ -33,18 +33,12 @@
|
||||
#include "treewalker.h"
|
||||
#include "validator.h"
|
||||
|
||||
#ifdef QT_UIC_CPP_GENERATOR
|
||||
#include "cppwriteincludes.h"
|
||||
#include "cppwritedeclaration.h"
|
||||
#endif
|
||||
|
||||
#ifdef QT_UIC_JAVA_GENERATOR
|
||||
#include "javawriteincludes.h"
|
||||
#include "javawritedeclaration.h"
|
||||
#endif
|
||||
|
||||
#include <qxmlstream.h>
|
||||
#include <qfileinfo.h>
|
||||
#include <qscopedpointer.h>
|
||||
#include <qtextstream.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -172,65 +166,33 @@ DomUI *Uic::parseUiFile(QXmlStreamReader &reader)
|
||||
|
||||
bool Uic::write(QIODevice *in)
|
||||
{
|
||||
if (option().generator == Option::JavaGenerator) {
|
||||
// the Java generator ignores header protection
|
||||
opt.headerProtection = false;
|
||||
}
|
||||
|
||||
DomUI *ui = 0;
|
||||
QScopedPointer<DomUI> ui;
|
||||
{
|
||||
QXmlStreamReader reader;
|
||||
reader.setDevice(in);
|
||||
ui = parseUiFile(reader);
|
||||
|
||||
if (!ui)
|
||||
return false;
|
||||
ui.reset(parseUiFile(reader));
|
||||
}
|
||||
|
||||
if (ui.isNull())
|
||||
return false;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
QString language = ui->attributeLanguage();
|
||||
const QString &language = ui->attributeLanguage();
|
||||
driver()->setUseIdBasedTranslations(ui->attributeIdbasedtr());
|
||||
|
||||
bool rtn = false;
|
||||
|
||||
if (option().generator == Option::JavaGenerator) {
|
||||
#ifdef QT_UIC_JAVA_GENERATOR
|
||||
if (language.toLower() != QLatin1String("jambi")) {
|
||||
fprintf(stderr, "uic: File is not a 'jambi' form\n");
|
||||
delete ui;
|
||||
return false;
|
||||
}
|
||||
rtn = jwrite (ui);
|
||||
#else
|
||||
fprintf(stderr, "uic: option to generate java code not compiled in\n");
|
||||
#endif
|
||||
} else {
|
||||
#ifdef QT_UIC_CPP_GENERATOR
|
||||
if (!language.isEmpty() && language.toLower() != QLatin1String("c++")) {
|
||||
fprintf(stderr, "uic: File is not a 'c++' ui file, language=%s\n", qPrintable(language));
|
||||
delete ui;
|
||||
return false;
|
||||
}
|
||||
|
||||
rtn = write (ui);
|
||||
#else
|
||||
fprintf(stderr, "uic: option to generate cpp code not compiled in\n");
|
||||
#endif
|
||||
if (!language.isEmpty() && language.compare(QLatin1String("c++"), Qt::CaseInsensitive) != 0) {
|
||||
fprintf(stderr, "uic: File is not a \"c++\" ui file, language=%s\n", qPrintable(language));
|
||||
return false;
|
||||
}
|
||||
|
||||
delete ui;
|
||||
|
||||
return rtn;
|
||||
return write(ui.data());
|
||||
}
|
||||
|
||||
#ifdef QT_UIC_CPP_GENERATOR
|
||||
bool Uic::write(DomUI *ui)
|
||||
{
|
||||
using namespace CPP;
|
||||
@ -267,37 +229,6 @@ bool Uic::write(DomUI *ui)
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef QT_UIC_JAVA_GENERATOR
|
||||
bool Uic::jwrite(DomUI *ui)
|
||||
{
|
||||
using namespace Java;
|
||||
|
||||
if (!ui || !ui->elementWidget())
|
||||
return false;
|
||||
|
||||
if (opt.copyrightHeader)
|
||||
writeCopyrightHeader(ui);
|
||||
|
||||
pixFunction = ui->elementPixmapFunction();
|
||||
if (pixFunction == QLatin1String("QPixmap::fromMimeSource"))
|
||||
pixFunction = QLatin1String("qPixmapFromMimeSource");
|
||||
|
||||
externalPix = ui->elementImages() == 0;
|
||||
|
||||
info.acceptUI(ui);
|
||||
cWidgetsInfo.acceptUI(ui);
|
||||
WriteIncludes(this).acceptUI(ui);
|
||||
|
||||
Validator(this).acceptUI(ui);
|
||||
WriteDeclaration(this).acceptUI(ui);
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef QT_UIC_CPP_GENERATOR
|
||||
|
||||
void Uic::writeHeaderProtectionStart()
|
||||
{
|
||||
@ -311,7 +242,6 @@ void Uic::writeHeaderProtectionEnd()
|
||||
QString h = drv->headerFileName();
|
||||
out << "#endif // " << h << "\n";
|
||||
}
|
||||
#endif
|
||||
|
||||
bool Uic::isMainWindow(const QString &className) const
|
||||
{
|
||||
|
@ -83,13 +83,7 @@ public:
|
||||
|
||||
bool write(QIODevice *in);
|
||||
|
||||
#ifdef QT_UIC_JAVA_GENERATOR
|
||||
bool jwrite(DomUI *ui);
|
||||
#endif
|
||||
|
||||
#ifdef QT_UIC_CPP_GENERATOR
|
||||
bool write(DomUI *ui);
|
||||
#endif
|
||||
|
||||
bool isMainWindow(const QString &className) const;
|
||||
bool isToolBar(const QString &className) const;
|
||||
@ -105,11 +99,9 @@ private:
|
||||
void writeCopyrightHeader(DomUI *ui);
|
||||
DomUI *parseUiFile(QXmlStreamReader &reader);
|
||||
|
||||
#ifdef QT_UIC_CPP_GENERATOR
|
||||
// header protection
|
||||
void writeHeaderProtectionStart();
|
||||
void writeHeaderProtectionEnd();
|
||||
#endif
|
||||
|
||||
private:
|
||||
Driver *drv;
|
||||
|
Loading…
Reference in New Issue
Block a user