Thanks to visit codestin.com
Credit goes to github.com

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
6 changes: 3 additions & 3 deletions include/SettingsManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct SettingsData
bool isAutoSave;
bool isWrapText;
bool isBeta;
bool isTabsBeingUsed;
bool isTabsReplaced;
bool shouldSaveTests;
bool isCompanionActive;
bool isWindowMaximized;
Expand Down Expand Up @@ -158,8 +158,8 @@ class SettingManager
bool isBeta();
void setBeta(bool value);

bool isTabs();
void setTabs(bool value);
bool isTabsReplaced();
void setTabsReplaced(bool value);

bool isSaveTests();
void setSaveTests(bool value);
Expand Down
12 changes: 6 additions & 6 deletions src/SettingsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ bool SettingManager::isBeta()
return mSettings->value("beta", "false").toBool();
}

bool SettingManager::isTabs()
bool SettingManager::isTabsReplaced()
{
return mSettings->value("use_tabs", "false").toBool();
return mSettings->value("replace_tabs", "false").toBool();
}

bool SettingManager::isSaveTests()
Expand Down Expand Up @@ -206,12 +206,12 @@ void SettingManager::setBeta(bool value)
mSettings->setValue("beta", QString::fromStdString("false"));
}

void SettingManager::setTabs(bool value)
void SettingManager::setTabsReplaced(bool value)
{
if (value)
mSettings->setValue("use_tabs", QString::fromStdString("true"));
mSettings->setValue("replace_tabs", QString::fromStdString("true"));
else
mSettings->setValue("use_tabs", QString::fromStdString("false"));
mSettings->setValue("replace_tabs", QString::fromStdString("false"));
}

void SettingManager::setSaveTests(bool value)
Expand Down Expand Up @@ -459,7 +459,7 @@ SettingsData SettingManager::toData()
data.isAutoSave = isAutoSave();
data.isWrapText = isWrapText();
data.isBeta = isBeta();
data.isTabsBeingUsed = isTabs();
data.isTabsReplaced = isTabsReplaced();
data.shouldSaveTests = isSaveTests();
data.isCompanionActive = isCompetitiveCompanionActive();
data.isWindowMaximized = isMaximizedWindow();
Expand Down
7 changes: 3 additions & 4 deletions src/mainwindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -297,13 +297,12 @@ void MainWindow::setCFToolsUI()
cftools->submit(companionData.url, language);
}
});

}
if (!Network::CFTools::check())
{
submitToCodeforces->setEnabled(false);
log.error("CFTools",
"You will not be able to submit code to codeforces because CFTools is not installed or is not on SYSTEM PATH");
log.error("CFTools", "You will not be able to submit code to codeforces because CFTools is not installed or is "
"not on SYSTEM PATH");
}
}

Expand Down Expand Up @@ -383,7 +382,7 @@ void MainWindow::setSettingsData(Settings::SettingsData data, bool shouldPerform
this->data = data;
formatter->updateCommand(data.formatCommand);

editor->setTabReplace(data.isTabsBeingUsed);
editor->setTabReplace(data.isTabsReplaced);
editor->setTabReplaceSize(data.tabStop);
editor->setAutoIndentation(data.isAutoIndent);
editor->setAutoParentheses(data.isAutoParenthesis);
Expand Down
8 changes: 4 additions & 4 deletions src/preferencewindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void PreferenceWindow::applySettingsToui()
ui->wrap->setChecked(manager->isWrapText());
ui->indent->setChecked(manager->isAutoIndent());
ui->parentheses->setChecked(manager->isAutoParenthesis());
ui->tabs->setChecked(manager->isTabs());
ui->replace_tabs->setChecked(manager->isTabsReplaced());

ui->defaultLang->setCurrentText(manager->getDefaultLang());
ui->format_cmd->setText(manager->getFormatCommand());
Expand Down Expand Up @@ -132,7 +132,7 @@ void PreferenceWindow::extractSettingsFromUi()
manager->setWrapText(ui->wrap->isChecked());
manager->setAutoIndent(ui->indent->isChecked());
manager->setAutoParenthesis(ui->parentheses->isChecked());
manager->setTabs(ui->tabs->isChecked());
manager->setTabsReplaced(ui->replace_tabs->isChecked());

manager->setDefaultLanguage(ui->defaultLang->currentText());
manager->setFormatCommand(ui->format_cmd->text());
Expand Down Expand Up @@ -204,7 +204,7 @@ void PreferenceWindow::resetSettings()
manager->setAutoSave(false);
manager->setWrapText(false);
manager->setBeta(false);
manager->setTabs(false);
manager->setTabsReplaced(false);
manager->setSaveTests(false);
manager->setCompetitiveCompanionActive(false);
manager->setMaximizedWindow(false);
Expand Down Expand Up @@ -422,7 +422,7 @@ void PreferenceWindow::applySettingsToEditor()
{
auto data = manager->toData();

editor->setTabReplace(data.isTabsBeingUsed);
editor->setTabReplace(data.isTabsReplaced);
editor->setTabReplaceSize(data.tabStop);
editor->setAutoIndentation(data.isAutoIndent);
editor->setAutoParentheses(data.isAutoParenthesis);
Expand Down
2 changes: 1 addition & 1 deletion ui/preferencewindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="tabs">
<widget class="QCheckBox" name="replace_tabs">
<property name="text">
<string>Always replace tabs with spaces</string>
</property>
Expand Down