forked from qt-creator/qt-creator
QmlDesigner: Fix build on Windows
Use Qt styled enum values to avoid clashing global defines.
Amends 06a6549075
.
Change-Id: I85d3ec4192c1c55f231b6e2e81ec114480c03a5c
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -58,16 +58,16 @@ bool operator==(const GeneratableFile &left, const GeneratableFile &right)
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum ProjectDirectoryError {
|
enum ProjectDirectoryError {
|
||||||
NO_ERROR = 0,
|
NoError = 0,
|
||||||
MISSING_CONTENTDIR = 1<<1,
|
MissingContentDir = 1<<1,
|
||||||
MISSING_IMPORTDIR = 1<<2,
|
MissingImportDir = 1<<2,
|
||||||
MISSING_CPPDIR = 1<<3,
|
MissingCppDir = 1<<3,
|
||||||
MISSING_MAINCMAKE = 1<<4,
|
MissingMainCMake = 1<<4,
|
||||||
MISSING_MAINQML = 1<<5,
|
MissingMainQml = 1<<5,
|
||||||
MISSING_APPMAINQML = 1<<6,
|
MissingAppMainQml = 1<<6,
|
||||||
MISSING_QMLMODULES = 1<<7,
|
MissingQmlModules = 1<<7,
|
||||||
MISSING_MAINCPP = 1<<8,
|
MissingMainCpp = 1<<8,
|
||||||
MISSING_MAINCPP_HEADER = 1<<9
|
MissingMainCppHeader = 1<<9
|
||||||
};
|
};
|
||||||
|
|
||||||
QVector<GeneratableFile> queuedFiles;
|
QVector<GeneratableFile> queuedFiles;
|
||||||
@@ -93,7 +93,7 @@ void onGenerateCmakeLists()
|
|||||||
FilePath rootDir = ProjectExplorer::SessionManager::startupProject()->projectDirectory();
|
FilePath rootDir = ProjectExplorer::SessionManager::startupProject()->projectDirectory();
|
||||||
|
|
||||||
int projectDirErrors = isProjectCorrectlyFormed(rootDir);
|
int projectDirErrors = isProjectCorrectlyFormed(rootDir);
|
||||||
if (projectDirErrors != NO_ERROR) {
|
if (projectDirErrors != NoError) {
|
||||||
showProjectDirErrorDialog(projectDirErrors);
|
showProjectDirErrorDialog(projectDirErrors);
|
||||||
if (isErrorFatal(projectDirErrors))
|
if (isErrorFatal(projectDirErrors))
|
||||||
return;
|
return;
|
||||||
@@ -109,10 +109,10 @@ void onGenerateCmakeLists()
|
|||||||
|
|
||||||
bool isErrorFatal(int error)
|
bool isErrorFatal(int error)
|
||||||
{
|
{
|
||||||
if (error & MISSING_CONTENTDIR ||
|
if (error & MissingContentDir ||
|
||||||
error & MISSING_IMPORTDIR ||
|
error & MissingImportDir ||
|
||||||
error & MISSING_CPPDIR ||
|
error & MissingCppDir ||
|
||||||
error & MISSING_APPMAINQML)
|
error & MissingAppMainQml)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -131,29 +131,29 @@ const char FILENAME_MODULES[] = "qmlmodules";
|
|||||||
|
|
||||||
int isProjectCorrectlyFormed(const FilePath &rootDir)
|
int isProjectCorrectlyFormed(const FilePath &rootDir)
|
||||||
{
|
{
|
||||||
int errors = NO_ERROR;
|
int errors = NoError;
|
||||||
|
|
||||||
if (!rootDir.pathAppended(DIRNAME_CONTENT).exists())
|
if (!rootDir.pathAppended(DIRNAME_CONTENT).exists())
|
||||||
errors |= MISSING_CONTENTDIR;
|
errors |= MissingContentDir;
|
||||||
if (!rootDir.pathAppended(DIRNAME_CONTENT).pathAppended(FILENAME_APPMAINQML).exists())
|
if (!rootDir.pathAppended(DIRNAME_CONTENT).pathAppended(FILENAME_APPMAINQML).exists())
|
||||||
errors |= MISSING_APPMAINQML;
|
errors |= MissingAppMainQml;
|
||||||
|
|
||||||
if (!rootDir.pathAppended(DIRNAME_IMPORT).exists())
|
if (!rootDir.pathAppended(DIRNAME_IMPORT).exists())
|
||||||
errors |= MISSING_IMPORTDIR;
|
errors |= MissingImportDir;
|
||||||
|
|
||||||
if (!rootDir.pathAppended(DIRNAME_CPP).exists())
|
if (!rootDir.pathAppended(DIRNAME_CPP).exists())
|
||||||
errors |= MISSING_CPPDIR;
|
errors |= MissingCppDir;
|
||||||
if (!rootDir.pathAppended(DIRNAME_CPP).pathAppended(FILENAME_MAINCPP).exists())
|
if (!rootDir.pathAppended(DIRNAME_CPP).pathAppended(FILENAME_MAINCPP).exists())
|
||||||
errors |= MISSING_MAINCPP;
|
errors |= MissingMainCpp;
|
||||||
if (!rootDir.pathAppended(DIRNAME_CPP).pathAppended(FILENAME_MAINCPP_HEADER).exists())
|
if (!rootDir.pathAppended(DIRNAME_CPP).pathAppended(FILENAME_MAINCPP_HEADER).exists())
|
||||||
errors |= MISSING_MAINCPP_HEADER;
|
errors |= MissingMainCppHeader;
|
||||||
|
|
||||||
if (!rootDir.pathAppended(FILENAME_CMAKELISTS).exists())
|
if (!rootDir.pathAppended(FILENAME_CMAKELISTS).exists())
|
||||||
errors |= MISSING_MAINCMAKE;
|
errors |= MissingMainCMake;
|
||||||
if (!rootDir.pathAppended(FILENAME_MODULES).exists())
|
if (!rootDir.pathAppended(FILENAME_MODULES).exists())
|
||||||
errors |= MISSING_QMLMODULES;
|
errors |= MissingQmlModules;
|
||||||
if (!rootDir.pathAppended(FILENAME_MAINQML).exists())
|
if (!rootDir.pathAppended(FILENAME_MAINQML).exists())
|
||||||
errors |= MISSING_MAINQML;
|
errors |= MissingMainQml;
|
||||||
|
|
||||||
return errors;
|
return errors;
|
||||||
}
|
}
|
||||||
@@ -179,32 +179,32 @@ void showProjectDirErrorDialog(int error)
|
|||||||
QString fatalList;
|
QString fatalList;
|
||||||
QString nonFatalList;
|
QString nonFatalList;
|
||||||
|
|
||||||
if (error & MISSING_CONTENTDIR)
|
if (error & MissingContentDir)
|
||||||
fatalList.append(QString(DIRNAME_CONTENT) + "\n");
|
fatalList.append(QString(DIRNAME_CONTENT) + "\n");
|
||||||
if (error & MISSING_APPMAINQML)
|
if (error & MissingAppMainQml)
|
||||||
fatalList.append(QString(DIRNAME_CONTENT)
|
fatalList.append(QString(DIRNAME_CONTENT)
|
||||||
+ QDir::separator()
|
+ QDir::separator()
|
||||||
+ QString(FILENAME_APPMAINQML)
|
+ QString(FILENAME_APPMAINQML)
|
||||||
+ "\n");
|
+ "\n");
|
||||||
if (error & MISSING_CPPDIR)
|
if (error & MissingCppDir)
|
||||||
fatalList.append(QString(DIRNAME_CPP) + "\n");
|
fatalList.append(QString(DIRNAME_CPP) + "\n");
|
||||||
if (error & MISSING_IMPORTDIR)
|
if (error & MissingImportDir)
|
||||||
fatalList.append(QString(DIRNAME_IMPORT) + "\n");
|
fatalList.append(QString(DIRNAME_IMPORT) + "\n");
|
||||||
|
|
||||||
if (error & MISSING_MAINCMAKE)
|
if (error & MissingMainCMake)
|
||||||
nonFatalList.append(QString(FILENAME_CMAKELISTS) + "\n");
|
nonFatalList.append(QString(FILENAME_CMAKELISTS) + "\n");
|
||||||
if (error & MISSING_QMLMODULES)
|
if (error & MissingQmlModules)
|
||||||
nonFatalList.append(QString(FILENAME_MODULES) + "\n");
|
nonFatalList.append(QString(FILENAME_MODULES) + "\n");
|
||||||
|
|
||||||
if (error & MISSING_MAINQML)
|
if (error & MissingMainQml)
|
||||||
nonFatalList.append(QString(FILENAME_MAINQML) + "\n");
|
nonFatalList.append(QString(FILENAME_MAINQML) + "\n");
|
||||||
|
|
||||||
if (error & MISSING_MAINCPP)
|
if (error & MissingMainCpp)
|
||||||
nonFatalList.append(QString(DIRNAME_CPP)
|
nonFatalList.append(QString(DIRNAME_CPP)
|
||||||
+ QDir::separator()
|
+ QDir::separator()
|
||||||
+ QString(FILENAME_MAINCPP)
|
+ QString(FILENAME_MAINCPP)
|
||||||
+ "\n");
|
+ "\n");
|
||||||
if (error & MISSING_MAINCPP_HEADER)
|
if (error & MissingMainCppHeader)
|
||||||
nonFatalList.append(QString(DIRNAME_CPP)
|
nonFatalList.append(QString(DIRNAME_CPP)
|
||||||
+ QDir::separator()
|
+ QDir::separator()
|
||||||
+ QString(FILENAME_MAINCPP_HEADER)
|
+ QString(FILENAME_MAINCPP_HEADER)
|
||||||
|
Reference in New Issue
Block a user