|
|
|
@@ -1,12 +1,30 @@
|
|
|
|
|
#include "qt/window/project_wizzard/QtProjectWizzardContentPreferences.h"
|
|
|
|
|
|
|
|
|
|
#include "settings/ApplicationSettings.h"
|
|
|
|
|
#include "utility/messaging/type/MessageSwitchColorScheme.h"
|
|
|
|
|
#include "utility/file/FileSystem.h"
|
|
|
|
|
#include "utility/ResourcePaths.h"
|
|
|
|
|
|
|
|
|
|
QtProjectWizzardContentPreferences::QtProjectWizzardContentPreferences(
|
|
|
|
|
ProjectSettings* settings, QtProjectWizzardWindow* window
|
|
|
|
|
)
|
|
|
|
|
: QtProjectWizzardContent(settings, window)
|
|
|
|
|
, m_oldColorSchemeIndex(-1)
|
|
|
|
|
{
|
|
|
|
|
std::vector<std::string> colorSchemePaths =
|
|
|
|
|
FileSystem::getFileNamesFromDirectory(ResourcePaths::getColorSchemesPath(), std::vector<std::string>(1, ".xml"));
|
|
|
|
|
for (const std::string& colorScheme : colorSchemePaths)
|
|
|
|
|
{
|
|
|
|
|
m_colorSchemePaths.push_back(FilePath(colorScheme));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QtProjectWizzardContentPreferences::~QtProjectWizzardContentPreferences()
|
|
|
|
|
{
|
|
|
|
|
if (m_oldColorSchemeIndex != -1)
|
|
|
|
|
{
|
|
|
|
|
colorSchemeChanged(m_oldColorSchemeIndex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QtProjectWizzardContentPreferences::populateWindow(QGridLayout* layout)
|
|
|
|
@@ -24,41 +42,49 @@ void QtProjectWizzardContentPreferences::populateForm(QGridLayout* layout, int&
|
|
|
|
|
row++;
|
|
|
|
|
|
|
|
|
|
// font face
|
|
|
|
|
QLabel* fontLabel = createFormLabel("Font face");
|
|
|
|
|
m_fontFace = new QLineEdit();
|
|
|
|
|
m_fontFace->setObjectName("name");
|
|
|
|
|
m_fontFace->setAttribute(Qt::WA_MacShowFocusRect, 0);
|
|
|
|
|
|
|
|
|
|
layout->addWidget(fontLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
|
|
|
|
layout->addWidget(createFormLabel("Font face"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
|
|
|
|
layout->addWidget(m_fontFace, row, QtProjectWizzardWindow::BACK_COL);
|
|
|
|
|
row++;
|
|
|
|
|
|
|
|
|
|
// font size
|
|
|
|
|
QLabel* sizeLabel = createFormLabel("Font size");
|
|
|
|
|
|
|
|
|
|
m_fontSize = new QComboBox();
|
|
|
|
|
for (int i = appSettings->getFontSizeMin(); i <= appSettings->getFontSizeMax(); i++)
|
|
|
|
|
{
|
|
|
|
|
m_fontSize->insertItem(i, QString::number(i));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
layout->addWidget(sizeLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
|
|
|
|
layout->addWidget(createFormLabel("Font size"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
|
|
|
|
layout->addWidget(m_fontSize, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
|
|
|
|
row++;
|
|
|
|
|
|
|
|
|
|
// tab width
|
|
|
|
|
QLabel* tabLabel = createFormLabel("Tab width");
|
|
|
|
|
|
|
|
|
|
m_tabWidth = new QComboBox();
|
|
|
|
|
for (int i = 1; i < 17; i++)
|
|
|
|
|
{
|
|
|
|
|
m_tabWidth->insertItem(i, QString::number(i));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
layout->addWidget(tabLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
|
|
|
|
layout->addWidget(createFormLabel("Tab width"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
|
|
|
|
layout->addWidget(m_tabWidth, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
|
|
|
|
row++;
|
|
|
|
|
|
|
|
|
|
// color scheme
|
|
|
|
|
m_colorSchemes = new QComboBox();
|
|
|
|
|
for (size_t i = 0; i < m_colorSchemePaths.size(); i++)
|
|
|
|
|
{
|
|
|
|
|
m_colorSchemes->insertItem(i, m_colorSchemePaths[i].withoutExtension().fileName().c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
connect(m_colorSchemes, SIGNAL(activated(int)), this, SLOT(colorSchemeChanged(int)));
|
|
|
|
|
|
|
|
|
|
layout->addWidget(createFormLabel("Color scheme"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
|
|
|
|
layout->addWidget(m_colorSchemes, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
|
|
|
|
row++;
|
|
|
|
|
|
|
|
|
|
layout->setRowMinimumHeight(row++, 20);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -67,15 +93,13 @@ void QtProjectWizzardContentPreferences::populateForm(QGridLayout* layout, int&
|
|
|
|
|
row++;
|
|
|
|
|
|
|
|
|
|
// indexer threads
|
|
|
|
|
QLabel* threadsLabel = createFormLabel("Indexer threads");
|
|
|
|
|
|
|
|
|
|
m_threads = new QComboBox();
|
|
|
|
|
for (int i = 1; i <= 24; i++)
|
|
|
|
|
{
|
|
|
|
|
m_threads->insertItem(i, QString::number(i));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
layout->addWidget(threadsLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
|
|
|
|
layout->addWidget(createFormLabel("Indexer threads"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
|
|
|
|
layout->addWidget(m_threads, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
|
|
|
|
|
|
|
|
|
addHelpButton(
|
|
|
|
@@ -86,11 +110,9 @@ void QtProjectWizzardContentPreferences::populateForm(QGridLayout* layout, int&
|
|
|
|
|
row++;
|
|
|
|
|
|
|
|
|
|
// ignore non-fatal errors in non-indexed files
|
|
|
|
|
QLabel* errorsLabel = createFormLabel("Non-Fatal Errors");
|
|
|
|
|
|
|
|
|
|
m_fatalErrors = new QCheckBox("Display non-fatal errors in unindexed files", this);
|
|
|
|
|
|
|
|
|
|
layout->addWidget(errorsLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
|
|
|
|
layout->addWidget(createFormLabel("Non-Fatal Errors"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
|
|
|
|
layout->addWidget(m_fatalErrors, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft);
|
|
|
|
|
|
|
|
|
|
addHelpButton(
|
|
|
|
@@ -110,6 +132,17 @@ void QtProjectWizzardContentPreferences::load()
|
|
|
|
|
m_fontSize->setCurrentIndex(appSettings->getFontSize() - appSettings->getFontSizeMin());
|
|
|
|
|
m_tabWidth->setCurrentIndex(appSettings->getCodeTabWidth() - 1);
|
|
|
|
|
|
|
|
|
|
FilePath colorSchemePath = appSettings->getColorSchemePath();
|
|
|
|
|
for (size_t i = 0; i < m_colorSchemePaths.size(); i++)
|
|
|
|
|
{
|
|
|
|
|
if (colorSchemePath == m_colorSchemePaths[i])
|
|
|
|
|
{
|
|
|
|
|
m_colorSchemes->setCurrentIndex(i);
|
|
|
|
|
m_oldColorSchemeIndex = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_threads->setCurrentIndex(appSettings->getIndexerThreadCount() - 1);
|
|
|
|
|
m_fatalErrors->setChecked(appSettings->getShowExternalNonFatalErrors());
|
|
|
|
|
}
|
|
|
|
@@ -123,6 +156,9 @@ void QtProjectWizzardContentPreferences::save()
|
|
|
|
|
appSettings->setFontSize(m_fontSize->currentIndex() + appSettings->getFontSizeMin());
|
|
|
|
|
appSettings->setCodeTabWidth(m_tabWidth->currentIndex() + 1);
|
|
|
|
|
|
|
|
|
|
appSettings->setColorSchemePath(m_colorSchemePaths[m_colorSchemes->currentIndex()]);
|
|
|
|
|
m_oldColorSchemeIndex = -1;
|
|
|
|
|
|
|
|
|
|
appSettings->setIndexerThreadCount(m_threads->currentIndex() + 1);
|
|
|
|
|
appSettings->setShowExternalNonFatalErrors(m_fatalErrors->isChecked());
|
|
|
|
|
}
|
|
|
|
@@ -131,3 +167,8 @@ bool QtProjectWizzardContentPreferences::check()
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QtProjectWizzardContentPreferences::colorSchemeChanged(int index)
|
|
|
|
|
{
|
|
|
|
|
MessageSwitchColorScheme(m_colorSchemePaths[index]).dispatch();
|
|
|
|
|
}
|
|
|
|
|