ui: Added plain text editing dialog to list boxes in project setup UI
* Added class QtTextEditDialog for displaying text content * Added edit button to QtDirectoryListBox * Replaced show files button dialog using QtProjectWizzardContentSourceList with QtTextEditDialog
This commit is contained in:
@@ -34,7 +34,7 @@ QtListItemWidget #field {
|
||||
border-top: 1px solid lightgray;
|
||||
}
|
||||
|
||||
#plusButton, #minusButton, #dotsButton {
|
||||
#plusButton, #minusButton, #dotsButton, #editButton {
|
||||
color: white;
|
||||
height: 1em;
|
||||
margin-right: 3px;
|
||||
@@ -70,6 +70,15 @@ QtListItemWidget #field {
|
||||
border-image: url(<setting:gui_path>window/dots_hover.png);
|
||||
}
|
||||
|
||||
#editButton {
|
||||
border-image: url(<setting:gui_path>code_view/images/edit.png);
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
||||
#editButton:hover {
|
||||
background-color: #EEE;
|
||||
}
|
||||
|
||||
#dropInfo {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@
|
||||
background: #CFD2E0;
|
||||
}
|
||||
|
||||
#files {
|
||||
#textField {
|
||||
border: 1px solid lightgray;
|
||||
border-radius: 12px;
|
||||
padding: 6px;
|
||||
|
||||
@@ -131,8 +131,6 @@ add_files(
|
||||
qt/window/project_wizzard/QtProjectWizzardContentSelect.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentSimple.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentSimple.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentSourceList.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentSourceList.h
|
||||
qt/window/project_wizzard/QtProjectWizzardContentSummary.cpp
|
||||
qt/window/project_wizzard/QtProjectWizzardContentSummary.h
|
||||
qt/window/project_wizzard/QtProjectWizzardWindow.cpp
|
||||
@@ -150,6 +148,8 @@ add_files(
|
||||
qt/window/QtSplashScreen.h
|
||||
qt/window/QtStartScreen.cpp
|
||||
qt/window/QtStartScreen.h
|
||||
qt/window/QtTextEditDialog.cpp
|
||||
qt/window/QtTextEditDialog.h
|
||||
qt/window/QtWindow.cpp
|
||||
qt/window/QtWindow.h
|
||||
qt/window/QtWindowStack.cpp
|
||||
|
||||
@@ -9,8 +9,10 @@
|
||||
#include <QTreeView>
|
||||
|
||||
#include "utility/ResourcePaths.h"
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
#include "qt/utility/utilityQt.h"
|
||||
#include "qt/window/QtTextEditDialog.h"
|
||||
|
||||
QtListItemWidget::QtListItemWidget(QtDirectoryListBox* list, QListWidgetItem* item, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
@@ -102,8 +104,9 @@ void QtListItemWidget::handleFocus()
|
||||
}
|
||||
|
||||
|
||||
QtDirectoryListBox::QtDirectoryListBox(QWidget *parent, bool forStrings)
|
||||
QtDirectoryListBox::QtDirectoryListBox(QWidget *parent, const QString& listName, bool forStrings)
|
||||
: QFrame(parent)
|
||||
, m_listName(listName)
|
||||
, m_forStrings(forStrings)
|
||||
{
|
||||
QBoxLayout* layout = new QVBoxLayout();
|
||||
@@ -147,6 +150,12 @@ QtDirectoryListBox::QtDirectoryListBox(QWidget *parent, bool forStrings)
|
||||
dropInfoText->setAlignment(Qt::AlignRight);
|
||||
innerLayout->addWidget(dropInfoText);
|
||||
|
||||
QPushButton* editButton = new QPushButton("", this);
|
||||
editButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
editButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
editButton->setObjectName("editButton");
|
||||
innerLayout->addWidget(editButton);
|
||||
|
||||
if (isForStrings())
|
||||
{
|
||||
dropInfoText->hide();
|
||||
@@ -160,6 +169,7 @@ QtDirectoryListBox::QtDirectoryListBox(QWidget *parent, bool forStrings)
|
||||
|
||||
connect(m_addButton, SIGNAL(clicked()), this, SLOT(addListBoxItem()));
|
||||
connect(m_removeButton, SIGNAL(clicked()), this, SLOT(removeListBoxItem()));
|
||||
connect(editButton, SIGNAL(clicked()), this, SLOT(showEditDialog()));
|
||||
|
||||
setAcceptDrops(true);
|
||||
setSizePolicy(sizePolicy().horizontalPolicy(), QSizePolicy::Minimum);
|
||||
@@ -330,3 +340,46 @@ void QtDirectoryListBox::dragEnterEvent(QDragEnterEvent *event)
|
||||
{
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void QtDirectoryListBox::showEditDialog()
|
||||
{
|
||||
if (!m_editDialog)
|
||||
{
|
||||
m_editDialog = std::make_shared<QtTextEditDialog>(m_listName, "Edit the list in plain text. Each line is one item.");
|
||||
m_editDialog->setup();
|
||||
|
||||
m_editDialog->setText(utility::join(getStringList(), "\n"));
|
||||
|
||||
connect(m_editDialog.get(), SIGNAL(canceled()), this, SLOT(canceledEditDialog()));
|
||||
connect(m_editDialog.get(), SIGNAL(finished()), this, SLOT(savedEditDialog()));
|
||||
}
|
||||
|
||||
m_editDialog->showWindow();
|
||||
m_editDialog->raise();
|
||||
}
|
||||
|
||||
void QtDirectoryListBox::canceledEditDialog()
|
||||
{
|
||||
m_editDialog->hide();
|
||||
m_editDialog.reset();
|
||||
|
||||
window()->raise();
|
||||
}
|
||||
|
||||
void QtDirectoryListBox::savedEditDialog()
|
||||
{
|
||||
std::vector<std::string> lines = utility::splitToVector(m_editDialog->getText(), "\n");
|
||||
for (size_t i = 0; i < lines.size(); i++)
|
||||
{
|
||||
lines[i] = utility::trim(lines[i]);
|
||||
|
||||
if (!lines[i].size())
|
||||
{
|
||||
lines.erase(lines.begin() + i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
setStringList(lines);
|
||||
|
||||
canceledEditDialog();
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "qt/element/QtLineEdit.h"
|
||||
|
||||
class QtDirectoryListBox;
|
||||
class QtTextEditDialog;
|
||||
|
||||
class QtListItemWidget
|
||||
: public QWidget
|
||||
@@ -46,7 +47,7 @@ class QtDirectoryListBox
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtDirectoryListBox(QWidget *parent, bool forStrings = false);
|
||||
QtDirectoryListBox(QWidget *parent, const QString& listName, bool forStrings = false);
|
||||
|
||||
virtual QSize sizeHint() const override;
|
||||
|
||||
@@ -74,12 +75,19 @@ private slots:
|
||||
QtListItemWidget* addListBoxItem();
|
||||
void removeListBoxItem();
|
||||
|
||||
void showEditDialog();
|
||||
void canceledEditDialog();
|
||||
void savedEditDialog();
|
||||
|
||||
private:
|
||||
QPushButton* m_addButton;
|
||||
QPushButton* m_removeButton;
|
||||
QListWidget* m_list;
|
||||
|
||||
QString m_listName;
|
||||
bool m_forStrings;
|
||||
|
||||
std::shared_ptr<QtTextEditDialog> m_editDialog;
|
||||
};
|
||||
|
||||
#endif // QT_DIRECTORY_LIST_BOX_H
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
#include "qt/window/QtTextEditDialog.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QPlainTextEdit>
|
||||
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
QtTextEditDialog::QtTextEditDialog(const QString& title, const QString& description, QWidget* parent)
|
||||
: QtWindow(parent)
|
||||
, m_title(title)
|
||||
, m_description(description)
|
||||
{
|
||||
}
|
||||
|
||||
QSize QtTextEditDialog::sizeHint() const
|
||||
{
|
||||
return QSize(550, 550);
|
||||
}
|
||||
|
||||
void QtTextEditDialog::setText(const std::string& text)
|
||||
{
|
||||
m_text->setPlainText(QString::fromStdString(text));
|
||||
}
|
||||
|
||||
std::string QtTextEditDialog::getText()
|
||||
{
|
||||
return m_text->toPlainText().toStdString();
|
||||
}
|
||||
|
||||
void QtTextEditDialog::setReadOnly(bool readOnly)
|
||||
{
|
||||
m_text->setReadOnly(readOnly);
|
||||
}
|
||||
|
||||
void QtTextEditDialog::populateWindow(QWidget* widget)
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
QLabel* description = new QLabel(m_description);
|
||||
description->setObjectName("description");
|
||||
layout->addWidget(description);
|
||||
|
||||
m_text = new QPlainTextEdit();
|
||||
m_text->setObjectName("textField");
|
||||
m_text->setLineWrapMode(QPlainTextEdit::NoWrap);
|
||||
layout->addWidget(m_text);
|
||||
|
||||
widget->setLayout(layout);
|
||||
}
|
||||
|
||||
void QtTextEditDialog::windowReady()
|
||||
{
|
||||
updateNextButton("Ok");
|
||||
updateCloseButton("Cancel");
|
||||
|
||||
setPreviousVisible(false);
|
||||
|
||||
updateTitle(m_title);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef QT_TEXT_EDIT_DIALOG_H
|
||||
#define QT_TEXT_EDIT_DIALOG_H
|
||||
|
||||
#include "qt/window/QtWindow.h"
|
||||
|
||||
class QPlainTextEdit;
|
||||
|
||||
class QtTextEditDialog
|
||||
: public QtWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtTextEditDialog(const QString& title, const QString& description, QWidget* parent = 0);
|
||||
|
||||
QSize sizeHint() const override;
|
||||
|
||||
void setText(const std::string& text);
|
||||
std::string getText();
|
||||
|
||||
void setReadOnly(bool readOnly);
|
||||
|
||||
protected:
|
||||
void populateWindow(QWidget* widget) override;
|
||||
void windowReady() override;
|
||||
|
||||
private:
|
||||
QString m_title;
|
||||
QString m_description;
|
||||
|
||||
QPlainTextEdit* m_text;
|
||||
};
|
||||
|
||||
#endif // QT_TEXT_EDIT_DIALOG_H
|
||||
@@ -362,10 +362,13 @@ void QtWindow::setupDone()
|
||||
QSize size(qMax(actualSize.width(), preferredSize.width()), qMax(actualSize.height(), preferredSize.height()));
|
||||
resize(size);
|
||||
|
||||
move(
|
||||
parentWidget()->pos().x() + parentWidget()->width() / 2 - size.width() / 2,
|
||||
parentWidget()->pos().y() + parentWidget()->height() / 2 - size.height() / 2
|
||||
);
|
||||
if (parentWidget())
|
||||
{
|
||||
move(
|
||||
parentWidget()->pos().x() + parentWidget()->width() / 2 - size.width() / 2,
|
||||
parentWidget()->pos().y() + parentWidget()->height() / 2 - size.height() / 2
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void QtWindow::addLogo()
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentPaths.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentPreferences.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSimple.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSourceList.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSummary.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardWindow.h"
|
||||
#include "settings/CxxProjectSettings.h"
|
||||
@@ -278,36 +277,6 @@ QtProjectWizzardWindow* QtProjectWizzard::createWindowWithSummary(
|
||||
return window;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
QtProjectWizzardWindow* QtProjectWizzard::createPopupWithContent()
|
||||
{
|
||||
QtProjectWizzardWindow* window = new QtProjectWizzardWindow(parentWidget());
|
||||
|
||||
window->setShowAsPopup(true);
|
||||
window->setContent(new T(m_settings, window));
|
||||
window->setup();
|
||||
|
||||
window->move(window->pos() + QPoint(50, 50));
|
||||
window->show();
|
||||
|
||||
connect(window, SIGNAL(next()), this, SLOT(popupClosed()));
|
||||
|
||||
if (m_popup)
|
||||
{
|
||||
m_popup->hide();
|
||||
}
|
||||
|
||||
m_popup = std::shared_ptr<QtProjectWizzardWindow>(window);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
void QtProjectWizzard::connectShowFiles(QtProjectWizzardContent* content)
|
||||
{
|
||||
connect(content, SIGNAL(filesButtonClicked(QtProjectWizzardContent*)),
|
||||
this, SLOT(showFiles(QtProjectWizzardContent*)));
|
||||
}
|
||||
|
||||
void QtProjectWizzard::cancelWizzard()
|
||||
{
|
||||
m_windowStack.clearWindows();
|
||||
@@ -330,16 +299,6 @@ void QtProjectWizzard::windowStackChanged()
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzard::popupClosed()
|
||||
{
|
||||
QWidget* window = m_windowStack.getTopWindow();
|
||||
|
||||
if (window)
|
||||
{
|
||||
window->raise();
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzard::selectedProjectType(LanguageType languageType, QtProjectWizzardContentSelect::ProjectType type)
|
||||
{
|
||||
switch (type)
|
||||
@@ -410,11 +369,7 @@ void QtProjectWizzard::sourcePaths()
|
||||
QtProjectWizzardWindow* window = createWindowWithSummary(
|
||||
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
|
||||
{
|
||||
|
||||
QtProjectWizzardContent* source = new QtProjectWizzardContentPathsSource(m_settings, window);
|
||||
summary->addContent(source, false, false);
|
||||
connectShowFiles(source);
|
||||
|
||||
summary->addContent(new QtProjectWizzardContentPathsSource(m_settings, window), false, false);
|
||||
summary->addContent(new QtProjectWizzardContentExtensions(m_settings, window), false, false);
|
||||
|
||||
window->setup();
|
||||
@@ -481,12 +436,8 @@ void QtProjectWizzard::headerPathsCDB()
|
||||
QtProjectWizzardWindow* window = createWindowWithSummary(
|
||||
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
|
||||
{
|
||||
QtProjectWizzardContent* source = new QtProjectWizzardContentCDBSource(m_settings, window);
|
||||
summary->addContent(source, false, false);
|
||||
connectShowFiles(source);
|
||||
|
||||
QtProjectWizzardContent* header = new QtProjectWizzardContentPathsCDBHeader(m_settings, window);
|
||||
summary->addContent(header, false, false);
|
||||
summary->addContent(new QtProjectWizzardContentCDBSource(m_settings, window), false, false);
|
||||
summary->addContent(new QtProjectWizzardContentPathsCDBHeader(m_settings, window), false, false);
|
||||
|
||||
window->setup();
|
||||
|
||||
@@ -518,11 +469,7 @@ void QtProjectWizzard::sourcePathsJava()
|
||||
QtProjectWizzardWindow* window = createWindowWithSummary(
|
||||
[this](QtProjectWizzardWindow* window, QtProjectWizzardContentSummary* summary)
|
||||
{
|
||||
|
||||
QtProjectWizzardContent* source = new QtProjectWizzardContentPathsSourceJava(m_settings, window);
|
||||
summary->addContent(source, false, false);
|
||||
connectShowFiles(source);
|
||||
|
||||
summary->addContent(new QtProjectWizzardContentPathsSourceJava(m_settings, window), false, false);
|
||||
summary->addContent(new QtProjectWizzardContentPathsClassJava(m_settings, window), false, false);
|
||||
|
||||
window->setup();
|
||||
@@ -532,19 +479,6 @@ void QtProjectWizzard::sourcePathsJava()
|
||||
connect(window, SIGNAL(next()), this, SLOT(showSummaryJava()));
|
||||
}
|
||||
|
||||
void QtProjectWizzard::showFiles(QtProjectWizzardContent* content)
|
||||
{
|
||||
QWidget* widget = m_windowStack.getTopWindow();
|
||||
if (widget)
|
||||
{
|
||||
QtProjectWizzardWindow* win = dynamic_cast<QtProjectWizzardWindow*>(widget);
|
||||
win->content()->save();
|
||||
}
|
||||
|
||||
QtProjectWizzardWindow* window = createPopupWithContent<QtProjectWizzardContentSourceList>();
|
||||
dynamic_cast<QtProjectWizzardContentSourceList*>(window->content())->showFilesFromContent(content);
|
||||
}
|
||||
|
||||
void QtProjectWizzard::showSummary()
|
||||
{
|
||||
QtProjectWizzardWindow* window = createWindowWithSummary(
|
||||
@@ -567,10 +501,7 @@ void QtProjectWizzard::showSummary()
|
||||
this, SLOT(refreshProjectFromSolution(const std::string&, const std::string&)));
|
||||
}
|
||||
|
||||
QtProjectWizzardContentPathsSource* source = new QtProjectWizzardContentPathsSource(m_settings, window);
|
||||
summary->addContent(source, false, true);
|
||||
connectShowFiles(source);
|
||||
|
||||
summary->addContent(new QtProjectWizzardContentPathsSource(m_settings, window), false, true);
|
||||
summary->addContent(new QtProjectWizzardContentPathsHeaderSearch(m_settings, window), false, true);
|
||||
summary->addContent(new QtProjectWizzardContentSimple(m_settings, window), false, false);
|
||||
summary->addContent(new QtProjectWizzardContentPathsHeaderSearchGlobal(m_settings, window), false, false);
|
||||
@@ -620,10 +551,7 @@ void QtProjectWizzard::showSummaryJava()
|
||||
|
||||
summary->addContent(new QtProjectWizzardContentData(m_settings, window), false, false);
|
||||
|
||||
QtProjectWizzardContentPathsSourceJava* source = new QtProjectWizzardContentPathsSourceJava(m_settings, window);
|
||||
summary->addContent(source, false, true);
|
||||
connectShowFiles(source);
|
||||
|
||||
summary->addContent(new QtProjectWizzardContentPathsSourceJava(m_settings, window), false, true);
|
||||
summary->addContent(new QtProjectWizzardContentPathsClassJava(m_settings, window), false, true);
|
||||
|
||||
summary->addContent(new QtProjectWizzardContentExtensions(m_settings, window), true, false);
|
||||
|
||||
@@ -46,13 +46,10 @@ private:
|
||||
|
||||
QtProjectWizzardWindow* createWindowWithSummary(
|
||||
std::function<void(QtProjectWizzardWindow*, QtProjectWizzardContentSummary*)> func);
|
||||
template<typename T>
|
||||
QtProjectWizzardWindow* createPopupWithContent();
|
||||
|
||||
void connectShowFiles(QtProjectWizzardContent* content);
|
||||
|
||||
QtWindowStack m_windowStack;
|
||||
std::shared_ptr<QtProjectWizzardWindow> m_popup;
|
||||
|
||||
std::shared_ptr<ProjectSettings> m_settings;
|
||||
ApplicationSettings m_appSettings;
|
||||
@@ -66,7 +63,6 @@ private slots:
|
||||
void finishWizzard();
|
||||
|
||||
void windowStackChanged();
|
||||
void popupClosed();
|
||||
|
||||
void selectedProjectType(LanguageType languageType, QtProjectWizzardContentSelect::ProjectType type);
|
||||
|
||||
@@ -84,8 +80,6 @@ private slots:
|
||||
|
||||
void sourcePathsJava();
|
||||
|
||||
void showFiles(QtProjectWizzardContent* content);
|
||||
|
||||
void showSummary();
|
||||
void showSummaryJava();
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "qt/window/QtTextEditDialog.h"
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
QtHelpButton::QtHelpButton(const QString& helpText, QWidget* parent)
|
||||
: QPushButton("", parent)
|
||||
, m_helpText(helpText)
|
||||
@@ -31,10 +34,6 @@ QtProjectWizzardContent::QtProjectWizzardContent(std::shared_ptr<ProjectSettings
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContent::populateWindow(QWidget* widget)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContent::populateWindow(QGridLayout* layout, int& row)
|
||||
{
|
||||
}
|
||||
@@ -70,9 +69,9 @@ QSize QtProjectWizzardContent::preferredWindowSize() const
|
||||
return QSize(750, 620);
|
||||
}
|
||||
|
||||
QStringList QtProjectWizzardContent::getFileNames() const
|
||||
std::vector<std::string> QtProjectWizzardContent::getFileNames() const
|
||||
{
|
||||
return QStringList();
|
||||
return std::vector<std::string>();
|
||||
}
|
||||
|
||||
QString QtProjectWizzardContent::getFileNamesTitle() const
|
||||
@@ -126,12 +125,37 @@ QPushButton* QtProjectWizzardContent::addFilesButton(QString name, QGridLayout*
|
||||
QPushButton* button = new QPushButton(name);
|
||||
button->setObjectName("windowButton");
|
||||
layout->addWidget(button, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignRight | Qt::AlignTop);
|
||||
connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked()));
|
||||
connect(button, SIGNAL(clicked()), this, SLOT(filesButtonClicked()));
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
void QtProjectWizzardContent::buttonClicked()
|
||||
void QtProjectWizzardContent::filesButtonClicked()
|
||||
{
|
||||
emit filesButtonClicked(this);
|
||||
if (!m_filesDialog)
|
||||
{
|
||||
std::vector<std::string> fileNames = getFileNames();
|
||||
|
||||
m_filesDialog = std::make_shared<QtTextEditDialog>(
|
||||
getFileNamesTitle(), QString::number(fileNames.size()) + " " + getFileNamesDescription());
|
||||
m_filesDialog->setup();
|
||||
|
||||
m_filesDialog->setText(utility::join(fileNames, "\n"));
|
||||
m_filesDialog->setCloseVisible(false);
|
||||
m_filesDialog->setReadOnly(true);
|
||||
|
||||
connect(m_filesDialog.get(), SIGNAL(finished()), this, SLOT(closedFilesDialog()));
|
||||
connect(m_filesDialog.get(), SIGNAL(canceled()), this, SLOT(closedFilesDialog()));
|
||||
}
|
||||
|
||||
m_filesDialog->showWindow();
|
||||
m_filesDialog->raise();
|
||||
}
|
||||
|
||||
void QtProjectWizzardContent::closedFilesDialog()
|
||||
{
|
||||
m_filesDialog->hide();
|
||||
m_filesDialog.reset();
|
||||
|
||||
window()->raise();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardWindow.h"
|
||||
#include "settings/ProjectSettings.h"
|
||||
|
||||
class QtTextEditDialog;
|
||||
|
||||
class QtHelpButton
|
||||
: public QPushButton
|
||||
@@ -35,7 +36,6 @@ class QtProjectWizzardContent
|
||||
public:
|
||||
QtProjectWizzardContent(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
|
||||
|
||||
virtual void populateWindow(QWidget* widget);
|
||||
virtual void populateWindow(QGridLayout* layout, int& row);
|
||||
virtual void populateForm(QGridLayout* layout, int& row);
|
||||
virtual void windowReady();
|
||||
@@ -48,13 +48,10 @@ public:
|
||||
|
||||
virtual QSize preferredWindowSize() const;
|
||||
|
||||
virtual QStringList getFileNames() const;
|
||||
virtual std::vector<std::string> getFileNames() const;
|
||||
virtual QString getFileNamesTitle() const;
|
||||
virtual QString getFileNamesDescription() const;
|
||||
|
||||
signals:
|
||||
void filesButtonClicked(QtProjectWizzardContent* content);
|
||||
|
||||
protected:
|
||||
QLabel* createFormLabel(QString name) const;
|
||||
QLabel* createFormTitle(QString name) const;
|
||||
@@ -67,7 +64,11 @@ protected:
|
||||
QtProjectWizzardWindow* m_window;
|
||||
|
||||
private slots:
|
||||
void buttonClicked();
|
||||
void filesButtonClicked();
|
||||
void closedFilesDialog();
|
||||
|
||||
private:
|
||||
std::shared_ptr<QtTextEditDialog> m_filesDialog;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_H
|
||||
|
||||
@@ -65,7 +65,7 @@ void QtProjectWizzardContentCDBSource::load()
|
||||
path = path.relativeTo(projectPath);
|
||||
}
|
||||
|
||||
m_fileNames << QString::fromStdString(path.str());
|
||||
m_fileNames.push_back(path.str());
|
||||
}
|
||||
}
|
||||
if (m_text)
|
||||
@@ -74,7 +74,7 @@ void QtProjectWizzardContentCDBSource::load()
|
||||
}
|
||||
}
|
||||
|
||||
QStringList QtProjectWizzardContentCDBSource::getFileNames() const
|
||||
std::vector<std::string> QtProjectWizzardContentCDBSource::getFileNames() const
|
||||
{
|
||||
return m_fileNames;
|
||||
}
|
||||
@@ -86,5 +86,5 @@ QString QtProjectWizzardContentCDBSource::getFileNamesTitle() const
|
||||
|
||||
QString QtProjectWizzardContentCDBSource::getFileNamesDescription() const
|
||||
{
|
||||
return "source files will be indexed.";
|
||||
return " source files will be indexed.";
|
||||
}
|
||||
|
||||
@@ -16,13 +16,13 @@ public:
|
||||
|
||||
virtual void load() override;
|
||||
|
||||
virtual QStringList getFileNames() const override;
|
||||
virtual std::vector<std::string> getFileNames() const override;
|
||||
virtual QString getFileNamesTitle() const override;
|
||||
virtual QString getFileNamesDescription() const override;
|
||||
|
||||
private:
|
||||
QLabel* m_text;
|
||||
QStringList m_fileNames;
|
||||
std::vector<std::string> m_fileNames;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_CDB_SOURCE_H
|
||||
|
||||
@@ -27,7 +27,7 @@ void QtProjectWizzardContentExtensions::populateWindow(QGridLayout* layout, int&
|
||||
layout->addWidget(text, row + 1, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
|
||||
layout->setRowStretch(row + 1, 1);
|
||||
|
||||
m_sourceList = new QtDirectoryListBox(this);
|
||||
m_sourceList = new QtDirectoryListBox(this, title->text());
|
||||
layout->addWidget(m_sourceList, row, QtProjectWizzardWindow::BACK_COL, 2, 1, Qt::AlignTop);
|
||||
row += 2;
|
||||
}
|
||||
@@ -40,7 +40,7 @@ void QtProjectWizzardContentExtensions::populateForm(QGridLayout* layout, int& r
|
||||
|
||||
addHelpButton("Define extensions for source files including the dot e.g. .cpp", layout, row);
|
||||
|
||||
m_sourceList = new QtDirectoryListBox(this, true);
|
||||
m_sourceList = new QtDirectoryListBox(this, sourceLabel->text(), true);
|
||||
layout->addWidget(m_sourceList, row, QtProjectWizzardWindow::BACK_COL);
|
||||
row++;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ void QtProjectWizzardContentFlags::populateForm(QGridLayout* layout, int& row)
|
||||
|
||||
addHelpButton("Define compiler flags used during indexing including the dash e.g. -v", layout, row);
|
||||
|
||||
m_list = new QtDirectoryListBox(this, true);
|
||||
m_list = new QtDirectoryListBox(this, label->text(), true);
|
||||
layout->addWidget(m_list, row, QtProjectWizzardWindow::BACK_COL);
|
||||
row++;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ void QtProjectWizzardContentPaths::populateWindow(QGridLayout* layout, int& row)
|
||||
layout->addWidget(text, row + 1, QtProjectWizzardWindow::FRONT_COL, Qt::AlignTop);
|
||||
layout->setRowStretch(row + 1, 1);
|
||||
|
||||
m_list = new QtDirectoryListBox(this);
|
||||
m_list = new QtDirectoryListBox(this, m_titleString);
|
||||
layout->addWidget(m_list, row, QtProjectWizzardWindow::BACK_COL, 2, 1, Qt::AlignTop);
|
||||
|
||||
row += 2;
|
||||
@@ -66,7 +66,7 @@ void QtProjectWizzardContentPaths::populateForm(QGridLayout* layout, int& row)
|
||||
addHelpButton(m_helpString, layout, row);
|
||||
}
|
||||
|
||||
m_list = new QtDirectoryListBox(this);
|
||||
m_list = new QtDirectoryListBox(this, m_titleString);
|
||||
layout->addWidget(m_list, row, QtProjectWizzardWindow::BACK_COL);
|
||||
row++;
|
||||
|
||||
@@ -223,7 +223,7 @@ void QtProjectWizzardContentPathsSource::save()
|
||||
m_settings->setSourcePaths(m_list->getList());
|
||||
}
|
||||
|
||||
QStringList QtProjectWizzardContentPathsSource::getFileNames() const
|
||||
std::vector<std::string> QtProjectWizzardContentPathsSource::getFileNames() const
|
||||
{
|
||||
std::vector<FilePath> sourcePaths = m_settings->getAbsoluteSourcePaths();
|
||||
std::vector<FilePath> excludePaths = m_settings->getAbsoluteExcludePaths();
|
||||
@@ -232,7 +232,7 @@ QStringList QtProjectWizzardContentPathsSource::getFileNames() const
|
||||
std::vector<FileInfo> fileInfos = FileSystem::getFileInfosFromPaths(sourcePaths, extensions);
|
||||
FilePath projectPath = m_settings->getProjectFileLocation();
|
||||
|
||||
QStringList list;
|
||||
std::vector<std::string> list;
|
||||
for (const FileInfo& info : fileInfos)
|
||||
{
|
||||
FilePath path = info.path;
|
||||
@@ -257,7 +257,7 @@ QStringList QtProjectWizzardContentPathsSource::getFileNames() const
|
||||
path = path.relativeTo(projectPath);
|
||||
}
|
||||
|
||||
list << QString::fromStdString(path.str());
|
||||
list.push_back(path.str());
|
||||
}
|
||||
|
||||
return list;
|
||||
@@ -270,7 +270,7 @@ QString QtProjectWizzardContentPathsSource::getFileNamesTitle() const
|
||||
|
||||
QString QtProjectWizzardContentPathsSource::getFileNamesDescription() const
|
||||
{
|
||||
return "files will be indexed.";
|
||||
return " files will be indexed.";
|
||||
}
|
||||
|
||||
QtProjectWizzardContentPathsSourceJava::QtProjectWizzardContentPathsSourceJava(
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
virtual void load() override;
|
||||
virtual void save() override;
|
||||
|
||||
virtual QStringList getFileNames() const override;
|
||||
virtual std::vector<std::string> getFileNames() const override;
|
||||
virtual QString getFileNamesTitle() const override;
|
||||
virtual QString getFileNamesDescription() const override;
|
||||
};
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSourceList.h"
|
||||
|
||||
#include <QListView>
|
||||
#include <QStringListModel>
|
||||
|
||||
QtProjectWizzardContentSourceList::QtProjectWizzardContentSourceList(
|
||||
std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window
|
||||
)
|
||||
: QtProjectWizzardContent(settings, window)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSourceList::populateWindow(QWidget* widget)
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout(widget);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
m_text = new QLabel("0 files will be indexed.");
|
||||
m_text->setWordWrap(true);
|
||||
layout->addWidget(m_text);
|
||||
|
||||
m_list = new QListView(this);
|
||||
m_list->setObjectName("files");
|
||||
m_list->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
m_list->setSelectionMode(QAbstractItemView::NoSelection);
|
||||
m_list->setAttribute(Qt::WA_MacShowFocusRect, 0);
|
||||
layout->addWidget(m_list);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSourceList::windowReady()
|
||||
{
|
||||
}
|
||||
|
||||
QSize QtProjectWizzardContentSourceList::preferredWindowSize() const
|
||||
{
|
||||
return QSize(500, 500);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSourceList::showFilesFromContent(QtProjectWizzardContent* content)
|
||||
{
|
||||
QStringList list = content->getFileNames();
|
||||
m_text->setText(QString::number(list.size()) + " " + content->getFileNamesDescription());
|
||||
m_window->updateTitle(content->getFileNamesTitle());
|
||||
|
||||
QStringListModel* model = new QStringListModel(this);
|
||||
model->setStringList(list);
|
||||
m_list->setModel(model);
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
#ifndef QT_PROJECT_WIZZARD_CONTENT_SOURCE_LIST_H
|
||||
#define QT_PROJECT_WIZZARD_CONTENT_SOURCE_LIST_H
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
|
||||
class QLabel;
|
||||
class QListView;
|
||||
|
||||
class QtProjectWizzardContentSourceList
|
||||
: public QtProjectWizzardContent
|
||||
{
|
||||
public:
|
||||
QtProjectWizzardContentSourceList(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
|
||||
|
||||
// QtSettingsWindow implementation
|
||||
virtual void populateWindow(QWidget* widget) override;
|
||||
virtual void windowReady() override;
|
||||
|
||||
virtual QSize preferredWindowSize() const override;
|
||||
|
||||
void showFilesFromContent(QtProjectWizzardContent* content);
|
||||
|
||||
private:
|
||||
QLabel* m_text;
|
||||
QListView* m_list;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_SOURCE_LIST_H
|
||||
@@ -43,31 +43,24 @@ void QtProjectWizzardWindow::populateWindow(QWidget* widget)
|
||||
int row = 0;
|
||||
m_content->populateWindow(layout, row);
|
||||
|
||||
if (layout->columnCount() < 2)
|
||||
QFrame* separator = new QFrame();
|
||||
separator->setFrameShape(QFrame::VLine);
|
||||
|
||||
QPalette palette = separator->palette();
|
||||
palette.setColor(QPalette::WindowText, Qt::lightGray);
|
||||
separator->setPalette(palette);
|
||||
|
||||
layout->addWidget(separator, 0, LINE_COL, -1, 1);
|
||||
|
||||
layout->setColumnStretch(HELP_COL, 0);
|
||||
layout->setColumnStretch(LINE_COL, 0);
|
||||
|
||||
if (isScrollAble())
|
||||
{
|
||||
m_content->populateWindow(widget);
|
||||
layout->setColumnMinimumWidth(BACK_COL + 1, 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
QFrame* separator = new QFrame();
|
||||
separator->setFrameShape(QFrame::VLine);
|
||||
|
||||
QPalette palette = separator->palette();
|
||||
palette.setColor(QPalette::WindowText, Qt::lightGray);
|
||||
separator->setPalette(palette);
|
||||
|
||||
layout->addWidget(separator, 0, LINE_COL, -1, 1);
|
||||
|
||||
layout->setColumnStretch(HELP_COL, 0);
|
||||
layout->setColumnStretch(LINE_COL, 0);
|
||||
|
||||
if (isScrollAble())
|
||||
{
|
||||
layout->setColumnMinimumWidth(BACK_COL + 1, 10);
|
||||
}
|
||||
|
||||
widget->setLayout(layout);
|
||||
}
|
||||
widget->setLayout(layout);
|
||||
}
|
||||
|
||||
void QtProjectWizzardWindow::windowReady()
|
||||
|
||||
Reference in New Issue
Block a user