work save: translation updates
This commit is contained in:
parent
35255a85fa
commit
64698287fc
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -24,11 +24,19 @@ void AutolinkManager::load()
|
|||
QString filename=dir.filePath(AUTOLINK_CONFIG);
|
||||
QFile file(filename);
|
||||
if (!file.exists()) {
|
||||
QFile::copy(":/config/autolink.json",filename);
|
||||
if (!file.exists()) {
|
||||
QFile preFile(":/config/autolink.json");
|
||||
if (!preFile.open(QFile::ReadOnly)) {
|
||||
throw FileError(QObject::tr("Can't open file '%1' for read.")
|
||||
.arg(":/config/autolink.json"));
|
||||
}
|
||||
QByteArray content=preFile.readAll();
|
||||
if (!file.open(QFile::WriteOnly|QFile::Truncate)) {
|
||||
throw FileError(QObject::tr("Can't open file '%1' for write.")
|
||||
.arg(filename));
|
||||
}
|
||||
file.write(content);
|
||||
file.close();
|
||||
preFile.close();
|
||||
}
|
||||
if (file.open(QFile::ReadOnly)) {
|
||||
QByteArray content = file.readAll();
|
||||
|
|
|
@ -344,8 +344,8 @@ QString Compiler::getLibraryArguments(FileType fileType)
|
|||
|
||||
//Add auto links
|
||||
// is file and auto link enabled
|
||||
if (fileType == FileType::CSource ||
|
||||
fileType == FileType::CppSource){
|
||||
if (pSettings->editor().enableAutolink() && (fileType == FileType::CSource ||
|
||||
fileType == FileType::CppSource)){
|
||||
Editor* editor = pMainWindow->editorList()->getEditor();
|
||||
if (editor) {
|
||||
PCppParser parser = editor->parser();
|
||||
|
|
|
@ -2634,7 +2634,11 @@ void Editor::applySettings()
|
|||
setTabWidth(pSettings->editor().tabWidth());
|
||||
setInsertCaret(pSettings->editor().caretForInsert());
|
||||
setOverwriteCaret(pSettings->editor().caretForOverwrite());
|
||||
setCaretColor(pSettings->editor().caretColor());
|
||||
if (pSettings->editor().caretUseTextColor()) {
|
||||
setCaretColor(palette().color(QPalette::Text));
|
||||
} else {
|
||||
setCaretColor(pSettings->editor().caretColor());
|
||||
}
|
||||
|
||||
QFont f=QFont(pSettings->editor().fontName(),pSettings->editor().fontSize());
|
||||
f.setStyleStrategy(QFont::PreferAntialias);
|
||||
|
@ -2663,6 +2667,12 @@ void Editor::applySettings()
|
|||
gutter().setLineNumberStart(1);
|
||||
//font color
|
||||
|
||||
if (pSettings->editor().showRightEdgeLine()) {
|
||||
setRightEdge(pSettings->editor().rightEdgeWidth());
|
||||
setRightEdgeColor(pSettings->editor().rightEdgeLineColor());
|
||||
} else {
|
||||
setRightEdge(0);
|
||||
}
|
||||
}
|
||||
|
||||
void Editor::applyColorScheme(const QString& schemeName)
|
||||
|
|
|
@ -84,7 +84,14 @@ int main(int argc, char *argv[])
|
|||
pColorManager = new ColorManager();
|
||||
pIconsManager = new IconsManager();
|
||||
pAutolinkManager = new AutolinkManager();
|
||||
pAutolinkManager->load();
|
||||
try {
|
||||
pAutolinkManager->load();
|
||||
} catch (FileError e) {
|
||||
QMessageBox::critical(nullptr,
|
||||
QObject::tr("Can't load autolink settings"),
|
||||
e.reason(),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
|
||||
MainWindow mainWindow;
|
||||
pMainWindow = &mainWindow;
|
||||
|
|
|
@ -2,6 +2,30 @@
|
|||
"header": "ege.h",
|
||||
"links": "-lgraphics -luuid -lmsimg32 -lgdi32 -limm32 -lole32 -loleaut32 -lwinmm -lgdiplus"
|
||||
},
|
||||
{
|
||||
"header": "GL/gl.h",
|
||||
"links": "-lopengl32"
|
||||
},
|
||||
{
|
||||
"header": "GL/glu.h",
|
||||
"links": "-lglu32 -lopengl32"
|
||||
},
|
||||
{
|
||||
"header": "GL/freeglut.h",
|
||||
"links": "-lfreeglut -lwinmm"
|
||||
},
|
||||
{
|
||||
"header": "GL/glut.h",
|
||||
"links": "-lfreeglut -lwinmm"
|
||||
},
|
||||
{
|
||||
"header": "GL/glew.h",
|
||||
"links": "-lglew32 -lopengl32"
|
||||
},
|
||||
{
|
||||
"header": "GLFW/glfw3.h",
|
||||
"links": "-lglfw3 -lgdi32"
|
||||
},
|
||||
{
|
||||
"header": "turtle.h",
|
||||
"links": "-lturtle"
|
||||
|
|
|
@ -430,6 +430,46 @@ void Settings::Editor::setEnableAutolink(bool newEnableAutolink)
|
|||
mEnableAutolink = newEnableAutolink;
|
||||
}
|
||||
|
||||
const QColor &Settings::Editor::rightEdgeLineColor() const
|
||||
{
|
||||
return mRightEdgeLineColor;
|
||||
}
|
||||
|
||||
void Settings::Editor::setRightEdgeLineColor(const QColor &newRightMarginLineColor)
|
||||
{
|
||||
mRightEdgeLineColor = newRightMarginLineColor;
|
||||
}
|
||||
|
||||
bool Settings::Editor::caretUseTextColor() const
|
||||
{
|
||||
return mCaretUseTextColor;
|
||||
}
|
||||
|
||||
void Settings::Editor::setCaretUseTextColor(bool newUseIdentifierColor)
|
||||
{
|
||||
mCaretUseTextColor = newUseIdentifierColor;
|
||||
}
|
||||
|
||||
int Settings::Editor::rightEdgeWidth() const
|
||||
{
|
||||
return mRightEdgeWidth;
|
||||
}
|
||||
|
||||
void Settings::Editor::setRightEdgeWidth(int newRightMarginWidth)
|
||||
{
|
||||
mRightEdgeWidth = newRightMarginWidth;
|
||||
}
|
||||
|
||||
bool Settings::Editor::showRightEdgeLine() const
|
||||
{
|
||||
return mShowRightEdgeLine;
|
||||
}
|
||||
|
||||
void Settings::Editor::setShowRightEdgeLine(bool newShowRightMarginLine)
|
||||
{
|
||||
mShowRightEdgeLine = newShowRightMarginLine;
|
||||
}
|
||||
|
||||
AutoSaveTarget Settings::Editor::autoSaveTarget() const
|
||||
{
|
||||
return mAutoSaveTarget;
|
||||
|
@ -836,6 +876,7 @@ void Settings::Editor::doSave()
|
|||
saveValue("keep_caret_x",mKeepCaretX);
|
||||
saveValue("caret_for_insert",static_cast<int>(mCaretForInsert));
|
||||
saveValue("caret_for_overwrite",static_cast<int>(mCaretForOverwrite));
|
||||
saveValue("caret_use_text_color",mCaretUseTextColor);
|
||||
saveValue("caret_color",mCaretColor);
|
||||
|
||||
//scroll
|
||||
|
@ -845,6 +886,11 @@ void Settings::Editor::doSave()
|
|||
saveValue("scroll_by_one_less", mScrollByOneLess);
|
||||
saveValue("half_page_scroll", mHalfPageScroll);
|
||||
|
||||
//right edge
|
||||
saveValue("show_right_edge_line",mShowRightEdgeLine);
|
||||
saveValue("right_edge_width",mRightEdgeWidth);
|
||||
saveValue("right_edge_line_color",mRightEdgeLineColor);
|
||||
|
||||
//Font
|
||||
//font
|
||||
saveValue("font_name",mFontName);
|
||||
|
@ -927,6 +973,7 @@ void Settings::Editor::doLoad()
|
|||
mKeepCaretX = boolValue("keep_caret_x",true);
|
||||
mCaretForInsert = static_cast<SynEditCaretType>( intValue("caret_for_insert",static_cast<int>(SynEditCaretType::ctVerticalLine)));
|
||||
mCaretForOverwrite = static_cast<SynEditCaretType>( intValue("caret_for_overwrite",static_cast<int>(SynEditCaretType::ctBlock)));
|
||||
mCaretUseTextColor = boolValue("caret_use_text_color",true);
|
||||
mCaretColor = colorValue("caret_color",QColorConstants::Svg::yellow);
|
||||
|
||||
//scroll
|
||||
|
@ -936,6 +983,11 @@ void Settings::Editor::doLoad()
|
|||
mScrollByOneLess = boolValue("scroll_by_one_less", false);
|
||||
mHalfPageScroll = boolValue("half_page_scroll",false);
|
||||
|
||||
//right edge
|
||||
mShowRightEdgeLine = boolValue("show_right_edge_line",false);
|
||||
mRightEdgeWidth = intValue("right_edge_width",80);
|
||||
mRightEdgeLineColor = colorValue("right_edge_line_color",QColorConstants::Svg::yellow);
|
||||
|
||||
//Font
|
||||
//font
|
||||
mFontName = stringValue("font_name","consolas");
|
||||
|
|
|
@ -288,6 +288,18 @@ public:
|
|||
bool enableAutolink() const;
|
||||
void setEnableAutolink(bool newEnableAutolink);
|
||||
|
||||
bool showRightEdgeLine() const;
|
||||
void setShowRightEdgeLine(bool newShowRightMarginLine);
|
||||
|
||||
int rightEdgeWidth() const;
|
||||
void setRightEdgeWidth(int newRightMarginWidth);
|
||||
|
||||
const QColor &rightEdgeLineColor() const;
|
||||
void setRightEdgeLineColor(const QColor &newRightMarginLineColor);
|
||||
|
||||
bool caretUseTextColor() const;
|
||||
void setCaretUseTextColor(bool newUseIdentifierColor);
|
||||
|
||||
private:
|
||||
//General
|
||||
// indents
|
||||
|
@ -303,7 +315,9 @@ public:
|
|||
bool mKeepCaretX;
|
||||
SynEditCaretType mCaretForInsert;
|
||||
SynEditCaretType mCaretForOverwrite;
|
||||
bool mCaretUseTextColor;
|
||||
QColor mCaretColor;
|
||||
|
||||
//scroll
|
||||
bool mAutoHideScrollbar;
|
||||
bool mScrollPastEof;
|
||||
|
@ -311,6 +325,11 @@ public:
|
|||
bool mScrollByOneLess;
|
||||
bool mHalfPageScroll;
|
||||
|
||||
//right margin
|
||||
bool mShowRightEdgeLine;
|
||||
int mRightEdgeWidth;
|
||||
QColor mRightEdgeLineColor;
|
||||
|
||||
//Font
|
||||
//font
|
||||
QString mFontName;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
CompilerAutolinkWidget::CompilerAutolinkWidget(const QString& name, const QString& group, QWidget* parent) :
|
||||
SettingsWidget(name,group,parent),
|
||||
mModel(this),
|
||||
ui(new Ui::CompilerAutolinkWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
@ -29,19 +30,27 @@ void CompilerAutolinkWidget::doSave()
|
|||
pSettings->editor().setEnableAutolink(ui->grpAutolink->isChecked());
|
||||
pSettings->editor().save();
|
||||
pAutolinkManager->clear();
|
||||
auto iter = mModel.links().cbegin();
|
||||
while (iter!=mModel.links().cend()) {
|
||||
PAutolink link = iter.value();
|
||||
pAutolinkManager->setLink(
|
||||
link->header,
|
||||
link->linkOption
|
||||
);
|
||||
iter++;
|
||||
for (const PAutolink& link:mModel.links()) {
|
||||
if (!link->header.isEmpty()) {
|
||||
pAutolinkManager->setLink(
|
||||
link->header,
|
||||
link->linkOption
|
||||
);
|
||||
}
|
||||
}
|
||||
try{
|
||||
pAutolinkManager->save();
|
||||
} catch (FileError e) {
|
||||
QMessageBox::critical(this,
|
||||
tr("Save failed."),
|
||||
e.reason(),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
pAutolinkManager->save();
|
||||
}
|
||||
|
||||
AutolinkModel::AutolinkModel(QObject *parent):QAbstractTableModel(parent)
|
||||
AutolinkModel::AutolinkModel(CompilerAutolinkWidget* widget,QObject *parent):
|
||||
QAbstractTableModel(parent),
|
||||
mWidget(widget)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -75,10 +84,9 @@ QVariant AutolinkModel::data(const QModelIndex &index, int role) const
|
|||
return QVariant();
|
||||
if (role == Qt::DisplayRole || role == Qt::EditRole) {
|
||||
int row = index.row();
|
||||
QList<PAutolink> links = mLinks.values();
|
||||
if (row<0 || row>=links.count())
|
||||
if (row<0 || row>=mLinks.count())
|
||||
return QVariant();
|
||||
PAutolink link = links[row];
|
||||
PAutolink link = mLinks[row];
|
||||
switch(index.column()) {
|
||||
case 0:
|
||||
return link->header;
|
||||
|
@ -95,33 +103,34 @@ bool AutolinkModel::setData(const QModelIndex &index, const QVariant &value, int
|
|||
return false;
|
||||
if (role == Qt::EditRole) {
|
||||
int row = index.row();
|
||||
QList<PAutolink> links = mLinks.values();
|
||||
if (row<0 || row>=links.count())
|
||||
if (row<0 || row>=mLinks.count())
|
||||
return false;
|
||||
PAutolink link = links[row];
|
||||
QString s=value.toString();
|
||||
PAutolink link = mLinks[row];
|
||||
QString s=value.toString().trimmed();
|
||||
if (index.column() == 0) {
|
||||
if (s.isEmpty())
|
||||
return false;
|
||||
PAutolink oldLink = mLinks.value(s,PAutolink());
|
||||
if (oldLink) {
|
||||
if (findLink(s)>=0) {
|
||||
QMessageBox::warning(pMainWindow,
|
||||
tr("Header exists"),
|
||||
tr("Header already exists."),
|
||||
QMessageBox::Yes);
|
||||
QMessageBox::Ok);
|
||||
return false;
|
||||
}
|
||||
mLinks.remove(link->header);
|
||||
//we must create a new link, becasue mList may share link pointer with the autolink manger
|
||||
PAutolink newLink = std::make_shared<Autolink>();
|
||||
newLink->header = s;
|
||||
newLink->linkOption = link->linkOption;
|
||||
mLinks.insert(newLink->header,newLink);
|
||||
mLinks[row]=newLink;
|
||||
mWidget->setSettingsChanged();
|
||||
return true;
|
||||
} else if (index.column() == 1) {
|
||||
//we must create a new link, becasue mList may share link pointer with the autolink manger
|
||||
PAutolink newLink = std::make_shared<Autolink>();
|
||||
newLink->header = link->header;
|
||||
newLink->linkOption = s;
|
||||
mLinks.insert(newLink->header,newLink);
|
||||
mLinks[row]=newLink;
|
||||
mWidget->setSettingsChanged();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -137,12 +146,63 @@ Qt::ItemFlags AutolinkModel::flags(const QModelIndex &index) const
|
|||
return flags;
|
||||
}
|
||||
|
||||
const QMap<QString, PAutolink> &AutolinkModel::links() const
|
||||
bool AutolinkModel::insertRows(int row, int count, const QModelIndex &parent)
|
||||
{
|
||||
if (row<0 || row>mLinks.count())
|
||||
return false;
|
||||
beginInsertRows(parent,row,row+count-1);
|
||||
for (int i=row;i<row+count;i++) {
|
||||
PAutolink link = std::make_shared<Autolink>();
|
||||
mLinks.insert(i,link);
|
||||
}
|
||||
endInsertRows();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AutolinkModel::removeRows(int row, int count, const QModelIndex &parent)
|
||||
{
|
||||
if (row<0 || row>=mLinks.count())
|
||||
return false;
|
||||
beginRemoveRows(parent,row,row+count-1);
|
||||
for (int i=row;i<row+count;i++) {
|
||||
if (i>=mLinks.count())
|
||||
break;
|
||||
mLinks.removeAt(i);
|
||||
}
|
||||
endRemoveRows();
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
const QList<PAutolink> &AutolinkModel::links() const
|
||||
{
|
||||
return mLinks;
|
||||
}
|
||||
|
||||
void AutolinkModel::setLinks(const QMap<QString, PAutolink> &newLinks)
|
||||
{
|
||||
mLinks = newLinks;
|
||||
mLinks = newLinks.values();
|
||||
}
|
||||
|
||||
int AutolinkModel::findLink(const QString &header)
|
||||
{
|
||||
for (int i=0;i<mLinks.count();i++) {
|
||||
PAutolink link = mLinks[i];
|
||||
if (link->header == header)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void CompilerAutolinkWidget::on_btnAdd_pressed()
|
||||
{
|
||||
mModel.insertRow(mModel.links().count());
|
||||
}
|
||||
|
||||
|
||||
void CompilerAutolinkWidget::on_btnRemove_pressed()
|
||||
{
|
||||
QModelIndex index = ui->tblAutolinks->currentIndex();
|
||||
mModel.removeRow(index.row(),index.parent());
|
||||
}
|
||||
|
||||
|
|
|
@ -10,10 +10,11 @@ namespace Ui {
|
|||
class CompilerAutolinkWidget;
|
||||
}
|
||||
|
||||
class CompilerAutolinkWidget;
|
||||
class AutolinkModel: public QAbstractTableModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AutolinkModel(QObject* parent=nullptr);
|
||||
explicit AutolinkModel(CompilerAutolinkWidget* widget,QObject* parent=nullptr);
|
||||
|
||||
// QAbstractItemModel interface
|
||||
public:
|
||||
|
@ -23,11 +24,17 @@ public:
|
|||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
const QMap<QString, PAutolink> &links() const;
|
||||
void setLinks(const QMap<QString, PAutolink> &newLinks);
|
||||
bool insertRows(int row, int count, const QModelIndex &parent) override;
|
||||
bool removeRows(int row, int count, const QModelIndex &parent) override;
|
||||
|
||||
const QList<PAutolink> &links() const;
|
||||
void setLinks(const QMap<QString, PAutolink> &newLinks);
|
||||
private:
|
||||
QMap<QString,PAutolink> mLinks;
|
||||
int findLink(const QString& header);
|
||||
private:
|
||||
QList<PAutolink> mLinks;
|
||||
CompilerAutolinkWidget * mWidget;
|
||||
|
||||
};
|
||||
|
||||
class CompilerAutolinkWidget : public SettingsWidget
|
||||
|
@ -47,6 +54,9 @@ private:
|
|||
protected:
|
||||
void doLoad() override;
|
||||
void doSave() override;
|
||||
private slots:
|
||||
void on_btnAdd_pressed();
|
||||
void on_btnRemove_pressed();
|
||||
};
|
||||
|
||||
#endif // COMPILERAUTOLINKWIDGET_H
|
||||
|
|
|
@ -23,6 +23,59 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnAdd">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/images/newlook24/002-add.png</normaloff>:/icons/images/newlook24/002-add.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnRemove">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/images/newlook24/008-close.png</normaloff>:/icons/images/newlook24/008-close.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableView" name="tblAutolinks">
|
||||
<property name="textElideMode">
|
||||
|
@ -32,7 +85,7 @@
|
|||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -41,6 +94,8 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
|
@ -23,6 +23,18 @@
|
|||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnAdd">
|
||||
<property name="toolTip">
|
||||
|
|
|
@ -50,6 +50,7 @@ void EditorGeneralWidget::doLoad()
|
|||
ui->chkKeepCaretX->setChecked(pSettings->editor().keepCaretX());
|
||||
setCaretTypeIndex(ui->cbCaretForInsert,pSettings->editor().caretForInsert());
|
||||
setCaretTypeIndex(ui->cbCaretForOverwrite,pSettings->editor().caretForOverwrite());
|
||||
ui->chkCaretUseIdentifierColor->setChecked(pSettings->editor().caretUseTextColor());
|
||||
ui->colorCaret->setColor(pSettings->editor().caretColor());
|
||||
//scrolls;
|
||||
ui->chkAutoHideScrollBars->setChecked(pSettings->editor().autoHideScrollbar());
|
||||
|
@ -57,6 +58,10 @@ void EditorGeneralWidget::doLoad()
|
|||
ui->chkScrollPastEOL->setChecked(pSettings->editor().scrollPastEol());
|
||||
ui->chkScrollHalfPage->setChecked(pSettings->editor().halfPageScroll());
|
||||
ui->chkScrollByOneLess->setChecked(pSettings->editor().scrollByOneLess());
|
||||
//right margin line;
|
||||
ui->grpRightEdge->setChecked(pSettings->editor().showRightEdgeLine());
|
||||
ui->spRightEdge->setValue(pSettings->editor().rightEdgeWidth());
|
||||
ui->colorRightEdgeLine->setColor(pSettings->editor().rightEdgeLineColor());
|
||||
}
|
||||
|
||||
void EditorGeneralWidget::doSave()
|
||||
|
@ -74,6 +79,7 @@ void EditorGeneralWidget::doSave()
|
|||
pSettings->editor().setKeepCaretX(ui->chkKeepCaretX->isChecked());
|
||||
pSettings->editor().setCaretForInsert(getCaretTypeIndex(ui->cbCaretForInsert));
|
||||
pSettings->editor().setCaretForOverwrite(getCaretTypeIndex(ui->cbCaretForOverwrite));
|
||||
pSettings->editor().setCaretUseTextColor(ui->chkCaretUseTextColor->isChecked());
|
||||
pSettings->editor().setCaretColor(ui->colorCaret->color());
|
||||
//scrolls;
|
||||
pSettings->editor().setAutoHideScrollbar(ui->chkAutoHideScrollBars->isChecked());
|
||||
|
@ -82,6 +88,10 @@ void EditorGeneralWidget::doSave()
|
|||
pSettings->editor().setScrollByOneLess(ui->chkScrollByOneLess->isChecked());
|
||||
pSettings->editor().setHalfPageScroll(ui->chkScrollHalfPage->isChecked());
|
||||
|
||||
//right margin line;
|
||||
pSettings->editor().setShowRightEdgeLine(ui->grpRightEdge->isChecked());
|
||||
pSettings->editor().setRightEdgeWidth(ui->spRightEdge->value());
|
||||
pSettings->editor().setRightEdgeLineColor(ui->colorRightEdgeLine->color());
|
||||
pSettings->editor().save();
|
||||
pMainWindow->updateEditorSettings();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>721</width>
|
||||
<height>700</height>
|
||||
<height>982</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -43,8 +43,15 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="lbCaretColor_2">
|
||||
<property name="text">
|
||||
<string>Tab Width</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spTabWidth">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
|
@ -54,14 +61,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbCaretColor_2">
|
||||
<property name="text">
|
||||
<string>Tab Width</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
|
@ -165,20 +165,33 @@
|
|||
<property name="spacing">
|
||||
<number>7</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbCaretForOverwrite">
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="cbCaretForOverwrite"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="ColorEdit" name="colorCaret">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbCaretForInsert">
|
||||
<property name="text">
|
||||
<string>Caret for overwriting mode</string>
|
||||
<string>Caret for inserting mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="cbCaretForInsert"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbCaretForInsert">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lbCaretColor">
|
||||
<property name="text">
|
||||
<string>Caret for inserting mode</string>
|
||||
<string>Caret Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -195,26 +208,20 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbCaretColor">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbCaretForOverwrite">
|
||||
<property name="text">
|
||||
<string>Caret Color</string>
|
||||
<string>Caret for overwriting mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="ColorEdit" name="colorCaret">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="chkCaretUseTextColor">
|
||||
<property name="text">
|
||||
<string>Use text color as caret color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="cbCaretForOverwrite"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -265,6 +272,93 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="grpRightEdge">
|
||||
<property name="title">
|
||||
<string>Show right edge line</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_4" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="lbCaretColor_3">
|
||||
<property name="text">
|
||||
<string>Right egde width</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spRightEdge">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>80</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_5" native="true">
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="2">
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbCaretColor_5">
|
||||
<property name="text">
|
||||
<string>Right edge line color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="ColorEdit" name="colorRightEdgeLine">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
|
|
@ -43,7 +43,6 @@ void SettingsWidget::connectAbstractItemView(QAbstractItemView *pView)
|
|||
connect(pView->model(),&QAbstractItemModel::rowsRemoved,this,&SettingsWidget::setSettingsChanged);
|
||||
connect(pView->model(),&QAbstractItemModel::dataChanged,this,&SettingsWidget::setSettingsChanged);
|
||||
connect(pView->model(),&QAbstractItemModel::modelReset,this,&SettingsWidget::setSettingsChanged);
|
||||
connect(pView->model(),&QAbstractItemModel::modelReset,this,&SettingsWidget::setSettingsChanged);
|
||||
}
|
||||
|
||||
void SettingsWidget::disconnectAbstractItemView(QAbstractItemView *pView)
|
||||
|
|
Loading…
Reference in New Issue