forked from qt-creator/qt-creator
ProjectExplorer: Update CompileOutputSettingsPage
Change-Id: Ib5bfe959025a57f9ae5b5563385fb1663c313ede Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -57,20 +57,15 @@
|
|||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
namespace ProjectExplorer {
|
||||||
using namespace ProjectExplorer::Internal;
|
namespace Internal {
|
||||||
|
|
||||||
namespace {
|
|
||||||
const char SETTINGS_KEY[] = "ProjectExplorer/CompileOutput/Zoom";
|
const char SETTINGS_KEY[] = "ProjectExplorer/CompileOutput/Zoom";
|
||||||
const char C_COMPILE_OUTPUT[] = "ProjectExplorer.CompileOutput";
|
const char C_COMPILE_OUTPUT[] = "ProjectExplorer.CompileOutput";
|
||||||
const char POP_UP_KEY[] = "ProjectExplorer/Settings/ShowCompilerOutput";
|
const char POP_UP_KEY[] = "ProjectExplorer/Settings/ShowCompilerOutput";
|
||||||
const char WRAP_OUTPUT_KEY[] = "ProjectExplorer/Settings/WrapBuildOutput";
|
const char WRAP_OUTPUT_KEY[] = "ProjectExplorer/Settings/WrapBuildOutput";
|
||||||
const char MAX_LINES_KEY[] = "ProjectExplorer/Settings/MaxBuildOutputLines";
|
const char MAX_LINES_KEY[] = "ProjectExplorer/Settings/MaxBuildOutputLines";
|
||||||
const char OPTIONS_PAGE_ID[] = "C.ProjectExplorer.CompileOutputOptions";
|
const char OPTIONS_PAGE_ID[] = "C.ProjectExplorer.CompileOutputOptions";
|
||||||
}
|
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class CompileOutputTextEdit : public Core::OutputWindow
|
class CompileOutputTextEdit : public Core::OutputWindow
|
||||||
{
|
{
|
||||||
@@ -128,9 +123,6 @@ private:
|
|||||||
Qt::MouseButton m_mousePressButton = Qt::NoButton;
|
Qt::MouseButton m_mousePressButton = Qt::NoButton;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace ProjectExplorer
|
|
||||||
|
|
||||||
CompileOutputWindow::CompileOutputWindow(QAction *cancelBuildAction) :
|
CompileOutputWindow::CompileOutputWindow(QAction *cancelBuildAction) :
|
||||||
m_cancelBuildButton(new QToolButton),
|
m_cancelBuildButton(new QToolButton),
|
||||||
m_settingsButton(new QToolButton),
|
m_settingsButton(new QToolButton),
|
||||||
@@ -374,11 +366,11 @@ void CompileOutputWindow::storeSettings() const
|
|||||||
s->setValue(MAX_LINES_KEY, m_settings.maxCharCount / 100);
|
s->setValue(MAX_LINES_KEY, m_settings.maxCharCount / 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
class CompileOutputSettingsPage::SettingsWidget : public QWidget
|
class CompileOutputSettingsWidget : public Core::IOptionsPageWidget
|
||||||
{
|
{
|
||||||
Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::Internal::CompileOutputSettingsPage)
|
Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::Internal::CompileOutputSettingsPage)
|
||||||
public:
|
public:
|
||||||
SettingsWidget()
|
CompileOutputSettingsWidget()
|
||||||
{
|
{
|
||||||
const CompileOutputSettings &settings = BuildManager::compileOutputSettings();
|
const CompileOutputSettings &settings = BuildManager::compileOutputSettings();
|
||||||
m_wrapOutputCheckBox.setText(tr("Word-wrap output"));
|
m_wrapOutputCheckBox.setText(tr("Word-wrap output"));
|
||||||
@@ -401,15 +393,17 @@ public:
|
|||||||
layout->addStretch(1);
|
layout->addStretch(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
CompileOutputSettings settings() const
|
void apply() final
|
||||||
{
|
{
|
||||||
CompileOutputSettings s;
|
CompileOutputSettings s;
|
||||||
s.wrapOutput = m_wrapOutputCheckBox.isChecked();
|
s.wrapOutput = m_wrapOutputCheckBox.isChecked();
|
||||||
s.popUp = m_popUpCheckBox.isChecked();
|
s.popUp = m_popUpCheckBox.isChecked();
|
||||||
s.maxCharCount = m_maxCharsBox.value();
|
s.maxCharCount = m_maxCharsBox.value();
|
||||||
return s;
|
BuildManager::setCompileOutputSettings(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void finish() final {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QCheckBox m_wrapOutputCheckBox;
|
QCheckBox m_wrapOutputCheckBox;
|
||||||
QCheckBox m_popUpCheckBox;
|
QCheckBox m_popUpCheckBox;
|
||||||
@@ -421,24 +415,10 @@ CompileOutputSettingsPage::CompileOutputSettingsPage()
|
|||||||
setId(OPTIONS_PAGE_ID);
|
setId(OPTIONS_PAGE_ID);
|
||||||
setDisplayName(tr("Compile Output"));
|
setDisplayName(tr("Compile Output"));
|
||||||
setCategory(Constants::BUILD_AND_RUN_SETTINGS_CATEGORY);
|
setCategory(Constants::BUILD_AND_RUN_SETTINGS_CATEGORY);
|
||||||
|
setWidgetCreator([] { return new CompileOutputSettingsWidget; });
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *CompileOutputSettingsPage::widget()
|
} // Internal
|
||||||
{
|
} // ProjectExplorer
|
||||||
if (!m_widget)
|
|
||||||
m_widget = new SettingsWidget;
|
|
||||||
return m_widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CompileOutputSettingsPage::apply()
|
|
||||||
{
|
|
||||||
if (m_widget)
|
|
||||||
BuildManager::setCompileOutputSettings(m_widget->settings());
|
|
||||||
}
|
|
||||||
|
|
||||||
void CompileOutputSettingsPage::finish()
|
|
||||||
{
|
|
||||||
delete m_widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "compileoutputwindow.moc"
|
#include "compileoutputwindow.moc"
|
||||||
|
@@ -32,7 +32,6 @@
|
|||||||
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
#include <QPointer>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QPlainTextEdit;
|
class QPlainTextEdit;
|
||||||
@@ -109,14 +108,6 @@ class CompileOutputSettingsPage : public Core::IOptionsPage
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
CompileOutputSettingsPage();
|
CompileOutputSettingsPage();
|
||||||
|
|
||||||
private:
|
|
||||||
QWidget *widget() override;
|
|
||||||
void apply() override;
|
|
||||||
void finish() override;
|
|
||||||
|
|
||||||
class SettingsWidget;
|
|
||||||
QPointer<SettingsWidget> m_widget;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
Reference in New Issue
Block a user