Skip to content

Commit

Permalink
Fix compilation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesc M committed Apr 28, 2024
1 parent 973614a commit 9ccdda3
Showing 1 changed file with 3 additions and 44 deletions.
47 changes: 3 additions & 44 deletions src/big_widgets/ConfigWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
#include <QStandardPaths>
#include <QTimer>

#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
# include <qtermwidget_interface.h>
#endif

using namespace QLogger;

namespace
Expand Down Expand Up @@ -396,7 +392,7 @@ void ConfigWidget::saveConfig()
emit reloadDiffFont();
emit commitTitleMaxLenghtChanged();

if (mShowResetMsg || qobject_cast<QComboBox*>(sender()) == ui->cbLanguage)
if (mShowResetMsg || qobject_cast<QComboBox *>(sender()) == ui->cbLanguage)
{
QMessageBox::information(this, tr("Reset needed!"),
tr("You need to restart GitQlient to see the changes in the styles applied."));
Expand Down Expand Up @@ -615,44 +611,7 @@ void ConfigWidget::loadPlugins(QMap<QString, QObject *> plugins)
mPluginWidgets.append(labelName);
mPluginWidgets.append(labelVersion);

if (labelName->text().contains("qtermwidget", Qt::CaseInsensitive))
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
GitQlientSettings settings(mGit->getGitDir());
const auto isTerminalEnabled = settings.localValue("TerminalEnabled", false).toBool();
const auto terminal = qobject_cast<QTermWidgetInterface *>(iter.value());
const auto availableSchemes = terminal->getAvailableColorSchemes();

ui->lTerminalColorScheme->setVisible(isTerminalEnabled);
ui->cbTerminalColorScheme->setVisible(isTerminalEnabled);
ui->cbTerminalColorScheme->addItems(availableSchemes);

if (const auto lastScheme = QSettings().value("TerminalScheme", QString()).toString();
!lastScheme.isEmpty() && availableSchemes.contains(lastScheme))
{
ui->cbTerminalColorScheme->setCurrentText(lastScheme);
terminal->setColorScheme(lastScheme);
}

connect(ui->cbTerminalColorScheme, &QComboBox::currentTextChanged, this, [terminal](const QString &newScheme) {
dynamic_cast<QTermWidgetInterface *>(terminal)->setColorScheme(newScheme);

QSettings().setValue("TerminalScheme", newScheme);
});

chEnabled->setChecked(GitQlientSettings(mGit->getGitDir()).localValue("TerminalEnabled", false).toBool());
connect(chEnabled, &QCheckBox::stateChanged, this, [this, chEnabled](int) {
const auto checked = chEnabled->isChecked();
GitQlientSettings(mGit->getGitDir()).setLocalValue("TerminalEnabled", checked);

ui->lTerminalColorScheme->setVisible(checked);
ui->cbTerminalColorScheme->setVisible(checked);

emit terminalEnabled(checked);
});
#endif
}
else if (labelName->text().contains("jenkinsplugin", Qt::CaseInsensitive))
if (labelName->text().contains("jenkinsplugin", Qt::CaseInsensitive))
{
chEnabled->setChecked(GitQlientSettings(mGit->getGitDir()).localValue("BuildSystemEnabled", false).toBool());

Expand Down Expand Up @@ -697,7 +656,7 @@ void ConfigWidget::fillLanguageBox() const
const auto lang = name.mid(name.indexOf('_') + 1);
QLocale tmpLocale(lang);
const auto languageItem = QString::fromUtf8("%1 (%2)").arg(QLocale::languageToString(tmpLocale.language()),
QLocale::countryToString(tmpLocale.country()));
QLocale::countryToString(tmpLocale.country()));

ui->cbLanguage->addItem(languageItem, name);

Expand Down

0 comments on commit 9ccdda3

Please sign in to comment.