mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-01-04 19:40:53 +01:00
Include some fonts to QElectroTech
- include Liberation-Fonts and osifont (thanks elevatormind!) - use "Liberation Sans" as default-font - adjust License-Tab in About-Form - Bugfix: When selecting a font, the current font is highlighted in dialog - adjust some whitespace and English comments
This commit is contained in:
@@ -41,7 +41,7 @@ AboutQETDialog::AboutQETDialog(QWidget *parent) :
|
||||
setVersion();
|
||||
setAnnexProject();
|
||||
setLibraries();
|
||||
setLicence();
|
||||
setLicenses();
|
||||
setLoginfo();
|
||||
}
|
||||
|
||||
@@ -195,11 +195,14 @@ void AboutQETDialog::setLibraries()
|
||||
}
|
||||
|
||||
/**
|
||||
@brief AboutQETDialog::setLicence
|
||||
@brief AboutQETDialog::setLicenses
|
||||
*/
|
||||
void AboutQETDialog::setLicence()
|
||||
void AboutQETDialog::setLicenses()
|
||||
{
|
||||
ui->m_license_text_edit->setPlainText(QET::license());
|
||||
ui->m_licenses_comboBox->addItem("QElectroTech");
|
||||
ui->m_licenses_comboBox->addItem("QET-Elements");
|
||||
ui->m_licenses_comboBox->addItem("liberation-fonts");
|
||||
ui->m_licenses_comboBox->addItem("osifont");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -257,6 +260,32 @@ void AboutQETDialog::addLibrary(QLabel *label, const QString &name, const QStrin
|
||||
label->setText(new_text);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Updates the displayed license text when a different one is selected
|
||||
|
||||
This slot is called when the user selects a different license in the
|
||||
licenses combo box. It retrieves the selected license text from QET's
|
||||
license collection and displays it in the text edit widgets.
|
||||
|
||||
@param license_name The identifier of the selected license
|
||||
*/
|
||||
void AboutQETDialog::on_m_licenses_comboBox_currentTextChanged(
|
||||
const QString &license_name)
|
||||
{
|
||||
std::tuple<QString, QString> license_info = QET::licenses(license_name);
|
||||
ui->m_licenses_notice_plainTextEdit->setPlainText(std::get<0>(license_info));
|
||||
ui->m_licenses_license_plainTextEdit->setPlainText(std::get<1>(license_info));
|
||||
//adjust height of notice-field:
|
||||
int LineCount = ui->m_licenses_notice_plainTextEdit->blockCount();
|
||||
if (LineCount <= 4) {
|
||||
QFontMetrics qfm (ui->m_licenses_notice_plainTextEdit->font());
|
||||
int LineHeight = qfm.lineSpacing();
|
||||
ui->m_licenses_notice_plainTextEdit->setMaximumHeight((LineCount + 1) * LineHeight);
|
||||
} else {
|
||||
ui->m_licenses_notice_plainTextEdit->setMaximumHeight(16777215);
|
||||
}
|
||||
}
|
||||
|
||||
void AboutQETDialog::on_m_log_comboBox_currentTextChanged(const QString &arg1)
|
||||
{
|
||||
QFile log_File(arg1);
|
||||
|
||||
@@ -46,7 +46,7 @@ class AboutQETDialog : public QDialog
|
||||
void setVersion();
|
||||
void setAnnexProject();
|
||||
void setLibraries();
|
||||
void setLicence();
|
||||
void setLicenses();
|
||||
void setLoginfo();
|
||||
void addAuthor(
|
||||
QLabel *label,
|
||||
@@ -58,6 +58,7 @@ class AboutQETDialog : public QDialog
|
||||
const QString &link);
|
||||
|
||||
private slots:
|
||||
void on_m_licenses_comboBox_currentTextChanged(const QString &arg1);
|
||||
void on_m_log_comboBox_currentTextChanged(const QString &arg1);
|
||||
};
|
||||
|
||||
|
||||
@@ -503,20 +503,23 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_6">
|
||||
<widget class="QWidget" name="tab_9">
|
||||
<attribute name="title">
|
||||
<string>Accord de licence</string>
|
||||
<string>Licenses</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<item>
|
||||
<widget class="QLabel" name="m_license_label">
|
||||
<property name="text">
|
||||
<string>Ce programme est sous licence GNU/GPL.</string>
|
||||
<widget class="QComboBox" name="m_licenses_comboBox"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="m_licenses_notice_plainTextEdit">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="m_license_text_edit">
|
||||
<widget class="QPlainTextEdit" name="m_licenses_license_plainTextEdit">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
||||
@@ -87,13 +87,11 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
|
||||
ui->m_border_0->setChecked(settings.value("border-columns_0", false).toBool());
|
||||
ui->m_autosave_sb->setValue(settings.value("diagrameditor/autosave-interval", 0).toInt());
|
||||
|
||||
QString fontInfos = settings.value("diagramitemfont").toString() + " " +
|
||||
settings.value("diagramitemsize").toString() + " (" +
|
||||
settings.value("diagramitemstyle").toString() + ")";
|
||||
QString fontInfos = settings.value("diagramitemfont", "Liberation Sans").toString() + " " +
|
||||
settings.value("diagramitemsize", "9").toString() + " (" +
|
||||
settings.value("diagramitemstyle", "Regular").toString() + ")";
|
||||
ui->m_font_pb->setText(fontInfos);
|
||||
|
||||
|
||||
|
||||
|
||||
//Dynamic element text item
|
||||
ui->m_dyn_text_rotation_sb->setValue(settings.value("diagrameditor/dynamic_text_rotation", 0).toInt());
|
||||
@@ -107,7 +105,7 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
|
||||
QString::number(font.pointSize()) + " (" +
|
||||
font.styleName() + ")";
|
||||
ui->m_dyn_text_font_pb->setText(fontInfos);
|
||||
}
|
||||
} else { ui->m_dyn_text_font_pb->setText("Liberation Sans 9 (Regular)"); }
|
||||
|
||||
//Independent text item
|
||||
ui->m_indi_text_rotation_sb->setValue(settings.value("diagrameditor/independent_text_rotation",0).toInt());
|
||||
@@ -120,7 +118,7 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
|
||||
QString::number(font.pointSize()) + " (" +
|
||||
font.styleName() + ")";
|
||||
ui->m_indi_text_font_pb->setText(fontInfos);
|
||||
}
|
||||
} else { ui->m_indi_text_font_pb->setText("Liberation Sans 9 (Regular)"); }
|
||||
|
||||
ui->m_highlight_integrated_elements->setChecked(settings.value("diagrameditor/highlight-integrated-elements", true).toBool());
|
||||
ui->m_default_elements_info->setPlainText(settings.value("elementeditor/default-informations", "").toString());
|
||||
@@ -266,7 +264,7 @@ void GeneralConfigurationPage::applyConf()
|
||||
if (path != settings.value("elements-collections/common-collection-path").toString()) {
|
||||
QETApp::resetCollectionsPath();
|
||||
}
|
||||
|
||||
|
||||
path = settings.value("elements-collections/company-collection-path").toString();
|
||||
if (ui->m_company_elmt_path_cb->currentIndex() == 1)
|
||||
{
|
||||
@@ -405,7 +403,10 @@ void GeneralConfigurationPage::on_m_font_pb_clicked()
|
||||
{
|
||||
bool ok;
|
||||
QSettings settings;
|
||||
QFont font = QFontDialog::getFont(&ok, QFont("Sans Serif", 9), this);
|
||||
QFont curFont = QFont(settings.value("diagramitemfont", "Liberation Sans").toString());
|
||||
curFont.setPointSizeF(settings.value("diagramitemsize", "9").toInt());
|
||||
curFont.setStyleName (settings.value("diagramitemstyle", "Regular").toString());
|
||||
QFont font = QFontDialog::getFont(&ok, curFont, this);
|
||||
if (ok)
|
||||
{
|
||||
settings.setValue("diagramitemfont", font.family());
|
||||
@@ -427,7 +428,9 @@ void GeneralConfigurationPage::on_m_dyn_text_font_pb_clicked()
|
||||
{
|
||||
bool ok;
|
||||
QSettings settings;
|
||||
QFont font = QFontDialog::getFont(&ok, QFont("Sans Serif", 9), this);
|
||||
QFont curFont;
|
||||
curFont.fromString(settings.value("diagrameditor/dynamic_text_font", "Liberation Sans,9,-1,5,50,0,0,0,0,0,Regular").toString());
|
||||
QFont font = QFontDialog::getFont(&ok, curFont, this);
|
||||
if (ok)
|
||||
{
|
||||
settings.setValue("diagrameditor/dynamic_text_font", font.toString());
|
||||
@@ -516,7 +519,9 @@ void GeneralConfigurationPage::on_m_indi_text_font_pb_clicked()
|
||||
{
|
||||
bool ok;
|
||||
QSettings settings;
|
||||
QFont font = QFontDialog::getFont(&ok, QFont("Sans Serif", 9), this);
|
||||
QFont curFont;
|
||||
curFont.fromString(settings.value("diagrameditor/independent_text_font", "Liberation Sans,9,-1,5,50,0,0,0,0,0,Regular").toString());
|
||||
QFont font = QFontDialog::getFont(&ok, curFont, this);
|
||||
if (ok)
|
||||
{
|
||||
settings.setValue("diagrameditor/independent_text_font", font.toString());
|
||||
|
||||
Reference in New Issue
Block a user