mirror of
https://github.com/fralx/LimeReport.git
synced 2025-09-23 08:29:07 +03:00
All settings are merged in one place
This commit is contained in:
@@ -118,8 +118,6 @@ void TextItemEditor::initUI()
|
||||
{
|
||||
QStringList dataWords;
|
||||
|
||||
ui->toolButton->setChecked(false);
|
||||
ui->gbSettings->setVisible(false);
|
||||
LimeReport::DataSourceManager* dm = m_page->datasourceManager();
|
||||
LimeReport::ScriptEngineManager& se = LimeReport::ScriptEngineManager::instance();
|
||||
se.setDataManager(dm);
|
||||
@@ -152,13 +150,19 @@ void TextItemEditor::readSetting()
|
||||
if (v.isValid()){
|
||||
ui->codeEditor->restoreState(v.toByteArray());
|
||||
}
|
||||
|
||||
QVariant fontName = settings()->value("FontName");
|
||||
settings()->endGroup();
|
||||
settings()->beginGroup("ScriptEditor");
|
||||
QVariant fontName = settings()->value("DefaultFontName");
|
||||
if (fontName.isValid()){
|
||||
QVariant fontSize = settings()->value("FontSize");
|
||||
QVariant fontSize = settings()->value("DefaultFontSize");
|
||||
ui->codeEditor->setEditorFont(QFont(fontName.toString(),fontSize.toInt()));
|
||||
ui->editorFont->setCurrentFont(ui->codeEditor->editorFont());
|
||||
ui->editorFontSize->setValue(fontSize.toInt());
|
||||
}
|
||||
|
||||
QVariant tabIndention = settings()->value("TabIndention");
|
||||
if (tabIndention.isValid()){
|
||||
ui->codeEditor->setTabIndention(tabIndention.toInt());
|
||||
} else {
|
||||
ui->codeEditor->setTabIndention(LimeReport::Const::DEFAULT_TAB_INDENTION);
|
||||
}
|
||||
settings()->endGroup();
|
||||
|
||||
@@ -175,33 +179,6 @@ void TextItemEditor::writeSetting()
|
||||
}
|
||||
}
|
||||
|
||||
void TextItemEditor::on_editorFont_currentFontChanged(const QFont &f)
|
||||
{
|
||||
if (m_isReadingSetting) return;
|
||||
QFont tmp = f;
|
||||
tmp.setPointSize(ui->editorFontSize->value());
|
||||
ui->codeEditor->setEditorFont(tmp);
|
||||
settings()->beginGroup("TextItemEditor");
|
||||
settings()->setValue("FontName",ui->codeEditor->editorFont().family());
|
||||
settings()->setValue("FontSize",ui->editorFontSize->value());
|
||||
settings()->endGroup();
|
||||
}
|
||||
|
||||
void TextItemEditor::on_editorFontSize_valueChanged(int arg1)
|
||||
{
|
||||
if (m_isReadingSetting) return;
|
||||
ui->codeEditor->setEditorFont(QFont(ui->codeEditor->editorFont().family(),arg1));
|
||||
settings()->beginGroup("TextItemEditor");
|
||||
settings()->setValue("FontName",ui->codeEditor->editorFont().family());
|
||||
settings()->setValue("FontSize",ui->editorFontSize->value());
|
||||
settings()->endGroup();
|
||||
}
|
||||
|
||||
void TextItemEditor::on_toolButton_clicked(bool checked)
|
||||
{
|
||||
ui->gbSettings->setVisible(checked);
|
||||
}
|
||||
|
||||
void TextItemEditor::slotSplitterMoved(int, int)
|
||||
{
|
||||
writeSetting();
|
||||
|
@@ -69,7 +69,7 @@ public:
|
||||
QSettings* settings=0, QWidget *parent = 0);
|
||||
~TextItemEditor();
|
||||
void setSettings(QSettings* value);
|
||||
QSettings* settings();
|
||||
QSettings* settings();
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *);
|
||||
void moveEvent(QMoveEvent *);
|
||||
@@ -78,9 +78,6 @@ protected:
|
||||
private slots:
|
||||
void on_pbOk_clicked();
|
||||
void on_pbCancel_clicked();
|
||||
void on_editorFont_currentFontChanged(const QFont &f);
|
||||
void on_editorFontSize_valueChanged(int arg1);
|
||||
void on_toolButton_clicked(bool checked);
|
||||
void slotSplitterMoved(int, int);
|
||||
private:
|
||||
void initUI();
|
||||
|
@@ -17,7 +17,7 @@
|
||||
<string>Text Item Editor</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset>
|
||||
<iconset resource="items.qrc">
|
||||
<normaloff>:/items/images/insert-text_3.png</normaloff>:/items/images/insert-text_3.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
@@ -58,68 +58,8 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gbSettings">
|
||||
<property name="title">
|
||||
<string>Editor settings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Editor font</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFontComboBox" name="editorFont"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="editorFontSize">
|
||||
<property name="value">
|
||||
<number>11</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<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>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/items/images/settings.png</normaloff>:/items/images/settings.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
@@ -169,6 +109,9 @@
|
||||
<tabstop>pbOk</tabstop>
|
||||
<tabstop>pbCancel</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="items.qrc"/>
|
||||
<include location="items.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
Reference in New Issue
Block a user