Commit 90a09728 authored by Victor Yacovlev's avatar Victor Yacovlev

EDITOR: Show trailing spaces is an option

parent b30a833f
......@@ -346,7 +346,7 @@ p, li { white-space: pre-wrap; }
<name>CoreGUI::MainWindow</name>
<message>
<location filename="../../../src/plugins/coregui/mainwindow.ui" line="14"/>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="261"/>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="310"/>
<source>Kumir</source>
<translation>Кумир</translation>
</message>
......@@ -523,7 +523,7 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<location filename="../../../src/plugins/coregui/mainwindow.ui" line="238"/>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="813"/>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="867"/>
<source>Restore previous session</source>
<translation>Восстановить предыдущий сеанс</translation>
</message>
......@@ -533,62 +533,62 @@ p, li { white-space: pre-wrap; }
<translation>Для этой вкладки нет действий</translation>
</message>
<message>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="184"/>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="233"/>
<source>No errors</source>
<translation>Ошибок нет</translation>
</message>
<message>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="188"/>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="237"/>
<source>Errors: %1</source>
<translation>Ошибок: %1</translation>
</message>
<message>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="391"/>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="442"/>
<source>Kumir programs (*.kum)</source>
<translation>Программы Кумир (*.kum)</translation>
</message>
<message>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="394"/>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="445"/>
<source>Pascal programs (*.pas *.pp</source>
<translation>Программы Паскаль (*.pas *.pp)</translation>
</message>
<message>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="397"/>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="448"/>
<source>Text files (*.txt)</source>
<translation>Текстовые файлы (*.txt)</translation>
</message>
<message>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="399"/>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="450"/>
<source>All files (*)</source>
<translation>Все файлы (*)</translation>
</message>
<message>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="400"/>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="451"/>
<source>Save file</source>
<translation>Сохранить файл</translation>
</message>
<message>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="430"/>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="481"/>
<source>Can&apos;t save file</source>
<translation>Не могу сохранить файл</translation>
</message>
<message>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="477"/>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="531"/>
<source>Close editor</source>
<translation>Закрытие текста</translation>
</message>
<message>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="478"/>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="532"/>
<source>Save current text?</source>
<translation>Сохранить текущий текст?</translation>
</message>
<message>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="814"/>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="868"/>
<source>Are you sure to restore previous session? All unsaved changes will be lost.</source>
<translation>Вы уверены, что хотите восстановить предыдущий сеанс? Все открытые файлы будут закрыты без сохранения.</translation>
</message>
<message>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="936"/>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="990"/>
<source>The following files have changes:
%1
Save them?</source>
......@@ -597,7 +597,7 @@ Save them?</source>
Сохранить их?</translation>
</message>
<message>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="937"/>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="991"/>
<source>Close Kumir</source>
<translation>Выход из Кумир</translation>
</message>
......@@ -622,7 +622,7 @@ Save them?</source>
<translation type="obsolete">Закрыть без сохранения</translation>
</message>
<message>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="836"/>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="890"/>
<source>Start</source>
<translation>Начало</translation>
</message>
......@@ -637,12 +637,12 @@ Using Qt version %2</source>
Использует Qt версии %2</translation>
</message>
<message>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="1044"/>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="1098"/>
<source>Load file...</source>
<translation>Загрузить файл...</translation>
</message>
<message>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="1046"/>
<location filename="../../../src/plugins/coregui/mainwindow.cpp" line="1100"/>
<source>Kumir programs (*.kum);;Pascal programs (*.pas *.pp);;Web pages (*.html *.htm);;Text files (*.txt);;All files (*)</source>
<translation>Программы Кумир (*.kum);;Программы Pascal (*.pas *.pp);; Web-страницы (*.html *.htm);;Текстовые файлы (*.txt);;Все файлы (*)</translation>
</message>
......@@ -684,23 +684,23 @@ Using Qt version %2</source>
<translation>Редактирование</translation>
</message>
<message>
<location filename="../../../src/plugins/coregui/plugin.cpp" line="277"/>
<location filename="../../../src/plugins/coregui/plugin.cpp" line="278"/>
<source>Observe</source>
<translation>Анализ</translation>
</message>
<message>
<location filename="../../../src/plugins/coregui/plugin.cpp" line="282"/>
<location filename="../../../src/plugins/coregui/plugin.cpp" line="284"/>
<source>Running</source>
<translation>Выполнение</translation>
</message>
<message>
<location filename="../../../src/plugins/coregui/plugin.cpp" line="286"/>
<location filename="../../../src/plugins/coregui/plugin.cpp" line="289"/>
<location filename="../../../src/plugins/coregui/plugin.cpp" line="293"/>
<source>Pause</source>
<translation>Пауза</translation>
</message>
<message>
<location filename="../../../src/plugins/coregui/plugin.cpp" line="339"/>
<location filename="../../../src/plugins/coregui/plugin.cpp" line="344"/>
<source>Start</source>
<translation>Начало</translation>
</message>
......
......@@ -24,22 +24,22 @@
<context>
<name>Editor::EditorPrivate</name>
<message>
<location filename="../../../src/plugins/editor/editor.cpp" line="151"/>
<location filename="../../../src/plugins/editor/editor.cpp" line="153"/>
<source>Keys: %1</source>
<translation>Клав: %1</translation>
</message>
<message>
<location filename="../../../src/plugins/editor/editor.cpp" line="176"/>
<location filename="../../../src/plugins/editor/editor.cpp" line="178"/>
<source>Row: %1, Col: %2</source>
<translation>Стр: %1, Поз: %2</translation>
</message>
<message>
<location filename="../../../src/plugins/editor/editor.cpp" line="560"/>
<location filename="../../../src/plugins/editor/editor.cpp" line="566"/>
<source>Edit</source>
<translation>Редактирование</translation>
</message>
<message>
<location filename="../../../src/plugins/editor/editor.cpp" line="577"/>
<location filename="../../../src/plugins/editor/editor.cpp" line="583"/>
<source>Insert</source>
<translation>Вставка</translation>
</message>
......@@ -242,7 +242,12 @@
<translation>Прижимать текст программы к левому краю</translation>
</message>
<message>
<location filename="../../../src/plugins/editor/settingspage.cpp" line="259"/>
<location filename="../../../src/plugins/editor/settingspage.ui" line="561"/>
<source>Show trailing spaces</source>
<translation>Отображать пробелы в конце строк</translation>
</message>
<message>
<location filename="../../../src/plugins/editor/settingspage.cpp" line="265"/>
<source>Choose color</source>
<translation>Выберете цвет</translation>
</message>
......@@ -324,47 +329,47 @@
<context>
<name>QObject</name>
<message>
<location filename="../../../src/plugins/editor/editor.cpp" line="495"/>
<location filename="../../../src/plugins/editor/editor.cpp" line="501"/>
<source>Select all text in editor</source>
<translation>Выбрать весь текст</translation>
</message>
<message>
<location filename="../../../src/plugins/editor/editor.cpp" line="501"/>
<location filename="../../../src/plugins/editor/editor.cpp" line="507"/>
<source>Copy selection to clipboard</source>
<translation>Скопировать</translation>
</message>
<message>
<location filename="../../../src/plugins/editor/editor.cpp" line="507"/>
<location filename="../../../src/plugins/editor/editor.cpp" line="513"/>
<source>Cut selection to clipboard</source>
<translation>Вырезать</translation>
</message>
<message>
<location filename="../../../src/plugins/editor/editor.cpp" line="513"/>
<location filename="../../../src/plugins/editor/editor.cpp" line="519"/>
<source>Paste from clipboard</source>
<translation>Вставить</translation>
</message>
<message>
<location filename="../../../src/plugins/editor/editor.cpp" line="519"/>
<location filename="../../../src/plugins/editor/editor.cpp" line="525"/>
<source>Delete line under cursor</source>
<translation>Удалить строку</translation>
</message>
<message>
<location filename="../../../src/plugins/editor/editor.cpp" line="525"/>
<location filename="../../../src/plugins/editor/editor.cpp" line="531"/>
<source>Delete text from cursor to end of line</source>
<translation>Удалить текст до конца строки</translation>
</message>
<message>
<location filename="../../../src/plugins/editor/editor.cpp" line="532"/>
<location filename="../../../src/plugins/editor/editor.cpp" line="538"/>
<source>Undo last action</source>
<translation>Отменить последнее действие</translation>
</message>
<message>
<location filename="../../../src/plugins/editor/editor.cpp" line="540"/>
<location filename="../../../src/plugins/editor/editor.cpp" line="546"/>
<source>Redo last undoed action</source>
<translation>Повторить отмененное действие</translation>
</message>
<message>
<location filename="../../../src/plugins/editor/editor.cpp" line="548"/>
<location filename="../../../src/plugins/editor/editor.cpp" line="554"/>
<source>(Un)Comment lines</source>
<translation>(Раз)комменировать строки</translation>
</message>
......
......@@ -1721,7 +1721,10 @@ void EditorPlane::paintText(QPainter *p, const QRect &rect)
p->drawPolyline(pp);
}
}
if (trailingSpaces) {
if (trailingSpaces && m_settings->value(
SettingsPage::KeyShowTrailingSpaces, SettingsPage::DefaultShowTrailingSpaces
).toBool())
{
p->setPen(QColor("lightgray"));
// Paint trailing spaces
QString dots;
......
......@@ -51,6 +51,9 @@ QString SettingsPage::DefaultPlayMacroShortcut = "Esc";
QString SettingsPage::KeyForcePressTextToLeft = "Other/PressTextToLeft";
bool SettingsPage::DefaultForcePressTextToLeft = false;
QString SettingsPage::KeyShowTrailingSpaces = "Other/ShowTrailingSpaces";
bool SettingsPage::DefaultShowTrailingSpaces = false;
QString SettingsPage::defaultFontFamily()
{
QString result = "Courier";
......@@ -130,12 +133,14 @@ void SettingsPage::accept()
m_settings->setValue(KeyPlayMacroShortcut, play);
m_settings->setValue(KeyForcePressTextToLeft, ui->pressTextLeft->isChecked());
m_settings->setValue(KeyShowTrailingSpaces, ui->showTrailingSpaces->isChecked());
m_settings->setValue("Settings/FontCollapsed", ui->groupFont->isCollapsed());
m_settings->setValue("Settings/KeyboardCollapsed", ui->groupKeyboard->isCollapsed());
m_settings->setValue("Settings/SyntaxCollapsed", ui->groupSyntax->isCollapsed());
m_settings->setValue("Settings/OtherCollapsed", ui->groupOther->isCollapsed());
emit settingsChanged();
}
......@@ -202,6 +207,7 @@ void SettingsPage::init()
ui->macroPlayKey->setCurrentIndex(index);
ui->pressTextLeft->setChecked(m_settings->value(KeyForcePressTextToLeft, DefaultForcePressTextToLeft).toBool());
ui->showTrailingSpaces->setChecked(m_settings->value(KeyShowTrailingSpaces, DefaultShowTrailingSpaces).toBool());
updateFontPreview();
}
......
......@@ -69,6 +69,9 @@ public:
static QString DefaultPlayMacroShortcut;
static quint32 DefaultTempSwitchLayoutButton;
static QString KeyShowTrailingSpaces;
static bool DefaultShowTrailingSpaces;
public slots:
void accept();
void init();
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>372</width>
<height>699</height>
<width>390</width>
<height>724</height>
</rect>
</property>
<property name="windowTitle">
......@@ -555,6 +555,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showTrailingSpaces">
<property name="text">
<string>Show trailing spaces</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment