ui: added individual help window titles

This commit is contained in:
mlangkabel
2017-10-25 09:56:31 +02:00
parent c73e58893e
commit ee11528ddf
13 changed files with 37 additions and 28 deletions
+3 -2
View File
@@ -4,11 +4,12 @@
#include "utility/ResourcePaths.h" #include "utility/ResourcePaths.h"
QtHelpButton::QtHelpButton(const QString& helpText, QWidget* parent) QtHelpButton::QtHelpButton(const QString& helpTitle, const QString& helpText, QWidget* parent)
: QtIconButton( : QtIconButton(
(ResourcePaths::getGuiPath().str() + "window/help.png").c_str(), (ResourcePaths::getGuiPath().str() + "window/help.png").c_str(),
(ResourcePaths::getGuiPath().str() + "window/help_hover.png").c_str(), (ResourcePaths::getGuiPath().str() + "window/help_hover.png").c_str(),
parent) parent)
, m_helpTitle(helpTitle)
, m_helpText(helpText) , m_helpText(helpText)
{ {
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
@@ -27,7 +28,7 @@ void QtHelpButton::handleHelpPress()
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setWindowTitle("Sourcetrail"); msgBox.setWindowTitle("Sourcetrail");
msgBox.setIcon(QMessageBox::Information); msgBox.setIcon(QMessageBox::Information);
msgBox.setText("Sourcetrail Help"); msgBox.setText("<b>" + m_helpTitle + "</b>");
msgBox.setInformativeText(m_helpText); msgBox.setInformativeText(m_helpText);
msgBox.setStandardButtons(QMessageBox::Ok); msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok);
+2 -1
View File
@@ -9,12 +9,13 @@ class QtHelpButton
Q_OBJECT Q_OBJECT
public: public:
QtHelpButton(const QString& helpText, QWidget* parent = nullptr); QtHelpButton(const QString& helpTitle, const QString& helpText, QWidget* parent = nullptr);
private slots: private slots:
void handleHelpPress(); void handleHelpPress();
private: private:
QString m_helpTitle;
QString m_helpText; QString m_helpText;
}; };
@@ -93,9 +93,9 @@ QToolButton* QtProjectWizzardContent::createSourceGroupButton(QString name, QStr
return button; return button;
} }
QtHelpButton* QtProjectWizzardContent::addHelpButton(QString helpString, QGridLayout* layout, int row) const QtHelpButton* QtProjectWizzardContent::addHelpButton(const QString& helpTitle, const QString& helpText, QGridLayout* layout, int row) const
{ {
QtHelpButton* button = new QtHelpButton(helpString); QtHelpButton* button = new QtHelpButton(helpTitle, helpText);
layout->addWidget(button, row, QtProjectWizzardWindow::HELP_COL, Qt::AlignTop); layout->addWidget(button, row, QtProjectWizzardWindow::HELP_COL, Qt::AlignTop);
return button; return button;
} }
@@ -41,7 +41,7 @@ protected:
QLabel* createFormTitle(QString name) const; QLabel* createFormTitle(QString name) const;
QToolButton* createSourceGroupButton(QString name, QString iconPath) const; QToolButton* createSourceGroupButton(QString name, QString iconPath) const;
QtHelpButton* addHelpButton(QString helpString, QGridLayout* layout, int row) const; QtHelpButton* addHelpButton(const QString& helpTitle, const QString& helpText, QGridLayout* layout, int row) const;
QPushButton* addFilesButton(QString name, QGridLayout* layout, int row) const; QPushButton* addFilesButton(QString name, QGridLayout* layout, int row) const;
QFrame* addSeparator(QGridLayout* layout, int row) const; QFrame* addSeparator(QGridLayout* layout, int row) const;
@@ -31,6 +31,7 @@ void QtProjectWizzardContentCrossCompilationOptions::populate(QGridLayout* layou
layout->addWidget(createFormLabel("Cross-Compilation"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight); layout->addWidget(createFormLabel("Cross-Compilation"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
addHelpButton( addHelpButton(
"Cross-Compilation",
"<p>Use these options to specify the target architecture for the provided source code. Even though Sourcetrail will " "<p>Use these options to specify the target architecture for the provided source code. Even though Sourcetrail will "
"not generate a target binary, providing these options will affect which headers the indexer will be looking for " "not generate a target binary, providing these options will affect which headers the indexer will be looking for "
"while analyzing your source code.</p>" "while analyzing your source code.</p>"
@@ -18,7 +18,7 @@ void QtProjectWizzardContentExtensions::populate(QGridLayout* layout, int& row)
QLabel* sourceLabel = createFormLabel("Source File Extensions"); QLabel* sourceLabel = createFormLabel("Source File Extensions");
layout->addWidget(sourceLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop); layout->addWidget(sourceLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
addHelpButton("Define extensions for source files including the dot e.g. .cpp", layout, row); addHelpButton("Source File Extensions", "Define extensions for source files including the dot (e.g. .cpp or .java)", layout, row);
m_sourceList = new QtDirectoryListBox(this, sourceLabel->text(), true); m_sourceList = new QtDirectoryListBox(this, sourceLabel->text(), true);
layout->addWidget(m_sourceList, row, QtProjectWizzardWindow::BACK_COL); layout->addWidget(m_sourceList, row, QtProjectWizzardWindow::BACK_COL);
@@ -14,10 +14,11 @@ QtProjectWizzardContentFlags::QtProjectWizzardContentFlags(std::shared_ptr<Sourc
void QtProjectWizzardContentFlags::populate(QGridLayout* layout, int& row) void QtProjectWizzardContentFlags::populate(QGridLayout* layout, int& row)
{ {
QLabel* label = createFormLabel((std::string(m_isCdb ? "Additional " : "") + "Compiler Flags").c_str()); QString labelText((std::string(m_isCdb ? "Additional " : "") + "Compiler Flags").c_str());
QLabel* label = createFormLabel(labelText);
layout->addWidget(label, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop); layout->addWidget(label, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
addHelpButton("Define additional Clang compiler flags used during indexing including the dash (e.g. use \"-D RELEASE\" to add a #define for \"RELEASE\").", layout, row); addHelpButton(labelText, "Define additional Clang 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); m_list = new QtDirectoryListBox(this, label->text(), true);
layout->addWidget(m_list, row, QtProjectWizzardWindow::BACK_COL); layout->addWidget(m_list, row, QtProjectWizzardWindow::BACK_COL);
@@ -33,7 +33,7 @@ void QtProjectWizzardContentPath::populate(QGridLayout* layout, int& row)
if (m_helpString.size() > 0) if (m_helpString.size() > 0)
{ {
addHelpButton(m_helpString, layout, row); addHelpButton(m_titleString, m_helpString, layout, row);
} }
m_picker = new QtLocationPicker(this); m_picker = new QtLocationPicker(this);
@@ -37,7 +37,7 @@ void QtProjectWizzardContentPaths::populate(QGridLayout* layout, int& row)
if (m_helpString.size() > 0) if (m_helpString.size() > 0)
{ {
addHelpButton(m_helpString, layout, row); addHelpButton(m_titleString, m_helpString, layout, row);
} }
m_list = new QtDirectoryListBox(this, m_titleString); m_list = new QtDirectoryListBox(this, m_titleString);
@@ -143,8 +143,9 @@ void QtProjectWizzardContentPreferences::populate(QGridLayout* layout, int& row)
QWidget* threadsWidget = new QWidget(); QWidget* threadsWidget = new QWidget();
threadsWidget->setLayout(hlayout); threadsWidget->setLayout(hlayout);
addLabelAndWidget("Indexer threads", threadsWidget, layout, row, Qt::AlignLeft); addLabelAndWidget("Indexer Threads", threadsWidget, layout, row, Qt::AlignLeft);
addHelpButton( addHelpButton(
"Indexer Threads",
"<p>Set the number of threads used to work on indexing your project in parallel.</p>" "<p>Set the number of threads used to work on indexing your project in parallel.</p>"
"<p>When setting this value to 0 Sourcetrail tries to use the ideal thread count for your computer.</p>", "<p>When setting this value to 0 Sourcetrail tries to use the ideal thread count for your computer.</p>",
layout, row layout, row
@@ -152,7 +153,7 @@ void QtProjectWizzardContentPreferences::populate(QGridLayout* layout, int& row)
row++; row++;
// multi process indexing // multi process indexing
m_multiProcessIndexing = addCheckBox("Multi process<br />C/C++ indexing", "Run C/C++ indexer threads in different process", m_multiProcessIndexing = addCheckBox("Multi Process<br />C/C++ Indexing", "Run C/C++ indexer threads in different process",
"<p>Enable C/C++ indexer threads to run in different process.</p>" "<p>Enable C/C++ indexer threads to run in different process.</p>"
"<p>This prevents the application from crashing due to unforseen exceptions while indexing.</p>", "<p>This prevents the application from crashing due to unforseen exceptions while indexing.</p>",
layout, row); layout, row);
@@ -202,7 +203,8 @@ void QtProjectWizzardContentPreferences::populate(QGridLayout* layout, int& row)
} }
javaVersionString += "Java 8"; javaVersionString += "Java 8";
addHelpButton(( addHelpButton(
"Java Path", (
"<p>Only required for indexing Java projects.</p>" "<p>Only required for indexing Java projects.</p>"
"<p>Provide the location of the jvm library inside the installation of your " + javaVersionString + "<p>Provide the location of the jvm library inside the installation of your " + javaVersionString +
" runtime environment (for information on how to set this take a look at " " runtime environment (for information on how to set this take a look at "
@@ -234,6 +236,7 @@ void QtProjectWizzardContentPreferences::populate(QGridLayout* layout, int& row)
layout->addWidget(label, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop); layout->addWidget(label, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
addHelpButton( addHelpButton(
"JRE System Library",
"<p>Only required for indexing Java projects.</p>" "<p>Only required for indexing Java projects.</p>"
"<p>Add the jar files of your JRE System Library. These jars can be found inside your JRE install directory.</p>", layout, row); "<p>Add the jar files of your JRE System Library. These jars can be found inside your JRE install directory.</p>", layout, row);
@@ -263,6 +266,7 @@ void QtProjectWizzardContentPreferences::populate(QGridLayout* layout, int& row)
addLabelAndWidget("Maven Path", m_mavenPath, layout, row); addLabelAndWidget("Maven Path", m_mavenPath, layout, row);
addHelpButton( addHelpButton(
"Maven Path",
"<p>Only required for indexing projects using Maven.</p>" "<p>Only required for indexing projects using Maven.</p>"
"<p>Provide the location of your installed Maven executable. You can also use the auto detection below.</p>" "<p>Provide the location of your installed Maven executable. You can also use the auto detection below.</p>"
, layout, row , layout, row
@@ -558,14 +562,14 @@ void QtProjectWizzardContentPreferences::addGap(QGridLayout* layout, int& row)
} }
QCheckBox* QtProjectWizzardContentPreferences::addCheckBox( QCheckBox* QtProjectWizzardContentPreferences::addCheckBox(
QString label, QString text, QString help, QGridLayout* layout, int& row) QString label, QString text, QString helpText, QGridLayout* layout, int& row)
{ {
QCheckBox* checkBox = new QCheckBox(text, this); QCheckBox* checkBox = new QCheckBox(text, this);
addLabelAndWidget(label, checkBox, layout, row, Qt::AlignLeft); addLabelAndWidget(label, checkBox, layout, row, Qt::AlignLeft);
if (help.size()) if (helpText.size())
{ {
addHelpButton(help, layout, row); addHelpButton(label, helpText, layout, row);
} }
row++; row++;
@@ -574,7 +578,7 @@ QCheckBox* QtProjectWizzardContentPreferences::addCheckBox(
} }
QComboBox* QtProjectWizzardContentPreferences::addComboBox( QComboBox* QtProjectWizzardContentPreferences::addComboBox(
QString label, int min, int max, QString help, QGridLayout* layout, int& row) QString label, int min, int max, QString helpText, QGridLayout* layout, int& row)
{ {
QComboBox* comboBox = new QComboBox(this); QComboBox* comboBox = new QComboBox(this);
addLabelAndWidget(label, comboBox, layout, row, Qt::AlignLeft); addLabelAndWidget(label, comboBox, layout, row, Qt::AlignLeft);
@@ -587,9 +591,9 @@ QComboBox* QtProjectWizzardContentPreferences::addComboBox(
} }
} }
if (help.size()) if (helpText.size())
{ {
addHelpButton(help, layout, row); addHelpButton(label, helpText, layout, row);
} }
row++; row++;
@@ -597,7 +601,7 @@ QComboBox* QtProjectWizzardContentPreferences::addComboBox(
return comboBox; return comboBox;
} }
QLineEdit* QtProjectWizzardContentPreferences::addLineEdit(QString label, QString help, QGridLayout* layout, int& row) QLineEdit* QtProjectWizzardContentPreferences::addLineEdit(QString label, QString helpText, QGridLayout* layout, int& row)
{ {
QLineEdit* lineEdit = new QLineEdit(this); QLineEdit* lineEdit = new QLineEdit(this);
lineEdit->setObjectName("name"); lineEdit->setObjectName("name");
@@ -605,9 +609,9 @@ QLineEdit* QtProjectWizzardContentPreferences::addLineEdit(QString label, QStrin
addLabelAndWidget(label, lineEdit, layout, row); addLabelAndWidget(label, lineEdit, layout, row);
if (help.size()) if (helpText.size())
{ {
addHelpButton(help, layout, row); addHelpButton(label, helpText, layout, row);
} }
row++; row++;
@@ -46,9 +46,9 @@ private:
QString label, QWidget* widget, QGridLayout* layout, int& row, Qt::Alignment widgetAlignment = Qt::Alignment()); QString label, QWidget* widget, QGridLayout* layout, int& row, Qt::Alignment widgetAlignment = Qt::Alignment());
void addGap(QGridLayout* layout, int& row); void addGap(QGridLayout* layout, int& row);
QCheckBox* addCheckBox(QString label, QString text, QString help, QGridLayout* layout, int& row); QCheckBox* addCheckBox(QString label, QString text, QString helpText, QGridLayout* layout, int& row);
QComboBox* addComboBox(QString label, int min, int max, QString help, QGridLayout* layout, int& row); QComboBox* addComboBox(QString label, int min, int max, QString helpText, QGridLayout* layout, int& row);
QLineEdit* addLineEdit(QString label, QString help, QGridLayout* layout, int& row); QLineEdit* addLineEdit(QString label, QString helpText, QGridLayout* layout, int& row);
QtFontPicker* m_fontFace; QtFontPicker* m_fontFace;
QComboBox* m_fontSize; QComboBox* m_fontSize;
@@ -43,7 +43,7 @@ void QtProjectWizzardContentProjectData::populate(QGridLayout* layout, int& row)
layout->addWidget(locationLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight); layout->addWidget(locationLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
layout->addWidget(m_projectFileLocation, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignTop); layout->addWidget(m_projectFileLocation, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignTop);
addHelpButton("The directory the Sourcetrail project file (.srctrlprj) will be saved to.", layout, row); addHelpButton("Sourcetrail Project Location", "The directory the Sourcetrail project file (.srctrlprj) will be saved to.", layout, row);
layout->setRowMinimumHeight(row, 30); layout->setRowMinimumHeight(row, 30);
row++; row++;
@@ -12,7 +12,8 @@ void QtProjectWizzardContentVS::populate(QGridLayout* layout, int& row)
QLabel* nameLabel = createFormLabel("Create Compilation Database"); QLabel* nameLabel = createFormLabel("Create Compilation Database");
layout->addWidget(nameLabel, row, QtProjectWizzardWindow::FRONT_COL); layout->addWidget(nameLabel, row, QtProjectWizzardWindow::FRONT_COL);
addHelpButton("To create a new Compilation Database from a Visual Studio Solution, this Solution has to be open in Visual Studio.\n\ addHelpButton(
"Create Compilation Database", "To create a new Compilation Database from a Visual Studio Solution, this Solution has to be open in Visual Studio.\n\
Sourcetrail will call Visual Studio to open the 'Create Compilation Database' dialog.\ Sourcetrail will call Visual Studio to open the 'Create Compilation Database' dialog.\
Please follow the instructions in Visual Studio to complete the process.\n\ Please follow the instructions in Visual Studio to complete the process.\n\
Note: Sourcetrail's Visual Studio plugin has to be installed. Visual Studio has to be running with an eligible Solution, containing C/C++ projects, loaded.", layout, row); Note: Sourcetrail's Visual Studio plugin has to be installed. Visual Studio has to be running with an eligible Solution, containing C/C++ projects, loaded.", layout, row);