ui: added help texts to directory list boxes
* added a ? button to the labels of the directory list boxes to show help messages * added a window stack to QtMainWindow for easier screen handling * added a button to the preferences in the project setup * removed 'has seen settings' flag from AppSettings
This commit is contained in:
@@ -40,13 +40,11 @@
|
||||
</code>
|
||||
|
||||
<user>
|
||||
<has_seen_settings><!-- BOOL: if the user was already asked to enter app settings --></has_seen_settings>
|
||||
|
||||
<recent_projects>
|
||||
<recent_project><!-- STRING: recent project path --></recent_project>
|
||||
</recent_projects>
|
||||
</user>
|
||||
|
||||
|
||||
<network>
|
||||
<plugin_port><!-- INTEGER: port the plugin listens to, standard is 6666 --></plugin_port>
|
||||
<coati_port><!-- INTEGER: port coati is listening to, standard is 6667 --></coati_port>
|
||||
|
||||
@@ -31,6 +31,20 @@ QLineEdit:disabled {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#form #help {
|
||||
background: transparent;
|
||||
border: 1px solid #575656;
|
||||
border-radius: 9px;
|
||||
color: #575656;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
}
|
||||
|
||||
#form #help:hover {
|
||||
border-color: black;
|
||||
color: black;
|
||||
}
|
||||
|
||||
#moreButton {
|
||||
background-color: rgba(255, 255, 255, 200);
|
||||
border: 1px solid lightgray;
|
||||
|
||||
@@ -68,7 +68,7 @@ void QtMainView::setStatusBar(QStatusBar* statusbar)
|
||||
|
||||
void QtMainView::hideStartScreen()
|
||||
{
|
||||
m_window->hideScreens();
|
||||
m_window->clearWindows();
|
||||
}
|
||||
|
||||
void QtMainView::setTitle(const std::string& title)
|
||||
|
||||
@@ -95,20 +95,18 @@ void QtAbout::setup()
|
||||
closeButton->setObjectName("closeButton");
|
||||
closeButton->move(320, 20);
|
||||
|
||||
connect(closeButton, SIGNAL(clicked()), this, SLOT(handleDoneButtonPress()));
|
||||
connect(closeButton, SIGNAL(clicked()), this, SLOT(handleCloseButtonPress()));
|
||||
}
|
||||
|
||||
void QtAbout::handleCloseButtonPress()
|
||||
{
|
||||
emit finished();
|
||||
}
|
||||
|
||||
void QtAbout::handleCancelButtonPress()
|
||||
{
|
||||
emit canceled();
|
||||
}
|
||||
|
||||
void QtAbout::handleUpdateButtonPress()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
void QtAbout::handleDoneButtonPress()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
@@ -18,14 +18,10 @@ public:
|
||||
virtual void setup() override;
|
||||
|
||||
private slots:
|
||||
void handleCloseButtonPress();
|
||||
|
||||
void handleCancelButtonPress();
|
||||
void handleUpdateButtonPress();
|
||||
void handleDoneButtonPress();
|
||||
|
||||
private:
|
||||
QPushButton* m_cancelButton;
|
||||
QPushButton* m_updateButton;
|
||||
|
||||
};
|
||||
|
||||
#endif //QT_ABOUT_H
|
||||
|
||||
@@ -57,15 +57,9 @@ void QtAboutLicense::populateForm(QFormLayout* layout)
|
||||
|
||||
void QtAboutLicense::handleCancelButtonPress()
|
||||
{
|
||||
emit canceled();
|
||||
}
|
||||
|
||||
void QtAboutLicense::handleUpdateButtonPress()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
void QtAboutLicense::handleDoneButtonPress()
|
||||
{
|
||||
close();
|
||||
emit finished();
|
||||
}
|
||||
|
||||
@@ -16,18 +16,13 @@ public:
|
||||
QSize sizeHint() const Q_DECL_OVERRIDE;
|
||||
|
||||
virtual void setup() override;
|
||||
|
||||
protected:
|
||||
virtual void populateForm(QFormLayout* layout) override;
|
||||
|
||||
private slots:
|
||||
void handleCancelButtonPress();
|
||||
void handleUpdateButtonPress();
|
||||
void handleDoneButtonPress();
|
||||
|
||||
private:
|
||||
QPushButton* m_cancelButton;
|
||||
QPushButton* m_updateButton;
|
||||
|
||||
};
|
||||
|
||||
#endif //QT_ABOUT_LICENSE_H
|
||||
|
||||
@@ -45,18 +45,21 @@ void QtApplicationSettingsScreen::load()
|
||||
void QtApplicationSettingsScreen::populateForm(QFormLayout* layout)
|
||||
{
|
||||
int minimumWidthForSecondCol = 360;
|
||||
QPushButton* helpButton;
|
||||
|
||||
QLabel* includePathsLabel = new QLabel("Include Paths");
|
||||
QWidget* includePathsWidget = createLabelWithHelpButton("Header\nSearch Paths", &helpButton);
|
||||
connect(helpButton, SIGNAL(clicked()), this, SLOT(handleIncludePathHelpPress()));
|
||||
m_includePaths = new QtDirectoryListBox(this);
|
||||
m_includePaths->setMinimumWidth(minimumWidthForSecondCol);
|
||||
layout->addRow(includePathsLabel, m_includePaths);
|
||||
layout->addRow(includePathsWidget, m_includePaths);
|
||||
|
||||
if (QSysInfo::macVersion() != QSysInfo::MV_None)
|
||||
{
|
||||
QLabel* frameworkPathsLabel = new QLabel("Framework Paths");
|
||||
QWidget* frameworkPathsWidget = createLabelWithHelpButton("Framework\nSearch Paths", &helpButton);
|
||||
connect(helpButton, SIGNAL(clicked()), this, SLOT(handleFrameworkPathHelpPress()));
|
||||
m_frameworkPaths = new QtDirectoryListBox(this);
|
||||
m_frameworkPaths->setMinimumWidth(minimumWidthForSecondCol);
|
||||
layout->addRow(frameworkPathsLabel, m_frameworkPaths);
|
||||
layout->addRow(frameworkPathsWidget, m_frameworkPaths);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,3 +84,21 @@ void QtApplicationSettingsScreen::handleUpdateButtonPress()
|
||||
MessageRefresh().dispatch();
|
||||
emit finished();
|
||||
}
|
||||
|
||||
void QtApplicationSettingsScreen::handleIncludePathHelpPress()
|
||||
{
|
||||
showHelpMessage(
|
||||
"Header Search Paths define where additional headers, that your project depends on, are found. Usually they are "
|
||||
"header files of frameworks or libraries that your project uses. These files won't be analysed, but Coati needs "
|
||||
"them for correct analysis.\n\n"
|
||||
"Header Search Paths defined here will be used for all projects."
|
||||
);
|
||||
}
|
||||
|
||||
void QtApplicationSettingsScreen::handleFrameworkPathHelpPress()
|
||||
{
|
||||
showHelpMessage(
|
||||
"Framework Search Paths define where MacOS framework containers, that your project depends on, are found.\n\n"
|
||||
"Framework Search Paths defined here will be used for all projects."
|
||||
);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,9 @@ private slots:
|
||||
void handleCancelButtonPress();
|
||||
void handleUpdateButtonPress();
|
||||
|
||||
void handleIncludePathHelpPress();
|
||||
void handleFrameworkPathHelpPress();
|
||||
|
||||
private:
|
||||
QPushButton* m_cancelButton;
|
||||
QPushButton* m_updateButton;
|
||||
|
||||
@@ -45,7 +45,6 @@ void QtViewToggle::toggledByUI()
|
||||
}
|
||||
|
||||
QtMainWindow::QtMainWindow()
|
||||
: m_startScreenWasVisible(false)
|
||||
{
|
||||
setObjectName("QtMainWindow");
|
||||
setCentralWidget(nullptr);
|
||||
@@ -72,25 +71,12 @@ QtMainWindow::QtMainWindow()
|
||||
|
||||
void QtMainWindow::init()
|
||||
{
|
||||
ApplicationSettings* appSettings = ApplicationSettings::getInstance().get();
|
||||
|
||||
if (appSettings->getUserHasSeenSettings())
|
||||
{
|
||||
showStartScreen();
|
||||
}
|
||||
else
|
||||
{
|
||||
openSettings();
|
||||
m_startScreenWasVisible = true;
|
||||
|
||||
appSettings->setUserHasSeenSettings(true);
|
||||
appSettings->save();
|
||||
}
|
||||
showStartScreen();
|
||||
}
|
||||
|
||||
QtMainWindow::~QtMainWindow()
|
||||
{
|
||||
if(m_recentProjectAction)
|
||||
if (m_recentProjectAction)
|
||||
{
|
||||
delete [] m_recentProjectAction;
|
||||
}
|
||||
@@ -192,118 +178,114 @@ bool QtMainWindow::event(QEvent* event)
|
||||
return QMainWindow::event(event);
|
||||
}
|
||||
|
||||
void QtMainWindow::pushWindow(QWidget* window)
|
||||
{
|
||||
if (m_windowStack.size())
|
||||
{
|
||||
m_windowStack.back()->hide();
|
||||
}
|
||||
|
||||
window->show();
|
||||
|
||||
m_windowStack.push_back(window);
|
||||
}
|
||||
|
||||
void QtMainWindow::popWindow()
|
||||
{
|
||||
if (m_windowStack.size())
|
||||
{
|
||||
m_windowStack.back()->hide();
|
||||
m_windowStack.pop_back();
|
||||
}
|
||||
|
||||
if (m_windowStack.size())
|
||||
{
|
||||
m_windowStack.back()->show();
|
||||
}
|
||||
}
|
||||
|
||||
void QtMainWindow::clearWindows()
|
||||
{
|
||||
if (m_windowStack.size())
|
||||
{
|
||||
m_windowStack.back()->hide();
|
||||
}
|
||||
|
||||
m_windowStack.clear();
|
||||
}
|
||||
|
||||
void QtMainWindow::about()
|
||||
{
|
||||
hideScreens();
|
||||
|
||||
if (!m_aboutWindow)
|
||||
{
|
||||
m_aboutWindow = std::make_shared<QtAbout>(this);
|
||||
m_aboutWindow->setup();
|
||||
|
||||
connect(m_aboutWindow.get(), SIGNAL(finished()), this, SLOT(closeScreens()));
|
||||
connect(m_aboutWindow.get(), SIGNAL(canceled()), this, SLOT(restoreScreens()));
|
||||
connect(m_aboutWindow.get(), SIGNAL(finished()), this, SLOT(popWindow()));
|
||||
}
|
||||
|
||||
m_aboutWindow->show();
|
||||
}
|
||||
|
||||
void QtMainWindow::hideScreens()
|
||||
{
|
||||
if (m_applicationSettingsScreen)
|
||||
{
|
||||
m_applicationSettingsScreen->hide();
|
||||
}
|
||||
|
||||
if (m_startScreen)
|
||||
{
|
||||
m_startScreen->hide();
|
||||
}
|
||||
|
||||
if (m_newProjectDialog)
|
||||
{
|
||||
m_newProjectDialog->hide();
|
||||
}
|
||||
|
||||
if(m_licenseWindow)
|
||||
{
|
||||
m_licenseWindow->hide();
|
||||
}
|
||||
|
||||
if(m_aboutWindow)
|
||||
{
|
||||
m_aboutWindow->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void QtMainWindow::closeScreens()
|
||||
{
|
||||
hideScreens();
|
||||
m_startScreenWasVisible = false;
|
||||
}
|
||||
|
||||
void QtMainWindow::restoreScreens()
|
||||
{
|
||||
if (m_startScreenWasVisible)
|
||||
{
|
||||
showStartScreen();
|
||||
}
|
||||
else
|
||||
{
|
||||
closeScreens();
|
||||
}
|
||||
pushWindow(m_aboutWindow.get());
|
||||
}
|
||||
|
||||
void QtMainWindow::openSettings()
|
||||
{
|
||||
hideScreens();
|
||||
|
||||
if (!m_applicationSettingsScreen)
|
||||
{
|
||||
m_applicationSettingsScreen = std::make_shared<QtApplicationSettingsScreen>(this);
|
||||
m_applicationSettingsScreen->setup();
|
||||
connect(m_applicationSettingsScreen.get(), SIGNAL(finished()), this, SLOT(restoreScreens()));
|
||||
connect(m_applicationSettingsScreen.get(), SIGNAL(canceled()), this, SLOT(restoreScreens()));
|
||||
|
||||
connect(m_applicationSettingsScreen.get(), SIGNAL(finished()), this, SLOT(popWindow()));
|
||||
connect(m_applicationSettingsScreen.get(), SIGNAL(canceled()), this, SLOT(popWindow()));
|
||||
}
|
||||
|
||||
m_applicationSettingsScreen->load();
|
||||
m_applicationSettingsScreen->show();
|
||||
pushWindow(m_applicationSettingsScreen.get());
|
||||
}
|
||||
|
||||
void QtMainWindow::showLicenses()
|
||||
{
|
||||
if (!m_licenseWindow)
|
||||
{
|
||||
m_licenseWindow = std::make_shared<QtAboutLicense>(this);
|
||||
m_licenseWindow->setup();
|
||||
|
||||
connect(m_licenseWindow.get(), SIGNAL(finished()), this, SLOT(popWindow()));
|
||||
}
|
||||
|
||||
pushWindow(m_licenseWindow.get());
|
||||
}
|
||||
|
||||
void QtMainWindow::showStartScreen()
|
||||
{
|
||||
hideScreens();
|
||||
|
||||
if (!m_startScreen)
|
||||
{
|
||||
m_startScreen = std::make_shared<QtStartScreen>(this);
|
||||
m_startScreen->setup();
|
||||
connect(m_startScreen.get(), SIGNAL(finished()), this, SLOT(closeScreens()));
|
||||
connect(m_startScreen.get(), SIGNAL(canceled()), this, SLOT(closeScreens()));
|
||||
|
||||
connect(m_startScreen.get(), SIGNAL(finished()), this, SLOT(popWindow()));
|
||||
connect(m_startScreen.get(), SIGNAL(canceled()), this, SLOT(popWindow()));
|
||||
|
||||
connect(m_startScreen.get(), SIGNAL(openOpenProjectDialog()), this, SLOT(openProject()));
|
||||
connect(m_startScreen.get(), SIGNAL(openNewProjectDialog()), this, SLOT(newProject()));
|
||||
}
|
||||
|
||||
m_startScreen->show();
|
||||
m_startScreenWasVisible = true;
|
||||
pushWindow(m_startScreen.get());
|
||||
}
|
||||
|
||||
void QtMainWindow::newProject()
|
||||
{
|
||||
hideScreens();
|
||||
|
||||
if (!m_newProjectDialog)
|
||||
{
|
||||
m_newProjectDialog = std::make_shared<QtProjectSetupScreen>(this);
|
||||
m_newProjectDialog->setup();
|
||||
|
||||
connect(m_newProjectDialog.get(), SIGNAL(finished()), this, SLOT(closeScreens()));
|
||||
connect(m_newProjectDialog.get(), SIGNAL(canceled()), this, SLOT(restoreScreens()));
|
||||
connect(m_newProjectDialog.get(), SIGNAL(finished()), this, SLOT(clearWindows()));
|
||||
connect(m_newProjectDialog.get(), SIGNAL(canceled()), this, SLOT(popWindow()));
|
||||
connect(m_newProjectDialog.get(), SIGNAL(showPreferences()), this, SLOT(openSettings()));
|
||||
}
|
||||
|
||||
m_newProjectDialog->loadEmpty();
|
||||
m_newProjectDialog->show();
|
||||
pushWindow(m_newProjectDialog.get());
|
||||
}
|
||||
|
||||
void QtMainWindow::openProject(const QString &path)
|
||||
@@ -318,7 +300,7 @@ void QtMainWindow::openProject(const QString &path)
|
||||
if (!fileName.isEmpty())
|
||||
{
|
||||
MessageLoadProject(fileName.toStdString()).dispatch();
|
||||
closeScreens();
|
||||
clearWindows();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,7 +398,7 @@ void QtMainWindow::toggleView(View* view, bool fromMenu)
|
||||
|
||||
void QtMainWindow::handleEscapeShortcut()
|
||||
{
|
||||
closeScreens();
|
||||
popWindow();
|
||||
MessageInterruptTasks().dispatch();
|
||||
}
|
||||
|
||||
@@ -489,14 +471,6 @@ void QtMainWindow::setWindowSettingsPath(const std::string& windowSettingsPath)
|
||||
m_windowSettingsPath = windowSettingsPath;
|
||||
}
|
||||
|
||||
void QtMainWindow::showLicenses()
|
||||
{
|
||||
hideScreens();
|
||||
m_licenseWindow = std::make_shared<QtAboutLicense>(this);
|
||||
m_licenseWindow->setup();
|
||||
m_licenseWindow->show();
|
||||
}
|
||||
|
||||
void QtMainWindow::setupEditMenu()
|
||||
{
|
||||
QMenu *menu = new QMenu(tr("&Edit"), this);
|
||||
|
||||
@@ -56,12 +56,14 @@ protected:
|
||||
bool event(QEvent* event);
|
||||
|
||||
public slots:
|
||||
void about();
|
||||
void hideScreens();
|
||||
void closeScreens();
|
||||
void restoreScreens();
|
||||
void pushWindow(QWidget* window);
|
||||
void popWindow();
|
||||
void clearWindows();
|
||||
|
||||
void about();
|
||||
void openSettings();
|
||||
void showLicenses();
|
||||
|
||||
void showStartScreen();
|
||||
void newProject();
|
||||
void openProject(const QString &path = QString());
|
||||
@@ -76,7 +78,6 @@ public slots:
|
||||
void saveProject();
|
||||
void saveAsProject();
|
||||
|
||||
void showLicenses();
|
||||
|
||||
void undo();
|
||||
void redo();
|
||||
@@ -121,9 +122,9 @@ private:
|
||||
std::shared_ptr<QtAboutLicense> m_licenseWindow;
|
||||
std::shared_ptr<QtAbout> m_aboutWindow;
|
||||
|
||||
QShortcut* m_escapeShortcut;
|
||||
std::vector<QWidget*> m_windowStack;
|
||||
|
||||
bool m_startScreenWasVisible;
|
||||
QShortcut* m_escapeShortcut;
|
||||
|
||||
static std::string m_windowSettingsPath;
|
||||
};
|
||||
|
||||
@@ -83,6 +83,13 @@ void QtProjectSetupScreen::clear()
|
||||
void QtProjectSetupScreen::setup()
|
||||
{
|
||||
setupForm();
|
||||
|
||||
QPushButton* preferencesButton = new QPushButton("Preferences");
|
||||
preferencesButton->setObjectName("windowButton");
|
||||
connect(preferencesButton, SIGNAL(clicked()), this, SLOT(handlePreferencesButtonPress()));
|
||||
|
||||
m_buttonsLayout->insertWidget(2, preferencesButton);
|
||||
m_buttonsLayout->insertStretch(3);
|
||||
}
|
||||
|
||||
void QtProjectSetupScreen::loadEmpty()
|
||||
@@ -131,22 +138,27 @@ void QtProjectSetupScreen::populateForm(QFormLayout* layout)
|
||||
language->insertItem(0, "C++");
|
||||
layout->addRow(languageLabel, language);
|
||||
|
||||
QLabel* sourcePathsLabel = new QLabel("Source Paths");
|
||||
QPushButton* helpButton;
|
||||
|
||||
QWidget* sourcePathsWidget = createLabelWithHelpButton("Source Paths", &helpButton);
|
||||
connect(helpButton, SIGNAL(clicked()), this, SLOT(handleSourcePathHelpPress()));
|
||||
m_sourcePaths = new QtDirectoryListBox(this);
|
||||
m_sourcePaths->setMinimumWidth(minimumWidthForSecondCol);
|
||||
layout->addRow(sourcePathsLabel, m_sourcePaths);
|
||||
layout->addRow(sourcePathsWidget, m_sourcePaths);
|
||||
|
||||
QLabel* includePathsLabel = new QLabel("Include Paths");
|
||||
QWidget* includePathsWidget = createLabelWithHelpButton("Header\nSearch Paths", &helpButton);
|
||||
connect(helpButton, SIGNAL(clicked()), this, SLOT(handleIncludePathHelpPress()));
|
||||
m_includePaths = new QtDirectoryListBox(this);
|
||||
m_includePaths->setMinimumWidth(minimumWidthForSecondCol);
|
||||
layout->addRow(includePathsLabel, m_includePaths);
|
||||
layout->addRow(includePathsWidget, m_includePaths);
|
||||
|
||||
if (QSysInfo::macVersion() != QSysInfo::MV_None)
|
||||
{
|
||||
QLabel* frameworkPathsLabel = new QLabel("Framework Paths");
|
||||
QWidget* frameworkPathsWidget = createLabelWithHelpButton("Framework\nSearch Paths", &helpButton);
|
||||
connect(helpButton, SIGNAL(clicked()), this, SLOT(handleFrameworkPathHelpPress()));
|
||||
m_frameworkPaths = new QtDirectoryListBox(this);
|
||||
m_frameworkPaths->setMinimumWidth(minimumWidthForSecondCol);
|
||||
layout->addRow(frameworkPathsLabel, m_frameworkPaths);
|
||||
layout->addRow(frameworkPathsWidget, m_frameworkPaths);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,3 +214,34 @@ void QtProjectSetupScreen::handleUpdateButtonPress()
|
||||
|
||||
emit finished();
|
||||
}
|
||||
|
||||
void QtProjectSetupScreen::handleSourcePathHelpPress()
|
||||
{
|
||||
showHelpMessage(
|
||||
"Source Paths define the files and directories that will be analysed by Coati. Usually these are the source "
|
||||
"files of your project or a subset of them."
|
||||
);
|
||||
}
|
||||
|
||||
void QtProjectSetupScreen::handleIncludePathHelpPress()
|
||||
{
|
||||
showHelpMessage(
|
||||
"Header Search Paths define where additional headers, that your project depends on, are found. Usually they are "
|
||||
"header files of frameworks or libraries that your project uses. These files won't be analysed, but Coati needs "
|
||||
"them for correct analysis.\n\n"
|
||||
"Please note that you can define Header Search Paths for all your projects in Coati's preferences."
|
||||
);
|
||||
}
|
||||
|
||||
void QtProjectSetupScreen::handleFrameworkPathHelpPress()
|
||||
{
|
||||
showHelpMessage(
|
||||
"Framework Search Paths define where MacOS framework containers, that your project depends on, are found.\n\n"
|
||||
"Please note that you can define Framework Search Paths for all your projects in Coati's preferences."
|
||||
);
|
||||
}
|
||||
|
||||
void QtProjectSetupScreen::handlePreferencesButtonPress()
|
||||
{
|
||||
emit showPreferences();
|
||||
}
|
||||
|
||||
@@ -47,6 +47,9 @@ public:
|
||||
|
||||
void projectSetupScreen();
|
||||
|
||||
signals:
|
||||
void showPreferences();
|
||||
|
||||
protected:
|
||||
virtual void populateForm(QFormLayout* layout) override;
|
||||
|
||||
@@ -54,17 +57,21 @@ private slots:
|
||||
void handleCancelButtonPress();
|
||||
void handleUpdateButtonPress();
|
||||
|
||||
void handleSourcePathHelpPress();
|
||||
void handleIncludePathHelpPress();
|
||||
void handleFrameworkPathHelpPress();
|
||||
|
||||
void handlePreferencesButtonPress();
|
||||
|
||||
private:
|
||||
QLineEdit* m_projectName;
|
||||
QtTextLine* m_projectFileLocation;
|
||||
|
||||
QPushButton* m_createButton;
|
||||
QPushButton* m_cancelButton;
|
||||
QPushButton* m_updateButton;
|
||||
|
||||
QtDirectoryListBox* m_includePaths;
|
||||
QtDirectoryListBox* m_sourcePaths;
|
||||
QtDirectoryListBox* m_frameworkPaths;
|
||||
|
||||
QPushButton* m_preferencesButton;
|
||||
};
|
||||
|
||||
#endif //QT_PROJECT_SETUP_SCREEN_H
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <QFormLayout>
|
||||
#include <QGraphicsDropShadowEffect>
|
||||
#include <QLabel>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
#include <QScrollArea>
|
||||
#include <QSysInfo>
|
||||
@@ -150,6 +151,7 @@ void QtSettingsWindow::setupForm()
|
||||
buttons->addWidget(m_cancelButton);
|
||||
buttons->addStretch();
|
||||
buttons->addWidget(m_doneButton);
|
||||
m_buttonsLayout = buttons;
|
||||
|
||||
windowLayout->addWidget(scrollArea);
|
||||
windowLayout->addSpacing(20);
|
||||
@@ -188,3 +190,40 @@ void QtSettingsWindow::hideCancelButton(bool hidden)
|
||||
m_cancelButton->setVisible(!hidden);
|
||||
}
|
||||
}
|
||||
|
||||
QWidget* QtSettingsWindow::createLabelWithHelpButton(QString name, QPushButton** helpButton)
|
||||
{
|
||||
QWidget* widget = new QWidget();
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
layout->setContentsMargins(0, 5, 0, 5);
|
||||
layout->setSpacing(5);
|
||||
|
||||
QLabel* label = new QLabel(name);
|
||||
label->setAlignment(Qt::AlignRight);
|
||||
layout->addWidget(label);
|
||||
|
||||
QPushButton* button = new QPushButton("?");
|
||||
button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
button->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
button->setObjectName("help");
|
||||
|
||||
layout->addWidget(button, 0, Qt::AlignRight);
|
||||
layout->addStretch();
|
||||
|
||||
widget->setLayout(layout);
|
||||
|
||||
*helpButton = button;
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
void QtSettingsWindow::showHelpMessage(const QString& msg)
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Help");
|
||||
msgBox.setInformativeText(msg);
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||
int ret = msgBox.exec();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef QT_SETTINGS_WINDOW_H
|
||||
#define QT_SETTINGS_WINDOW_H
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QResizeEvent>
|
||||
#include <QWidget>
|
||||
|
||||
@@ -38,6 +39,10 @@ protected:
|
||||
void updateDoneButton(QString text);
|
||||
void hideCancelButton(bool hidden);
|
||||
|
||||
QWidget* createLabelWithHelpButton(QString name, QPushButton** helpButton);
|
||||
|
||||
void showHelpMessage(const QString& msg);
|
||||
|
||||
QWidget* m_window;
|
||||
|
||||
QLabel* m_title;
|
||||
@@ -45,6 +50,8 @@ protected:
|
||||
QPushButton* m_cancelButton;
|
||||
QPushButton* m_doneButton;
|
||||
|
||||
QHBoxLayout* m_buttonsLayout;
|
||||
|
||||
private:
|
||||
int m_displacment;
|
||||
QPoint m_dragPosition;
|
||||
|
||||
@@ -131,16 +131,6 @@ bool ApplicationSettings::setRecentProjects(const std::vector<FilePath> &recentP
|
||||
return setPathValues("user/recent_projects/recent_project", recentProjects);
|
||||
}
|
||||
|
||||
bool ApplicationSettings::getUserHasSeenSettings() const
|
||||
{
|
||||
return getValue<bool>("user/has_seen_settings", false);
|
||||
}
|
||||
|
||||
void ApplicationSettings::setUserHasSeenSettings(bool hasSeenSettings)
|
||||
{
|
||||
setValue<bool>("user/has_seen_settings", hasSeenSettings);
|
||||
}
|
||||
|
||||
int ApplicationSettings::getPluginPort() const
|
||||
{
|
||||
return getValue<int>("network/plugin_port", 6666);
|
||||
|
||||
@@ -49,9 +49,6 @@ public:
|
||||
void setCodeSnippetExpandRange(int range);
|
||||
|
||||
// user
|
||||
bool getUserHasSeenSettings() const;
|
||||
void setUserHasSeenSettings(bool hasSeenSettings);
|
||||
|
||||
std::vector<FilePath> getRecentProjects() const;
|
||||
bool setRecentProjects(const std::vector<FilePath>& recentProjects);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user