From ad719aeaa8c7346e5aca0033a22715987823de0a Mon Sep 17 00:00:00 2001 From: malte_langkabel Date: Tue, 30 Aug 2016 16:52:28 +0200 Subject: [PATCH] ui: revised project setup descriptions * revised texts in project setup ui * fixed crash during project setup when CDB file is empty * fixed row height of project location in CDB project setup --- src/app/data/parser/cxx/TaskParseCxx.cpp | 9 +++-- src/lib_gui/qt/window/QtWindow.cpp | 23 ++++++------ .../QtProjectWizzardContentData.cpp | 5 +-- .../QtProjectWizzardContentFlags.cpp | 2 +- .../QtProjectWizzardContentPaths.cpp | 35 ++++++++++++------- .../QtProjectWizzardContentSelect.cpp | 6 +++- .../QtProjectWizzardContentSimple.cpp | 6 ++-- 7 files changed, 54 insertions(+), 32 deletions(-) diff --git a/src/app/data/parser/cxx/TaskParseCxx.cpp b/src/app/data/parser/cxx/TaskParseCxx.cpp index e08f06e2..052f4e54 100644 --- a/src/app/data/parser/cxx/TaskParseCxx.cpp +++ b/src/app/data/parser/cxx/TaskParseCxx.cpp @@ -16,11 +16,14 @@ std::vector TaskParseCxx::getSourceFilesFromCDB(const FilePath& compil std::shared_ptr cdb = std::shared_ptr (clang::tooling::JSONCompilationDatabase::loadFromFile(compilationDatabasePath.str(), error)); - std::vector files = cdb->getAllFiles(); std::vector filePaths; - for (const std::string& file : files) + if (cdb) { - filePaths.push_back(FilePath(file)); + std::vector files = cdb->getAllFiles(); + for (const std::string& file : files) + { + filePaths.push_back(FilePath(file)); + } } return filePaths; } diff --git a/src/lib_gui/qt/window/QtWindow.cpp b/src/lib_gui/qt/window/QtWindow.cpp index 27a72795..78d5f934 100644 --- a/src/lib_gui/qt/window/QtWindow.cpp +++ b/src/lib_gui/qt/window/QtWindow.cpp @@ -30,10 +30,10 @@ QtWindow::QtWindow(QWidget* parent) std::string frameStyle = "#window {" - "font-size: 17pt; " - "border: 1px solid lightgray;" - "border-radius: 15px; " - "background: white; " + " font-size: 17pt;" + " border: 1px solid lightgray;" + " border-radius: 15px;" + " background: white;" "}"; m_window->setStyleSheet(frameStyle.c_str()); m_window->setObjectName("window"); @@ -57,12 +57,13 @@ QtWindow::QtWindow(QWidget* parent) QHBoxLayout* gripLayout = new QHBoxLayout(); QSizeGrip* sizeGrip = new QSizeGrip(m_window); - sizeGrip->setStyleSheet( - QString::fromStdString("QSizeGrip {" - "max-height: 12px; max-width: 12px;" - "border-image: url(" + ResourcePaths::getGuiPath() + "window/size_grip.png);" - "}") - ); + sizeGrip->setStyleSheet(QString::fromStdString( + "QSizeGrip {" + " max-height: 12px;" + " max-width: 12px;" + " border-image: url(" + ResourcePaths::getGuiPath() + "window/size_grip.png);" + "}" + )); gripLayout->addWidget(new QWidget()); gripLayout->addWidget(sizeGrip); layout->addLayout(gripLayout); @@ -82,7 +83,7 @@ QSize QtWindow::sizeHint() const void QtWindow::setup() { - setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath() + "window/window.css").c_str()); + m_content->setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath() + "window/window.css").c_str()); QVBoxLayout* layout = new QVBoxLayout(); layout->setContentsMargins(25, 30, 25, 0); diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.cpp index 7466d88e..87f56a3d 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.cpp @@ -21,7 +21,7 @@ void QtProjectWizzardContentData::populate(QGridLayout* layout, int& row) { if (!isInForm()) { - layout->setRowMinimumHeight(0, 15); + layout->setRowMinimumHeight(row, 15); row++; } @@ -138,6 +138,7 @@ void QtProjectWizzardContentData::addNameAndLocation(QGridLayout* layout, int& r layout->addWidget(locationLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight); layout->addWidget(m_projectFileLocation, row, QtProjectWizzardWindow::BACK_COL); + layout->setRowMinimumHeight(row, 50); row++; } @@ -188,7 +189,7 @@ void QtProjectWizzardContentDataCDB::populate(QGridLayout* layout, int& row) { if (!isInForm()) { - layout->setRowMinimumHeight(0, 15); + layout->setRowMinimumHeight(row, 15); row++; } diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentFlags.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentFlags.cpp index 8851ecc0..c3e20af7 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentFlags.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentFlags.cpp @@ -16,7 +16,7 @@ void QtProjectWizzardContentFlags::populate(QGridLayout* layout, int& row) label->setObjectName("label"); layout->addWidget(label, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight); - addHelpButton("Define compiler flags used during indexing including the dash e.g. -v", layout, row); + addHelpButton("Define compiler flags used during indexing including the dash (e.g. use \"-D RELEASE\" to add a #define for \"RELEASE\").", layout, row); m_list = new QtDirectoryListBox(this, label->text(), true); layout->addWidget(m_list, row, QtProjectWizzardWindow::BACK_COL); diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp index cb895d0a..3570abc5 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp @@ -138,7 +138,7 @@ QtProjectWizzardContentPathsSource::QtProjectWizzardContentPathsSource( setTitleString("Project Paths"); setHelpString( "Project Paths define the files and directories that will be indexed by Coati. Provide a directory to recursively " - "add all contained files.\n\nProject Paths are usually the source and header files of your project or a subset of them." + "add all contained source and header files." ); } @@ -209,7 +209,9 @@ QtProjectWizzardContentPathsSourceJava::QtProjectWizzardContentPathsSourceJava( { setHelpString( "Project Paths define the files and directories that will be indexed by Coati. Provide a directory to recursively " - "add all contained files. Adding the root source directory of your project is usually sufficient.\n\n" + "add all contained files. To make sure that type names are resolved correctly, please add the root source directory " + "of your project (the one where all your package names are relative to).
" + "
" "If your project's source code resides in one location, but generated source files are kept at a different location, " "you will also need to add that directory." ); @@ -225,9 +227,11 @@ QtProjectWizzardContentPathsCDBHeader::QtProjectWizzardContentPathsCDBHeader( setTitleString("Indexed Header Paths"); setHelpString( "Define which header files should be indexed by Coati. Provide a directory to recursively add all contained files. " - "Every time an included header is encountered, Coati will check if the file is located in one of these paths to " - "decide whether or not to index it.\n\n" - "This is necessary since the Compilation Database only specifies the source files of your project." + "Every time an included header is encountered, Coati will check if the file is part of the indexed headers to " + "decide whether or not to index it.
" + "
" + "So just enter the root path of your project if you want Coati to index all contained headers it encounters. " + "This way you prevent Coati from indexing files you may not be interested in." ); } @@ -259,12 +263,15 @@ QtProjectWizzardContentPathsHeaderSearch::QtProjectWizzardContentPathsHeaderSear { setTitleString(isCDB ? "Additional Include Paths" : "Include Paths"); setHelpString( + ((isCDB ? "Note: Use the Additional Include Paths to add paths that are missin in the CDB.

" : "") + std::string( "Include Paths are used for resolving #include directives in the indexed source and header files. These paths are " - "usually passed to the compiler with the '-I' or '-iquote' flags.\n\n" - "Add all the paths the #include directives throughout your project are relative to. If all #include directives are " - "specified relative to the project's root directory, please add that.\n\n" + "usually passed to the compiler with the '-I' or '-iquote' flags.
" + "
" + "Add all the paths the #include directives throughout your project are relative to. So if all #include directives are " + "specified relative to the project's root directory, please add that one.
" + "
" "If your project also includes files from external libraries (e.g. boost), please add these directories as well " - "(e.g. add '/include')." + "(e.g. add '<boost_home>/include').")).c_str() ); } @@ -299,7 +306,8 @@ QtProjectWizzardContentPathsHeaderSearchGlobal::QtProjectWizzardContentPathsHead setTitleString("Global Include Paths"); setHelpString( "The Global Include Paths will be used in all your projects - in addition to the project specific Include Paths. " - "These paths are usually passed to the compiler with the '-isystem' flag.\n\n" + "These paths are usually passed to the compiler with the '-isystem' flag.
" + "
" "Use them to add system header paths (See " "Finding System Header Locations or use the auto detection below)." ); @@ -372,7 +380,9 @@ QtProjectWizzardContentPathsFrameworkSearchGlobal::QtProjectWizzardContentPathsF setTitleString("Global Framework Search Paths"); setHelpString( "The Global Framework Search Paths will be used in all your projects - in addition to the project specific " - "Framework Search Paths.\n\nThey define where MacOS framework containers (.framework) are found " + "Framework Search Paths.
" + "
" + "They define where MacOS framework containers (.framework) are found " "(See " "Finding System Header Locations or use the auto detection below)." ); @@ -401,7 +411,8 @@ QtProjectWizzardContentPathsClassJava::QtProjectWizzardContentPathsClassJava( { setTitleString("Class Path"); setHelpString( - "Enter the paths to .jar files and root directories of .class files your project depends on." + "Enter all the .jar files your project depends on. If your project depends on uncompiled java code that should " + "not be indexed, please add the root directory of those .java files here." ); } diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp index 443ae478..a5433f89 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp @@ -63,13 +63,17 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row) m_buttons->setExclusive(true); m_window->setNextEnabled(false); - m_title->setText("Project Types - " + m_languages->checkedButton()->text()); + m_title->setText( + "Project Types - " + m_languages->checkedButton()->text() + + (m_languages->checkedButton()->text() == "Java" ? " (beta)" : "") + ); m_description->setText(""); } ); QVBoxLayout* vlayout = new QVBoxLayout(); vlayout->setContentsMargins(0, 30, 0, 0); + vlayout->setSpacing(10); vlayout->addWidget(d); vlayout->addWidget(e); diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.cpp index 5740fac3..2bb1b91d 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSimple.cpp @@ -20,9 +20,11 @@ void QtProjectWizzardContentSimple::populate(QGridLayout* layout, int& row) layout->addWidget(m_checkBox, row, QtProjectWizzardWindow::BACK_COL); addHelpButton( - "If enabled Coati also uses the project paths and their subdirectories when resolving #include directives.\n\n" + "If enabled Coati also uses the project paths and their subdirectories when resolving #include directives.
" + "
" "Use this option when you know that the project is self contained but don't know which paths to " - "specify as include paths.\n\n" + "specify as include paths.
" + "
" "Warning: This slows down indexing speed.", layout, row); row++;