Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 30 additions & 25 deletions src/plugins/ProjectManager/ProjectManagerPlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,17 +223,10 @@ ProjectManagerPlugin::ProjectManagerPlugin() {
sVersion = "0.0.1";
autoEnabled = true;
alwaysEnabled = true;
auto monospacedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);

config.pluginName = tr("Project manager");
config.description = tr("Add support for building using CMake/Cargo/Go");
config.configItems.push_back(
qmdiConfigItem::Builder()
.setDisplayName(tr("Black console"))
.setDescription(tr("Should the console background be black, or default"))
.setKey(Config::BlackConsoleKey)
.setType(qmdiConfigItem::Bool)
.setDefaultValue(false)
.build());
config.configItems.push_back(
qmdiConfigItem::Builder()
.setDisplayName(tr("Save before running tasks (build, config etc)"))
Expand All @@ -242,24 +235,39 @@ ProjectManagerPlugin::ProjectManagerPlugin() {
.setType(qmdiConfigItem::Bool)
.setDefaultValue(true)
.build());
config.configItems.push_back(
qmdiConfigItem::Builder()
.setDisplayName(tr("Black console"))
.setDescription(tr("Should the console background be black, or default"))
.setKey(Config::BlackConsoleKey)
.setType(qmdiConfigItem::Bool)
.setDefaultValue(false)
.build());
config.configItems.push_back(qmdiConfigItem::Builder()
.setDisplayName(tr("Extra paths"))
.setDescription(tr("Add new paths for compilers/tools"))
.setKey(Config::ExtraPathKey)
.setType(qmdiConfigItem::StringList)
.setDefaultValue(QStringList())
.setDisplayName(tr("Console font"))
.setKey(Config::ConsoleFontKey)
.setType(qmdiConfigItem::Font)
.setDefaultValue(monospacedFont)
.setValue(monospacedFont)
.build());

/*
config.configItems.push_back(qmdiConfigItem::Builder()
.setDisplayName(tr("Extra paths"))
.setDescription(tr("Add new paths for compilers/tools"))
.setKey(Config::ExtraPathKey)
.setType(qmdiConfigItem::StringList)
.setDefaultValue(QStringList())
.build());
*/
// project GUI
config.configItems.push_back(qmdiConfigItem::Builder()
// .setDisplayName(tr("Open directories"))
.setKey(Config::OpenDirsKey)
.setType(qmdiConfigItem::StringList)
.setDefaultValue(QStringList())
.setUserEditable(false)
.build());
config.configItems.push_back(qmdiConfigItem::Builder()
// .setDisplayName(tr("Currently open directory"))
.setKey(Config::SelectedDirectoryKey)
.setType(qmdiConfigItem::String)
.setDefaultValue(QString{})
Expand Down Expand Up @@ -395,16 +403,9 @@ void ProjectManagerPlugin::on_client_merged(qmdiHost *host) {
outputPanel->commandOuput->setLineWrapMode(QTextEdit::NoWrap);
outputPanel->commandOuput->clear();

QTimer::singleShot(0, [this]() {
// why in a timer? because at this step, if we set the palette, the widget
// will get inserted "soon" and its palette will change anyway.
if (getConfig().getBlackConsole()) {
auto p = outputPanel->commandOuput->palette();
p.setColor(QPalette::Base, Qt::black);
p.setColor(QPalette::Text, QColor(192, 192, 192));
outputPanel->commandOuput->setPalette(p);
}
});
// why in a timer? because at this step, if we set the palette, the widget
// will get inserted "soon" and its palette will change anyway.
QTimer::singleShot(0, this, &ProjectManagerPlugin::configurationHasBeenModified);

connect(outputPanel->commandOuput, &QTextBrowser::anchorClicked, outputPanel->commandOuput,
[this](const QUrl &link) {
Expand Down Expand Up @@ -691,6 +692,10 @@ void ProjectManagerPlugin::configurationHasBeenModified() {
p.setColor(QPalette::Text, QColor(192, 192, 192));
}
outputPanel->commandOuput->setPalette(p);

auto newFont = QFont();
newFont.fromString(getConfig().getConsoleFont());
outputPanel->commandOuput->setFont(newFont);
}

void ProjectManagerPlugin::loadConfig(QSettings &settings) {
Expand Down
1 change: 1 addition & 0 deletions src/plugins/ProjectManager/ProjectManagerPlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class ProjectManagerPlugin : public IPlugin {
struct Config {
CONFIG_DEFINE(SaveBeforeTask, bool);
CONFIG_DEFINE(BlackConsole, bool);
CONFIG_DEFINE(ConsoleFont, QString)
CONFIG_DEFINE(ExtraPath, QStringList);
CONFIG_DEFINE(OpenDirs, QStringList);
CONFIG_DEFINE(SelectedDirectory, QString);
Expand Down