diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2021-02-11 18:24:33 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2021-02-11 18:24:33 +0000 |
| commit | 6f96f16e32a88cf032ff83f6ea73587879d76892 (patch) | |
| tree | 4541b58b7a035d1ff2a42fad8e194e5931e584ff /src/qmmpui | |
| parent | 8a25044e88d66e823e5cc92cb12ab2b3b9e5fc98 (diff) | |
| download | qmmp-6f96f16e32a88cf032ff83f6ea73587879d76892.tar.gz qmmp-6f96f16e32a88cf032ff83f6ea73587879d76892.tar.bz2 qmmp-6f96f16e32a88cf032ff83f6ea73587879d76892.zip | |
added feature to change cue editor font
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@9726 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/qmmpui')
| -rw-r--r-- | src/qmmpui/configdialog.cpp | 27 | ||||
| -rw-r--r-- | src/qmmpui/configdialog.h | 2 | ||||
| -rw-r--r-- | src/qmmpui/cueeditor.cpp | 7 | ||||
| -rw-r--r-- | src/qmmpui/forms/configdialog.ui | 190 |
4 files changed, 189 insertions, 37 deletions
diff --git a/src/qmmpui/configdialog.cpp b/src/qmmpui/configdialog.cpp index f52478c3e..f125def21 100644 --- a/src/qmmpui/configdialog.cpp +++ b/src/qmmpui/configdialog.cpp @@ -177,10 +177,16 @@ void ConfigDialog::readSettings() QList<int> sizes; sizes << var_sizes.first().toInt() << var_sizes.last().toInt(); m_ui->splitter->setSizes(sizes); + //fonts + QFont font; + font.fromString(settings.value("CueEditor/font", qApp->font("QPlainTextEdit").toString()).toString()); + m_ui->cueFontLabel->setText(font.family() + " " + QString::number(font.pointSize())); + m_ui->cueFontLabel->setFont(font); + m_ui->cueSystemFontCheckBox->setChecked(settings.value("CueEditor/use_system_font", true).toBool()); } -void ConfigDialog::on_contentsWidget_currentItemChanged (QListWidgetItem *current, - QListWidgetItem *previous) +void ConfigDialog::on_contentsWidget_currentItemChanged(QListWidgetItem *current, + QListWidgetItem *previous) { if (!current) current = previous; @@ -442,6 +448,9 @@ void ConfigDialog::saveSettings() int index = m_ui->langComboBox->currentIndex(); if(index >= 0) Qmmp::setUiLanguageID(m_ui->langComboBox->itemData(index).toString()); + //fonts + settings.setValue("CueEditor/font", m_ui->cueFontLabel->font().toString()); + settings.setValue("CueEditor/use_system_font", m_ui->cueSystemFontCheckBox->isChecked()); } void ConfigDialog::on_treeWidget_itemChanged (QTreeWidgetItem *item, int column) @@ -450,7 +459,7 @@ void ConfigDialog::on_treeWidget_itemChanged (QTreeWidgetItem *item, int column) dynamic_cast<PluginItem *>(item)->setEnabled(item->checkState(0) == Qt::Checked); } -void ConfigDialog::on_treeWidget_currentItemChanged (QTreeWidgetItem *current, QTreeWidgetItem *) +void ConfigDialog::on_treeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *) { if(current->type() >= PluginItem::TRANSPORT) { @@ -465,3 +474,15 @@ void ConfigDialog::on_treeWidget_currentItemChanged (QTreeWidgetItem *current, Q m_preferencesAction->setEnabled(m_ui->preferencesButton->isEnabled()); m_informationAction->setEnabled(m_ui->informationButton->isEnabled()); } + +void ConfigDialog::on_cueFontButton_clicked() +{ + bool ok = false; + QFont font = m_ui->cueFontLabel->font(); + font = QFontDialog::getFont (&ok, font, this); + if(ok) + { + m_ui->cueFontLabel->setText(font.family () + " " + QString::number(font.pointSize ())); + m_ui->cueFontLabel->setFont(font); + } +} diff --git a/src/qmmpui/configdialog.h b/src/qmmpui/configdialog.h index e5010da28..885f7d779 100644 --- a/src/qmmpui/configdialog.h +++ b/src/qmmpui/configdialog.h @@ -67,6 +67,8 @@ private slots: void saveSettings(); void on_treeWidget_itemChanged (QTreeWidgetItem *item, int column); void on_treeWidget_currentItemChanged (QTreeWidgetItem *current, QTreeWidgetItem *); + void on_cueFontButton_clicked(); + private: void readSettings(); diff --git a/src/qmmpui/cueeditor.cpp b/src/qmmpui/cueeditor.cpp index 8366e5024..865f59752 100644 --- a/src/qmmpui/cueeditor.cpp +++ b/src/qmmpui/cueeditor.cpp @@ -74,6 +74,13 @@ CueEditor::CueEditor(MetaDataModel *model, const TrackInfo &info, QWidget *paren m_parser.loadData(model->cue().toUtf8()); QSettings settings(Qmmp::configFile(), QSettings::IniFormat); m_lastDir = settings.value("CueEditor/last_dir", QDir::homePath()).toString(); + if(!settings.value("CueEditor/use_system_font", true).toBool()) + { + QFont font; + font.fromString(settings.value("CueEditor/font", qApp->font("QPlainTextEdit").toString()).toString()); + m_ui->plainTextEdit->setFont(font); + } + m_editable = m_model && (m_model->dialogHints() & MetaDataModel::IsCueEditable) && !m_model->isReadOnly(); new CueSyntaxHighlighter(m_ui->plainTextEdit->document()); diff --git a/src/qmmpui/forms/configdialog.ui b/src/qmmpui/forms/configdialog.ui index 9bc4d8cc6..195d93f5c 100644 --- a/src/qmmpui/forms/configdialog.ui +++ b/src/qmmpui/forms/configdialog.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>739</width> - <height>545</height> + <width>836</width> + <height>618</height> </rect> </property> <property name="windowTitle"> @@ -509,6 +509,80 @@ </widget> </item> <item> + <widget class="QGroupBox" name="groupBox_8"> + <property name="title"> + <string>CUE Editor</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_8"> + <item> + <widget class="QCheckBox" name="cueSystemFontCheckBox"> + <property name="text"> + <string>Use system font</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="label_21"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Font:</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="cueFontLabel"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + <property name="text"> + <string>???</string> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="cueFontButton"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> <spacer name="verticalSpacer_3"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -920,12 +994,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>480</x> - <y>63</y> + <x>341</x> + <y>34</y> </hint> <hint type="destinationlabel"> - <x>617</x> - <y>131</y> + <x>341</x> + <y>33</y> </hint> </hints> </connection> @@ -936,12 +1010,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>480</x> - <y>63</y> + <x>341</x> + <y>34</y> </hint> <hint type="destinationlabel"> - <x>617</x> - <y>163</y> + <x>341</x> + <y>32</y> </hint> </hints> </connection> @@ -952,12 +1026,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>617</x> - <y>192</y> + <x>341</x> + <y>32</y> </hint> <hint type="destinationlabel"> - <x>617</x> - <y>224</y> + <x>341</x> + <y>31</y> </hint> </hints> </connection> @@ -968,12 +1042,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>617</x> - <y>192</y> + <x>341</x> + <y>32</y> </hint> <hint type="destinationlabel"> - <x>617</x> - <y>256</y> + <x>341</x> + <y>31</y> </hint> </hints> </connection> @@ -984,8 +1058,8 @@ <slot>reject()</slot> <hints> <hint type="sourcelabel"> - <x>633</x> - <y>482</y> + <x>639</x> + <y>611</y> </hint> <hint type="destinationlabel"> <x>225</x> @@ -1000,8 +1074,8 @@ <slot>accept()</slot> <hints> <hint type="sourcelabel"> - <x>633</x> - <y>482</y> + <x>639</x> + <y>611</y> </hint> <hint type="destinationlabel"> <x>141</x> @@ -1016,12 +1090,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>480</x> - <y>192</y> + <x>629</x> + <y>221</y> </hint> <hint type="destinationlabel"> - <x>617</x> - <y>194</y> + <x>813</x> + <y>223</y> </hint> </hints> </connection> @@ -1032,12 +1106,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>257</x> - <y>50</y> + <x>320</x> + <y>39</y> </hint> <hint type="destinationlabel"> - <x>261</x> - <y>80</y> + <x>341</x> + <y>35</y> </hint> </hints> </connection> @@ -1048,12 +1122,60 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>342</x> - <y>55</y> + <x>341</x> + <y>34</y> + </hint> + <hint type="destinationlabel"> + <x>341</x> + <y>33</y> + </hint> + </hints> + </connection> + <connection> + <sender>cueSystemFontCheckBox</sender> + <signal>clicked(bool)</signal> + <receiver>label_21</receiver> + <slot>setDisabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>291</x> + <y>509</y> + </hint> + <hint type="destinationlabel"> + <x>299</x> + <y>531</y> + </hint> + </hints> + </connection> + <connection> + <sender>cueSystemFontCheckBox</sender> + <signal>toggled(bool)</signal> + <receiver>cueFontLabel</receiver> + <slot>setDisabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>350</x> + <y>499</y> + </hint> + <hint type="destinationlabel"> + <x>369</x> + <y>531</y> + </hint> + </hints> + </connection> + <connection> + <sender>cueSystemFontCheckBox</sender> + <signal>toggled(bool)</signal> + <receiver>cueFontButton</receiver> + <slot>setDisabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>774</x> + <y>502</y> </hint> <hint type="destinationlabel"> - <x>356</x> - <y>88</y> + <x>804</x> + <y>526</y> </hint> </hints> </connection> |
