summaryrefslogtreecommitdiffstats
path: root/src/tools/uic
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/uic')
-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.cpp35
-rw-r--r--src/tools/uic/driver.cpp5
-rw-r--r--src/tools/uic/option.h8
5 files changed, 47 insertions, 19 deletions
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 165b6d7..a2bc89d 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.cpp
+++ b/src/tools/uic/cpp/cppwriteinitialization.cpp
@@ -159,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;
}
@@ -169,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;
}
@@ -547,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;
}
@@ -875,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;
}
@@ -903,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
@@ -1171,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;
}
@@ -1901,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;
}
@@ -2131,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;
}
@@ -2621,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;
}
@@ -2661,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/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