summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorThomas Zander <t.zander@nokia.com>2010-09-28 11:44:45 (GMT)
committerThomas Zander <t.zander@nokia.com>2010-09-28 11:44:45 (GMT)
commit5c08412285f14d89174aef1190a1de1c35fd62bd (patch)
tree2e9bef2fdf0af18db76b011cd9c4ed4b456f507c /src/tools
parent2645784f05db7b1e631621c511e94c88fc5cd211 (diff)
parent2868302626b8a31f44df1068514485a89ec27171 (diff)
downloadQt-5c08412285f14d89174aef1190a1de1c35fd62bd.zip
Qt-5c08412285f14d89174aef1190a1de1c35fd62bd.tar.gz
Qt-5c08412285f14d89174aef1190a1de1c35fd62bd.tar.bz2
Merge commit 'origin/master' into fileEnginesOn47
Conflicts: qmake/Makefile.win32 qmake/qmake.pri src/corelib/io/qdir.cpp src/corelib/io/qfileinfo.cpp src/corelib/io/qfileinfo_p.h src/corelib/io/qfsfileengine_win.cpp src/s60installs/bwins/QtGuiu.def src/s60installs/eabi/QtCoreu.def src/s60installs/eabi/QtGuiu.def src/tools/bootstrap/bootstrap.pro tests/auto/qfileinfo/tst_qfileinfo.cpp
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/bootstrap/bootstrap.pri4
-rw-r--r--src/tools/bootstrap/bootstrap.pro5
-rw-r--r--src/tools/moc/generator.cpp48
-rw-r--r--src/tools/moc/moc.cpp58
-rw-r--r--src/tools/moc/moc.h1
-rw-r--r--src/tools/rcc/rcc.cpp7
-rw-r--r--src/tools/uic/cpp/cppextractimages.cpp8
-rw-r--r--src/tools/uic/cpp/cppwriteincludes.cpp10
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.cpp125
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.h1
-rw-r--r--src/tools/uic/driver.cpp5
-rw-r--r--src/tools/uic/option.h8
-rw-r--r--src/tools/uic/ui4.cpp11
-rw-r--r--src/tools/uic/ui4.h8
14 files changed, 207 insertions, 92 deletions
diff --git a/src/tools/bootstrap/bootstrap.pri b/src/tools/bootstrap/bootstrap.pri
index 1aa8121..f48c8c1 100644
--- a/src/tools/bootstrap/bootstrap.pri
+++ b/src/tools/bootstrap/bootstrap.pri
@@ -22,7 +22,9 @@ DEFINES += \
QT_NO_TEXTSTREAM \
QT_NO_THREAD \
QT_NO_UNICODETABLES \
- QT_NO_USING_NAMESPACE
+ QT_NO_USING_NAMESPACE \
+ QT_NO_DEPRECATED
+
win32:DEFINES += QT_NODLL
INCLUDEPATH += $$QT_BUILD_TREE/include \
diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro
index 179cb0b..6531a83 100644
--- a/src/tools/bootstrap/bootstrap.pro
+++ b/src/tools/bootstrap/bootstrap.pro
@@ -25,7 +25,9 @@ DEFINES += \
QT_NO_TEXTSTREAM \
QT_NO_THREAD \
QT_NO_UNICODETABLES \
- QT_NO_USING_NAMESPACE
+ QT_NO_USING_NAMESPACE \
+ QT_NO_DEPRECATED
+
win32:DEFINES += QT_NODLL
INCLUDEPATH += $$QT_BUILD_TREE/include \
@@ -92,6 +94,7 @@ unix:SOURCES += ../../corelib/io/qfilesystemengine_unix.cpp \
win32:SOURCES += ../../corelib/io/qfilesystemengine_win.cpp \
../../corelib/io/qfilesystemiterator_win.cpp \
../../corelib/io/qfsfileengine_win.cpp \
+ ../../corelib/plugin/qsystemlibrary.cpp \
macx: {
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 #enables weak linking for 10.4 (exported)
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index 9a982d0..c3bbba1 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -483,54 +483,6 @@ void Generator::generateFunctions(QList<FunctionDef>& list, const char *functype
void Generator::generateProperties()
{
//
- // specify get function, for compatibiliy we accept functions
- // returning pointers, or const char * for QByteArray.
- //
- for (int i = 0; i < cdef->propertyList.count(); ++i) {
- PropertyDef &p = cdef->propertyList[i];
- if (p.read.isEmpty())
- continue;
- for (int j = 0; j < cdef->publicList.count(); ++j) {
- const FunctionDef &f = cdef->publicList.at(j);
- if (f.name != p.read)
- continue;
- if (!f.isConst) // get functions must be const
- continue;
- if (f.arguments.size()) // and must not take any arguments
- continue;
- PropertyDef::Specification spec = PropertyDef::ValueSpec;
- QByteArray tmp = f.normalizedType;
- if (p.type == "QByteArray" && tmp == "const char *")
- tmp = "QByteArray";
- if (tmp.left(6) == "const ")
- tmp = tmp.mid(6);
- if (p.type != tmp && tmp.endsWith('*')) {
- tmp.chop(1);
- spec = PropertyDef::PointerSpec;
- } else if (f.type.name.endsWith('&')) { // raw type, not normalized type
- spec = PropertyDef::ReferenceSpec;
- }
- if (p.type != tmp)
- continue;
- p.gspec = spec;
- break;
- }
- if(!p.notify.isEmpty()) {
- int notifyId = -1;
- for (int j = 0; j < cdef->signalList.count(); ++j) {
- const FunctionDef &f = cdef->signalList.at(j);
- if(f.name != p.notify) {
- continue;
- } else {
- notifyId = j /* Signal indexes start from 0 */;
- break;
- }
- }
- p.notifyId = notifyId;
- }
- }
-
- //
// Create meta data
//
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index ac49d65..2c24165 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -727,6 +727,7 @@ void Moc::parse()
error("Class declarations lacks Q_OBJECT macro.");
checkSuperClasses(&def);
+ checkProperties(&def);
classList += def;
knownQObjectClasses.insert(def.classname);
@@ -1312,5 +1313,62 @@ void Moc::checkSuperClasses(ClassDef *def)
}
}
+void Moc::checkProperties(ClassDef *cdef)
+{
+ //
+ // specify get function, for compatibiliy we accept functions
+ // returning pointers, or const char * for QByteArray.
+ //
+ for (int i = 0; i < cdef->propertyList.count(); ++i) {
+ PropertyDef &p = cdef->propertyList[i];
+ if (p.read.isEmpty())
+ continue;
+ for (int j = 0; j < cdef->publicList.count(); ++j) {
+ const FunctionDef &f = cdef->publicList.at(j);
+ if (f.name != p.read)
+ continue;
+ if (!f.isConst) // get functions must be const
+ continue;
+ if (f.arguments.size()) // and must not take any arguments
+ continue;
+ PropertyDef::Specification spec = PropertyDef::ValueSpec;
+ QByteArray tmp = f.normalizedType;
+ if (p.type == "QByteArray" && tmp == "const char *")
+ tmp = "QByteArray";
+ if (tmp.left(6) == "const ")
+ tmp = tmp.mid(6);
+ if (p.type != tmp && tmp.endsWith('*')) {
+ tmp.chop(1);
+ spec = PropertyDef::PointerSpec;
+ } else if (f.type.name.endsWith('&')) { // raw type, not normalized type
+ spec = PropertyDef::ReferenceSpec;
+ }
+ if (p.type != tmp)
+ continue;
+ p.gspec = spec;
+ break;
+ }
+ if(!p.notify.isEmpty()) {
+ int notifyId = -1;
+ for (int j = 0; j < cdef->signalList.count(); ++j) {
+ const FunctionDef &f = cdef->signalList.at(j);
+ if(f.name != p.notify) {
+ continue;
+ } else {
+ notifyId = j /* Signal indexes start from 0 */;
+ break;
+ }
+ }
+ p.notifyId = notifyId;
+ if (notifyId == -1) {
+ QByteArray msg = "NOTIFY signal '" + p.notify + "' of property '" + p.name
+ + "' does not exist in class " + cdef->classname + ".";
+ error(msg.constData());
+ }
+ }
+ }
+}
+
+
QT_END_NAMESPACE
diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h
index 9f349b5..5e47d9a 100644
--- a/src/tools/moc/moc.h
+++ b/src/tools/moc/moc.h
@@ -238,6 +238,7 @@ public:
bool testFunctionAttribute(Token tok, FunctionDef *def);
void checkSuperClasses(ClassDef *def);
+ void checkProperties(ClassDef* cdef);
};
inline QByteArray noRef(const QByteArray &type)
diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp
index 1f6e58f..0e3167d 100644
--- a/src/tools/rcc/rcc.cpp
+++ b/src/tools/rcc/rcc.cpp
@@ -544,8 +544,11 @@ bool RCCResourceLibrary::addFile(const QString &alias, const RCCFileInfo &file)
const QString filename = nodes.at(nodes.size()-1);
RCCFileInfo *s = new RCCFileInfo(file);
s->m_parent = parent;
- if (parent->m_children.contains(filename))
- qWarning("potential duplicate alias detected: '%s'", qPrintable(filename));
+ if (parent->m_children.contains(filename)) {
+ foreach (const QString &fileName, m_fileNames)
+ qWarning("%s: Warning: potential duplicate alias detected: '%s'",
+ qPrintable(fileName), qPrintable(filename));
+ }
parent->m_children.insertMulti(filename, s);
return true;
}
diff --git a/src/tools/uic/cpp/cppextractimages.cpp b/src/tools/uic/cpp/cppextractimages.cpp
index 52c1b9d..5809724 100644
--- a/src/tools/uic/cpp/cppextractimages.cpp
+++ b/src/tools/uic/cpp/cppextractimages.cpp
@@ -76,14 +76,14 @@ void ExtractImages::acceptUI(DomUI *node)
if (m_option.qrcOutputFile.size()) {
f.setFileName(m_option.qrcOutputFile);
if (!f.open(QIODevice::WriteOnly | QFile::Text)) {
- fprintf(stderr, "Could not create resource file\n");
+ fprintf(stderr, "%s: Error: Could not create resource file\n", qPrintable(m_option.messagePrefix()));
return;
}
QFileInfo fi(m_option.qrcOutputFile);
QDir dir = fi.absoluteDir();
if (!dir.exists(QLatin1String("images")) && !dir.mkdir(QLatin1String("images"))) {
- fprintf(stderr, "Could not create image dir\n");
+ fprintf(stderr, "%s: Error: Could not create image dir\n", qPrintable(m_option.messagePrefix()));
return;
}
dir.cd(QLatin1String("images"));
@@ -126,7 +126,9 @@ void ExtractImages::acceptImage(DomImage *image)
if (isXPM_GZ)
openMode |= QIODevice::Text;
if (!f.open(openMode)) {
- fprintf(stderr, "Could not create image file %s: %s", qPrintable(fname), qPrintable(f.errorString()));
+ fprintf(stderr, "%s: Error: Could not create image file %s: %s",
+ qPrintable(m_option.messagePrefix()),
+ qPrintable(fname), qPrintable(f.errorString()));
return;
}
diff --git a/src/tools/uic/cpp/cppwriteincludes.cpp b/src/tools/uic/cpp/cppwriteincludes.cpp
index 4e0ee4a..7b9d03a 100644
--- a/src/tools/uic/cpp/cppwriteincludes.cpp
+++ b/src/tools/uic/cpp/cppwriteincludes.cpp
@@ -126,8 +126,9 @@ void WriteIncludes::acceptUI(DomUI *node)
if (m_uic->hasExternalPixmap() && m_uic->pixmapFunction() == QLatin1String("qPixmapFromMimeSource")) {
#ifdef QT_NO_QT3_SUPPORT
- qWarning("Warning: The form file has external pixmaps or qPixmapFromMimeSource() set as a pixmap function. "
- "This requires Qt 3 support, which is disabled. The resulting code will not compile.");
+ qWarning("%s: Warning: The form file has external pixmaps or qPixmapFromMimeSource() set as a pixmap function. "
+ "This requires Qt 3 support, which is disabled. The resulting code will not compile.",
+ qPrintable(m_uic->option().messagePrefix()));
#endif
add(QLatin1String("Q3MimeSourceFactory"));
}
@@ -212,8 +213,9 @@ void WriteIncludes::insertIncludeForClass(const QString &className, QString head
header = lowerClassName;
header += QLatin1String(".h");
if (warnHeaderGeneration) {
- qWarning("Warning: generated header '%s' for class '%s'.", qPrintable(header),
- qPrintable(className));
+ qWarning("%s: Warning: generated header '%s' for class '%s'.",
+ qPrintable(m_uic->option().messagePrefix()),
+ qPrintable(header), qPrintable(className));
}
diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp
index dc1d181..a2bc89d 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.cpp
+++ b/src/tools/uic/cpp/cppwriteinitialization.cpp
@@ -139,13 +139,17 @@ namespace {
<< indent << "QWidgetList childWidgets;\n";
}
- static inline bool isIconFormat44(const DomResourceIcon *i) {
+ static inline bool iconHasStatePixmaps(const DomResourceIcon *i) {
return i->hasElementNormalOff() || i->hasElementNormalOn() ||
i->hasElementDisabledOff() || i->hasElementDisabledOn() ||
i->hasElementActiveOff() || i->hasElementActiveOn() ||
i->hasElementSelectedOff() || i->hasElementSelectedOn();
}
+ static inline bool isIconFormat44(const DomResourceIcon *i) {
+ return iconHasStatePixmaps(i) || !i->attributeTheme().isEmpty();
+ }
+
// Check on properties. Filter out empty legacy pixmap/icon properties
// as Designer pre 4.4 used to remove missing resource references.
// This can no longer be handled by the code as we have 'setIcon(QIcon())' as well as 'QIcon icon'
@@ -155,7 +159,7 @@ namespace {
if (const DomResourceIcon *dri = p->elementIconSet()) {
if (!isIconFormat44(dri)) {
if (dri->text().isEmpty()) {
- const QString msg = QString::fromUtf8("%1: An invalid icon property '%2' was encountered.").arg(fileName).arg(p->attributeName());
+ const QString msg = QString::fromUtf8("%1: Warning: An invalid icon property '%2' was encountered.").arg(fileName).arg(p->attributeName());
qWarning("%s", qPrintable(msg));
return false;
}
@@ -165,7 +169,7 @@ namespace {
case DomProperty::Pixmap:
if (const DomResourcePixmap *drp = p->elementPixmap())
if (drp->text().isEmpty()) {
- const QString msg = QString::fromUtf8("%1: An invalid pixmap property '%2' was encountered.").arg(fileName).arg(p->attributeName());
+ const QString msg = QString::fromUtf8("%1: Warning: An invalid pixmap property '%2' was encountered.").arg(fileName).arg(p->attributeName());
qWarning("%s", qPrintable(msg));
return false;
}
@@ -258,6 +262,9 @@ IconHandle::IconHandle(const DomResourceIcon *domIcon) :
int IconHandle::compare(const IconHandle &rhs) const
{
+ if (const int comp = m_domIcon->attributeTheme().compare(rhs.m_domIcon->attributeTheme()))
+ return comp;
+
const QString normalOff = m_domIcon->hasElementNormalOff() ? m_domIcon->elementNormalOff()->text() : QString();
const QString rhsNormalOff = rhs.m_domIcon->hasElementNormalOff() ? rhs.m_domIcon->elementNormalOff()->text() : QString();
if (const int comp = normalOff.compare(rhsNormalOff))
@@ -478,7 +485,8 @@ WriteInitialization::WriteInitialization(Uic *uic, bool activateScripts) :
m_delayedOut(&m_delayedInitialization, QIODevice::WriteOnly),
m_refreshOut(&m_refreshInitialization, QIODevice::WriteOnly),
m_actionOut(&m_delayedActionInitialization, QIODevice::WriteOnly),
- m_activateScripts(activateScripts), m_layoutWidget(false)
+ m_activateScripts(activateScripts), m_layoutWidget(false),
+ m_firstThemeIcon(true)
{
}
@@ -539,10 +547,14 @@ void WriteInitialization::acceptUI(DomUI *node)
const Buddy &b = m_buddies.at(i);
if (!m_registeredWidgets.contains(b.objName)) {
- fprintf(stderr, "'%s' isn't a valid widget\n", b.objName.toLatin1().data());
+ fprintf(stderr, "%s: Warning: Buddy assignment: '%s' is not a valid widget.\n",
+ qPrintable(m_option.messagePrefix()),
+ b.objName.toLatin1().data());
continue;
} else if (!m_registeredWidgets.contains(b.buddy)) {
- fprintf(stderr, "'%s' isn't a valid widget\n", b.buddy.toLatin1().data());
+ fprintf(stderr, "%s: Warning: Buddy assignment: '%s' is not a valid widget.\n",
+ qPrintable(m_option.messagePrefix()),
+ b.buddy.toLatin1().data());
continue;
}
@@ -867,7 +879,9 @@ void WriteInitialization::acceptWidget(DomWidget *node)
const QString name = zOrder.at(i);
if (!m_registeredWidgets.contains(name)) {
- fprintf(stderr, "'%s' isn't a valid widget\n", name.toLatin1().data());
+ fprintf(stderr, "%s: Warning: Z-order assignment: '%s' is not a valid widget.\n",
+ qPrintable(m_option.messagePrefix()),
+ name.toLatin1().data());
continue;
}
@@ -895,7 +909,9 @@ void WriteInitialization::addButtonGroup(const DomWidget *buttonNode, const QStr
DomButtonGroup *newGroup = new DomButtonGroup;
newGroup->setAttributeName(attributeName);
group = newGroup;
- fprintf(stderr, "Warning: Creating button group `%s'\n", attributeName.toLatin1().data());
+ fprintf(stderr, "%s: Warning: Creating button group `%s'\n",
+ qPrintable(m_option.messagePrefix()),
+ attributeName.toLatin1().data());
}
const QString groupName = m_driver->findOrInsertButtonGroup(group);
// Create on demand
@@ -1163,7 +1179,9 @@ void WriteInitialization::acceptActionRef(DomActionRef *node)
return;
}
} else if (!(m_driver->actionByName(actionName) || isSeparator)) {
- fprintf(stderr, "Warning: action `%s' not declared\n", actionName.toLatin1().data());
+ fprintf(stderr, "%s: Warning: action `%s' not declared\n",
+ qPrintable(m_option.messagePrefix()),
+ actionName.toLatin1().data());
return;
}
@@ -1660,6 +1678,30 @@ QString WriteInitialization::writeFontProperties(const DomFont *f)
return fontName;
}
+// Post 4.4 write resource icon
+static void writeResourceIcon(QTextStream &output,
+ const QString &iconName,
+ const QString &indent,
+ const DomResourceIcon *i)
+{
+ if (i->hasElementNormalOff())
+ output << indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementNormalOff()->text(), indent) << "), QSize(), QIcon::Normal, QIcon::Off);\n";
+ if (i->hasElementNormalOn())
+ output << indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementNormalOn()->text(), indent) << "), QSize(), QIcon::Normal, QIcon::On);\n";
+ if (i->hasElementDisabledOff())
+ output << indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementDisabledOff()->text(), indent) << "), QSize(), QIcon::Disabled, QIcon::Off);\n";
+ if (i->hasElementDisabledOn())
+ output << indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementDisabledOn()->text(), indent) << "), QSize(), QIcon::Disabled, QIcon::On);\n";
+ if (i->hasElementActiveOff())
+ output << indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementActiveOff()->text(), indent) << "), QSize(), QIcon::Active, QIcon::Off);\n";
+ if (i->hasElementActiveOn())
+ output << indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementActiveOn()->text(), indent) << "), QSize(), QIcon::Active, QIcon::On);\n";
+ if (i->hasElementSelectedOff())
+ output << indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementSelectedOff()->text(), indent) << "), QSize(), QIcon::Selected, QIcon::Off);\n";
+ if (i->hasElementSelectedOn())
+ output << indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementSelectedOn()->text(), indent) << "), QSize(), QIcon::Selected, QIcon::On);\n";
+}
+
QString WriteInitialization::writeIconProperties(const DomResourceIcon *i)
{
// check cache
@@ -1673,25 +1715,41 @@ QString WriteInitialization::writeIconProperties(const DomResourceIcon *i)
const QString iconName = m_driver->unique(QLatin1String("icon"));
m_iconPropertiesNameMap.insert(IconHandle(i), iconName);
if (isIconFormat44(i)) {
- const QString pixmap = QLatin1String("QPixmap");
- m_output << m_indent << "QIcon " << iconName << ";\n";
- if (i->hasElementNormalOff())
- m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementNormalOff()->text(), m_dindent) << "), QSize(), QIcon::Normal, QIcon::Off);\n";
- if (i->hasElementNormalOn())
- m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementNormalOn()->text(), m_dindent) << "), QSize(), QIcon::Normal, QIcon::On);\n";
- if (i->hasElementDisabledOff())
- m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementDisabledOff()->text(), m_dindent) << "), QSize(), QIcon::Disabled, QIcon::Off);\n";
- if (i->hasElementDisabledOn())
- m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementDisabledOn()->text(), m_dindent) << "), QSize(), QIcon::Disabled, QIcon::On);\n";
- if (i->hasElementActiveOff())
- m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementActiveOff()->text(), m_dindent) << "), QSize(), QIcon::Active, QIcon::Off);\n";
- if (i->hasElementActiveOn())
- m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementActiveOn()->text(), m_dindent) << "), QSize(), QIcon::Active, QIcon::On);\n";
- if (i->hasElementSelectedOff())
- m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementSelectedOff()->text(), m_dindent) << "), QSize(), QIcon::Selected, QIcon::Off);\n";
- if (i->hasElementSelectedOn())
- m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementSelectedOn()->text(), m_dindent) << "), QSize(), QIcon::Selected, QIcon::On);\n";
- } else { // pre-4.4 legacy
+ if (i->attributeTheme().isEmpty()) {
+ // No theme: Write resource icon as is
+ m_output << m_indent << "QIcon " << iconName << ";\n";
+ writeResourceIcon(m_output, iconName, m_indent, i);
+ } else {
+ // Theme: Generate code to check the theme and default to resource
+ const QString themeIconName = fixString(i->attributeTheme(), QString());
+ if (iconHasStatePixmaps(i)) {
+ // Theme + default state pixmaps:
+ // Generate code to check the theme and default to state pixmaps
+ m_output << m_indent << "QIcon " << iconName << ";\n";
+ const char themeNameStringVariableC[] = "iconThemeName";
+ // Store theme name in a variable
+ m_output << m_indent;
+ if (m_firstThemeIcon) { // Declare variable string
+ m_output << "QString ";
+ m_firstThemeIcon = false;
+ }
+ m_output << themeNameStringVariableC << " = QString::fromUtf8("
+ << themeIconName << ");\n";
+ m_output << m_indent << "if (QIcon::hasThemeIcon("
+ << themeNameStringVariableC
+ << ")) {\n"
+ << m_dindent << iconName << " = QIcon::fromTheme(" << themeNameStringVariableC << ");\n"
+ << m_indent << "} else {\n";
+ writeResourceIcon(m_output, iconName, m_dindent, i);
+ m_output << m_indent << "}\n";
+ } else {
+ // Theme, but no state pixmaps: Construct from theme directly.
+ m_output << m_indent << "QIcon " << iconName
+ << "(QIcon::fromTheme(QString::fromUtf8("
+ << themeIconName << ")));\n";
+ } // Theme, but not state
+ } // >= 4.4
+ } else { // pre-4.4 legacy
m_output << m_indent << "const QIcon " << iconName << " = " << pixCall(QLatin1String("QIcon"), i->text())<< ";\n";
}
return iconName;
@@ -1853,7 +1911,9 @@ void WriteInitialization::acceptTabStops(DomTabStops *tabStops)
const QString name = l.at(i);
if (!m_registeredWidgets.contains(name)) {
- fprintf(stderr, "'%s' isn't a valid widget\n", name.toLatin1().data());
+ fprintf(stderr, "%s: Warning: Tab-stop assignment: '%s' is not a valid widget.\n",
+ qPrintable(m_option.messagePrefix()),
+ name.toLatin1().data());
continue;
}
@@ -2083,7 +2143,8 @@ QString WriteInitialization::pixCall(const DomProperty *p) const
s = p->elementPixmap()->text();
break;
default:
- qWarning() << "Warning: Unknown icon format encountered. The ui-file was generated with a too-recent version of Designer.";
+ qWarning("%s: Warning: Unknown icon format encountered. The ui-file was generated with a too-recent version of Designer.",
+ qPrintable(m_option.messagePrefix()));
return QLatin1String("QIcon()");
break;
}
@@ -2573,7 +2634,7 @@ void WriteInitialization::initializeQ3SqlDataTable(DomWidget *w)
}
if (table.isEmpty() || connection.isEmpty()) {
- fprintf(stderr, "invalid database connection\n");
+ fprintf(stderr, "%s: Warning: Invalid database connection\n", qPrintable(m_option.messagePrefix()));
return;
}
@@ -2613,7 +2674,7 @@ void WriteInitialization::initializeQ3SqlDataBrowser(DomWidget *w)
}
if (table.isEmpty() || connection.isEmpty()) {
- fprintf(stderr, "invalid database connection\n");
+ fprintf(stderr, "%s: Warning: Invalid database connection\n", qPrintable(m_option.messagePrefix()));
return;
}
diff --git a/src/tools/uic/cpp/cppwriteinitialization.h b/src/tools/uic/cpp/cppwriteinitialization.h
index 7507166..b9cf2cd 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.h
+++ b/src/tools/uic/cpp/cppwriteinitialization.h
@@ -363,6 +363,7 @@ private:
const bool m_activateScripts;
bool m_layoutWidget;
+ bool m_firstThemeIcon;
};
} // namespace CPP
diff --git a/src/tools/uic/driver.cpp b/src/tools/uic/driver.cpp
index 676388f..65d63e0 100644
--- a/src/tools/uic/driver.cpp
+++ b/src/tools/uic/driver.cpp
@@ -178,7 +178,10 @@ QString Driver::unique(const QString &instanceName, const QString &className)
}
if (alreadyUsed && className.size()) {
- fprintf(stderr, "Warning: name %s is already used\n", qPrintable(instanceName));
+ fprintf(stderr, "%s: Warning: The name '%s' (%s) is already in use, defaulting to '%s'.\n",
+ qPrintable(m_option.messagePrefix()),
+ qPrintable(instanceName), qPrintable(className),
+ qPrintable(name));
}
m_nameRepository.insert(name, true);
diff --git a/src/tools/uic/option.h b/src/tools/uic/option.h
index 8556728..011a8f8 100644
--- a/src/tools/uic/option.h
+++ b/src/tools/uic/option.h
@@ -43,6 +43,7 @@
#define OPTION_H
#include <QtCore/QString>
+#include <QtCore/QDir>
QT_BEGIN_NAMESPACE
@@ -91,6 +92,13 @@ struct Option
generator(CppGenerator),
prefix(QLatin1String("Ui_"))
{ indent.fill(QLatin1Char(' '), 4); }
+
+ QString messagePrefix() const
+ {
+ return inputFile.isEmpty() ?
+ QString(QLatin1String("stdin")) :
+ QDir::toNativeSeparators(inputFile);
+ }
};
QT_END_NAMESPACE
diff --git a/src/tools/uic/ui4.cpp b/src/tools/uic/ui4.cpp
index e80523f..1988696 100644
--- a/src/tools/uic/ui4.cpp
+++ b/src/tools/uic/ui4.cpp
@@ -7745,6 +7745,7 @@ void DomResourceIcon::clear(bool clear_all)
if (clear_all) {
m_text = QLatin1String("");
+ m_has_attr_theme = false;
m_has_attr_resource = false;
}
@@ -7762,6 +7763,7 @@ void DomResourceIcon::clear(bool clear_all)
DomResourceIcon::DomResourceIcon()
{
m_children = 0;
+ m_has_attr_theme = false;
m_has_attr_resource = false;
m_text = QLatin1String("");
m_normalOff = 0;
@@ -7791,6 +7793,10 @@ void DomResourceIcon::read(QXmlStreamReader &reader)
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
+ if (name == QLatin1String("theme")) {
+ setAttributeTheme(attribute.value().toString());
+ continue;
+ }
if (name == QLatin1String("resource")) {
setAttributeResource(attribute.value().toString());
continue;
@@ -7869,6 +7875,8 @@ void DomResourceIcon::read(QXmlStreamReader &reader)
#ifdef QUILOADER_QDOM_READ
void DomResourceIcon::read(const QDomElement &node)
{
+ if (node.hasAttribute(QLatin1String("theme")))
+ setAttributeTheme(node.attribute(QLatin1String("theme")));
if (node.hasAttribute(QLatin1String("resource")))
setAttributeResource(node.attribute(QLatin1String("resource")));
@@ -7938,6 +7946,9 @@ void DomResourceIcon::write(QXmlStreamWriter &writer, const QString &tagName) co
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("resourceicon") : tagName.toLower());
+ if (hasAttributeTheme())
+ writer.writeAttribute(QLatin1String("theme"), attributeTheme());
+
if (hasAttributeResource())
writer.writeAttribute(QLatin1String("resource"), attributeResource());
diff --git a/src/tools/uic/ui4.h b/src/tools/uic/ui4.h
index 1f38f88..a464a89 100644
--- a/src/tools/uic/ui4.h
+++ b/src/tools/uic/ui4.h
@@ -2809,6 +2809,11 @@ public:
inline void setText(const QString &s) { m_text = s; }
// attribute accessors
+ inline bool hasAttributeTheme() const { return m_has_attr_theme; }
+ inline QString attributeTheme() const { return m_attr_theme; }
+ inline void setAttributeTheme(const QString& a) { m_attr_theme = a; m_has_attr_theme = true; }
+ inline void clearAttributeTheme() { m_has_attr_theme = false; }
+
inline bool hasAttributeResource() const { return m_has_attr_resource; }
inline QString attributeResource() const { return m_attr_resource; }
inline void setAttributeResource(const QString& a) { m_attr_resource = a; m_has_attr_resource = true; }
@@ -2868,6 +2873,9 @@ private:
void clear(bool clear_all = true);
// attribute data
+ QString m_attr_theme;
+ bool m_has_attr_theme;
+
QString m_attr_resource;
bool m_has_attr_resource;