diff --git a/res/fonts/OpenSans-Regular.ttf b/res/fonts/OpenSans-Regular.ttf new file mode 100644 index 000000000000..db433349b704 Binary files /dev/null and b/res/fonts/OpenSans-Regular.ttf differ diff --git a/res/fonts/OpenSans.LICENSE.txt b/res/fonts/OpenSans.LICENSE.txt new file mode 100644 index 000000000000..75b52484ea47 --- /dev/null +++ b/res/fonts/OpenSans.LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/res/skins/Deere/style.qss b/res/skins/Deere/style.qss index 72c39d790f36..8efa374f1005 100644 --- a/res/skins/Deere/style.qss +++ b/res/skins/Deere/style.qss @@ -144,11 +144,11 @@ QSplitter::handle:vertical { #Mixxx { background-color: black; + font-family: "Open Sans"; } WWidget, QLabel { - font: bold 16pt/18pt Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif; - font-size: 7pt; + font-size: 6pt; text-transform: uppercase; } @@ -246,12 +246,14 @@ WSliderComposed { } #DeckTextRow #ArtistGutter WLabel, #DeckTextRow #BPMGutter WLabel, #DeckTextRow #PositionGutter WLabel { - font: bold 16pt/18pt Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif; + font-weight: bold; + font-size: 15pt; text-transform: none; } #SamplerTextRow #ArtistGutter WLabel, #SamplerTextRow #BPMGutter WLabel, #SamplerTextRow #PositionGutter WLabel { - font: bold 12pt/14pt Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif; + font-weight: bold; + font-size: 11pt; text-transform: none; } @@ -260,19 +262,22 @@ WSliderComposed { } #DeckTextRow #TitleGutter WLabel, #EffectRackExpanded #EffectUnitNameContainer WLabel { - font: bold 18pt/20pt Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif; + font-weight: bold; + font-size: 17pt; text-transform: none; text-align: left; } #SamplerTextRow #TitleGutter WLabel { - font: bold 14pt/12pt Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif; + font-weight: bold; + font-size: 13pt; text-transform: none; text-align: left; } #EffectRackCollapsed #EffectUnitNameContainer WLabel { - font: bold 16pt/18pt Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif; + font-weight: bold; + font-size: 15pt; text-transform: none; text-align: left; } @@ -303,7 +308,7 @@ WSliderComposed { } #EffectUnitNextPrevContainer WPushButton { - font-size: 12pt; + font-size: 11pt; } #EffectKnob { @@ -441,7 +446,7 @@ WWidget, WLabel { } #EffectUnit { - font-size: 16pt; + font-size: 15pt; } #EffectUnit1 { diff --git a/res/skins/LateNight/style.qss b/res/skins/LateNight/style.qss index 3d44a94a1084..d26ee411613b 100644 --- a/res/skins/LateNight/style.qss +++ b/res/skins/LateNight/style.qss @@ -848,7 +848,7 @@ QTableView, QTextBrowser, QTreeView { border: 1px solid #585858; - font: 15px/18px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif; + /*font: 15px/18px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif;*/ color: #cfb32c; background-color: #0f0f0f; alternate-background-color: #1a1a1a; @@ -881,9 +881,6 @@ QPushButton#LibraryPreviewButton { /*QPushButton#LibraryPreviewButton:focus { background-color: #725309; }*/ -/*#LibraryBPMWidget, #LibraryBPMButton, #LibraryBPMSpinBox { - background-color: #ff0; -}*/ QPushButton#LibraryPreviewButton:!checked{ image: url(skin:/style/style_library_preview_play.png); } QPushButton#LibraryPreviewButton:checked{ image: url(skin:/style/style_library_preview_pause.png); } @@ -950,15 +947,15 @@ QScrollBar::sub-line:horizontal, QScrollBar::sub-line:vertical { } /* transition time in Auto DJ tab */ -QSpinBox:editable { font: 13px/15px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif; background: transparent; color: #cfb32c; } +QSpinBox:editable { background: transparent; color: #cfb32c; } QSpinBox { min-height: 20px; max-height: 20px;min-width: 40px; max-width: 40px;} /* library search bar */ -WSearchLineEdit { padding: 2px; border: 1px solid #656565; font: 18px/20px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif; background: #181818; color: #cfb32c; } -WSearchLineEdit:focus { padding: 2px; border: 2px solid #FF6600; font: bold 18px/20px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif; background: #0f0f0f; color: #eece33;} +WSearchLineEdit { padding: 2px; border: 1px solid #656565; background: #181818; color: #cfb32c; } +WSearchLineEdit:focus { padding: 2px; border: 2px solid #FF6600; background: #0f0f0f; color: #eece33;} /* cover art */ -WCoverArt { font: 13px/15px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif; background: transparent; color: #ACACAC; } +WCoverArt { background: transparent; color: #ACACAC; } /* splitter between treeview and library */ QSplitter::handle { image: url(skin:/style/style_handle_unchecked.png); background-color: #1e1e1e; } @@ -966,9 +963,8 @@ QSplitter::handle:pressed { image: url(skin:/style/style_handle_checked.png); ba QSplitter::handle:horizontal { width: 10px; background-color: #0e0e0e;} QSplitter::handle:vertical { height: 10px; background-color: #0e0e0e;} -/*QPushButton { font: 13px/15px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif; }*/ /* Extra declaration for QRadioButton otherwise it shows up with wrong colors in Linux with Gnome */ -QLabel, QRadioButton { font: 15px/18px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif; background: transparent; color: #cfb32c;} +QLabel, QRadioButton { background: transparent; color: #cfb32c;} /* Spacing between treeview and searchbar */ QTreeView { margin: 10px 0px 0px 0px; } diff --git a/src/SConscript b/src/SConscript index c60da842e8bf..71388e508f5e 100644 --- a/src/SConscript +++ b/src/SConscript @@ -199,6 +199,9 @@ controllermappings_files = Glob('#res/controllers/*') # Translation files translation_files = Glob('#res/translations/*.qm') +# Font files +font_files = Glob('#res/fonts/*') + #Keyboard mapping(s) keyboardmappings_files = Glob('#res/keyboard/*') @@ -286,6 +289,7 @@ if build.platform_is_linux or build.platform_is_bsd: binary = env.Install(unix_bin_path, binary_files) resource = env.Install(os.path.join(unix_share_path, 'mixxx'), resource_files) skins = env.Install(os.path.join(unix_share_path, 'mixxx', 'skins'), skin_files) + fonts = env.Install(os.path.join(unix_share_path, 'mixxx', 'fonts'), font_files) vamp_plugin = env.Install( os.path.join(unix_lib_path, 'mixxx', 'plugins', 'vamp'), libmixxxminimal_vamp_plugin) @@ -306,6 +310,7 @@ if build.platform_is_linux or build.platform_is_bsd: env.Alias('install', binary) env.Alias('install', resource) env.Alias('install', skins) + env.Alias('install', fonts) env.Alias('install', soundsource_plugins) env.Alias('install', controllermappings) env.Alias('install', translations) @@ -398,6 +403,7 @@ if build.platform_is_osx and 'bundle' in COMMAND_LINE_TARGETS: Dir('#res/skins/'), File('#res/schema.xml'), Dir('#res/controllers/'), + Dir('#res/fonts/'), translation_files, Dir('#res/keyboard/'), Dir('#res/doc/'), @@ -459,6 +465,7 @@ if build.platform_is_windows: skins = env.Install(os.path.join(base_dist_dir, "skins"), skin_files) resource = env.Install(base_dist_dir+"/", resource_files) controllermappings = env.Install(os.path.join(base_dist_dir, "controllers"), controllermappings_files) + fonts = env.Install(os.path.join(base_dist_dir, "fonts"), font_files) translations = env.Install(os.path.join(base_dist_dir, "translations"), translation_files) keyboardmappings = env.Install(os.path.join(base_dist_dir, "keyboard"), keyboardmappings_files) docs = env.Install(os.path.join(base_dist_dir, "doc/"), docs_files) @@ -475,6 +482,7 @@ if build.platform_is_windows: env.Alias('mixxx', skins) env.Alias('mixxx', resource) env.Alias('mixxx', controllermappings) + env.Alias('mixxx', fonts) env.Alias('mixxx', translations) env.Alias('mixxx', keyboardmappings) env.Alias('mixxx', promotracks) diff --git a/src/dlgautodj.cpp b/src/dlgautodj.cpp index 3eac250f45e8..90bb77e1f934 100644 --- a/src/dlgautodj.cpp +++ b/src/dlgautodj.cpp @@ -7,6 +7,7 @@ DlgAutoDJ::DlgAutoDJ(QWidget* parent, ConfigObject* pConfig, + Library* pLibrary, AutoDJProcessor* pProcessor, TrackCollection* pTrackCollection, MixxxKeyboard* pKeyboard) @@ -26,6 +27,10 @@ DlgAutoDJ::DlgAutoDJ(QWidget* parent, this, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool))); connect(m_pTrackTableView, SIGNAL(trackSelected(TrackPointer)), this, SIGNAL(trackSelected(TrackPointer))); + connect(pLibrary, SIGNAL(setTrackTableFont(QFont)), + m_pTrackTableView, SLOT(setTrackTableFont(QFont))); + connect(pLibrary, SIGNAL(setTrackTableRowHeight(int)), + m_pTrackTableView, SLOT(setTrackTableRowHeight(int))); QBoxLayout* box = dynamic_cast(layout()); Q_ASSERT(box); //Assumes the form layout is a QVBox/QHBoxLayout! @@ -178,3 +183,11 @@ void DlgAutoDJ::autoDJStateChanged(AutoDJProcessor::AutoDJState state) { pushButtonSkipNext->setEnabled(true); } } + +void DlgAutoDJ::setTrackTableFont(const QFont& font) { + m_pTrackTableView->setTrackTableFont(font); +} + +void DlgAutoDJ::setTrackTableRowHeight(int rowHeight) { + m_pTrackTableView->setTrackTableRowHeight(rowHeight); +} diff --git a/src/dlgautodj.h b/src/dlgautodj.h index 1e646b413afe..41275c794ee7 100644 --- a/src/dlgautodj.h +++ b/src/dlgautodj.h @@ -8,6 +8,7 @@ #include "configobject.h" #include "trackinfoobject.h" #include "library/libraryview.h" +#include "library/library.h" #include "library/trackcollection.h" #include "library/autodj/autodjprocessor.h" #include "mixxxkeyboard.h" @@ -19,6 +20,7 @@ class DlgAutoDJ : public QWidget, public Ui::DlgAutoDJ, public LibraryView { Q_OBJECT public: DlgAutoDJ(QWidget* parent, ConfigObject* pConfig, + Library* pLibrary, AutoDJProcessor* pProcessor, TrackCollection* pTrackCollection, MixxxKeyboard* pKeyboard); virtual ~DlgAutoDJ(); @@ -38,6 +40,8 @@ class DlgAutoDJ : public QWidget, public Ui::DlgAutoDJ, public LibraryView { void transitionSliderChanged(int value); void enableRandomButton(bool enabled); void autoDJStateChanged(AutoDJProcessor::AutoDJState state); + void setTrackTableFont(const QFont& font); + void setTrackTableRowHeight(int rowHeight); signals: void addRandomButton(bool buttonChecked); diff --git a/src/dlghidden.cpp b/src/dlghidden.cpp index ffc37a27f886..5f1e1d7ba76a 100644 --- a/src/dlghidden.cpp +++ b/src/dlghidden.cpp @@ -5,7 +5,8 @@ #include "widget/wtracktableview.h" DlgHidden::DlgHidden(QWidget* parent, ConfigObject* pConfig, - TrackCollection* pTrackCollection, MixxxKeyboard* pKeyboard) + Library* pLibrary, TrackCollection* pTrackCollection, + MixxxKeyboard* pKeyboard) : QWidget(parent), Ui::DlgHidden(), m_pTrackTableView( @@ -40,6 +41,10 @@ DlgHidden::DlgHidden(QWidget* parent, ConfigObject* pConfig, connect(m_pTrackTableView, SIGNAL(trackSelected(TrackPointer)), this, SIGNAL(trackSelected(TrackPointer))); + connect(pLibrary, SIGNAL(setTrackTableFont(QFont)), + m_pTrackTableView, SLOT(setTrackTableFont(QFont))); + connect(pLibrary, SIGNAL(setTrackTableRowHeight(int)), + m_pTrackTableView, SLOT(setTrackTableRowHeight(int))); } DlgHidden::~DlgHidden() { @@ -78,3 +83,11 @@ void DlgHidden::selectionChanged(const QItemSelection &selected, Q_UNUSED(deselected); activateButtons(!selected.indexes().isEmpty()); } + +void DlgHidden::setTrackTableFont(const QFont& font) { + m_pTrackTableView->setTrackTableFont(font); +} + +void DlgHidden::setTrackTableRowHeight(int rowHeight) { + m_pTrackTableView->setTrackTableRowHeight(rowHeight); +} diff --git a/src/dlghidden.h b/src/dlghidden.h index ffbbff2c9130..84d062ee048f 100644 --- a/src/dlghidden.h +++ b/src/dlghidden.h @@ -3,6 +3,7 @@ #include "ui_dlghidden.h" #include "configobject.h" +#include "library/library.h" #include "library/libraryview.h" #include "library/trackcollection.h" #include "mixxxkeyboard.h" @@ -14,8 +15,9 @@ class QItemSelection; class DlgHidden : public QWidget, public Ui::DlgHidden, public LibraryView { Q_OBJECT public: - DlgHidden(QWidget *parent, ConfigObject* pConfig, - TrackCollection* pTrackCollection, MixxxKeyboard* pKeyboard); + DlgHidden(QWidget* parent, ConfigObject* pConfig, + Library* pLibrary, TrackCollection* pTrackCollection, + MixxxKeyboard* pKeyboard); virtual ~DlgHidden(); void onShow(); @@ -25,6 +27,8 @@ class DlgHidden : public QWidget, public Ui::DlgHidden, public LibraryView { void clicked(); void selectAll(); void selectionChanged(const QItemSelection&, const QItemSelection&); + void setTrackTableFont(const QFont& font); + void setTrackTableRowHeight(int rowHeight); signals: void trackSelected(TrackPointer pTrack); diff --git a/src/dlgmissing.cpp b/src/dlgmissing.cpp index 55fef44a251d..761c9d1f9221 100644 --- a/src/dlgmissing.cpp +++ b/src/dlgmissing.cpp @@ -4,11 +4,12 @@ #include "widget/wtracktableview.h" DlgMissing::DlgMissing(QWidget* parent, ConfigObject* pConfig, - TrackCollection* pTrackCollection, MixxxKeyboard* pKeyboard) + Library* pLibrary, + TrackCollection* pTrackCollection, MixxxKeyboard* pKeyboard) : QWidget(parent), Ui::DlgMissing(), m_pTrackTableView( - new WTrackTableView(this,pConfig,pTrackCollection, false)) { + new WTrackTableView(this, pConfig, pTrackCollection, false)) { setupUi(this); m_pTrackTableView->installEventFilter(pKeyboard); @@ -32,6 +33,10 @@ DlgMissing::DlgMissing(QWidget* parent, ConfigObject* pConfig, SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), this, SLOT(selectionChanged(const QItemSelection&, const QItemSelection&))); + connect(pLibrary, SIGNAL(setTrackTableFont(QFont)), + m_pTrackTableView, SLOT(setTrackTableFont(QFont))); + connect(pLibrary, SIGNAL(setTrackTableRowHeight(int)), + m_pTrackTableView, SLOT(setTrackTableRowHeight(int))); connect(m_pTrackTableView, SIGNAL(trackSelected(TrackPointer)), this, SIGNAL(trackSelected(TrackPointer))); @@ -71,3 +76,11 @@ void DlgMissing::selectionChanged(const QItemSelection &selected, Q_UNUSED(deselected); activateButtons(!selected.indexes().isEmpty()); } + +void DlgMissing::setTrackTableFont(const QFont& font) { + m_pTrackTableView->setTrackTableFont(font); +} + +void DlgMissing::setTrackTableRowHeight(int rowHeight) { + m_pTrackTableView->setTrackTableRowHeight(rowHeight); +} diff --git a/src/dlgmissing.h b/src/dlgmissing.h index 734a98ff8e73..13485128aae2 100644 --- a/src/dlgmissing.h +++ b/src/dlgmissing.h @@ -3,6 +3,7 @@ #include "ui_dlgmissing.h" #include "configobject.h" +#include "library/library.h" #include "library/libraryview.h" #include "library/trackcollection.h" #include "mixxxkeyboard.h" @@ -13,8 +14,9 @@ class MissingTableModel; class DlgMissing : public QWidget, public Ui::DlgMissing, public LibraryView { Q_OBJECT public: - DlgMissing(QWidget *parent, ConfigObject* pConfig, - TrackCollection* pTrackCollection, MixxxKeyboard* pKeyboard); + DlgMissing(QWidget* parent, ConfigObject* pConfig, + Library* pLibrary, TrackCollection* pTrackCollection, + MixxxKeyboard* pKeyboard); virtual ~DlgMissing(); void onShow(); @@ -24,6 +26,8 @@ class DlgMissing : public QWidget, public Ui::DlgMissing, public LibraryView { void clicked(); void selectAll(); void selectionChanged(const QItemSelection&, const QItemSelection&); + void setTrackTableFont(const QFont& font); + void setTrackTableRowHeight(int rowHeight); signals: void trackSelected(TrackPointer pTrack); diff --git a/src/dlgprefcontrols.cpp b/src/dlgprefcontrols.cpp index 5805374aecb5..8f7f5ea6de23 100644 --- a/src/dlgprefcontrols.cpp +++ b/src/dlgprefcontrols.cpp @@ -37,8 +37,6 @@ #include "mixxx.h" #include "defs_urls.h" -const int kDefaultRowHeight = 20; - DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxMainWindow * mixxx, SkinLoader* pSkinLoader, PlayerManager* pPlayerManager, @@ -49,8 +47,7 @@ DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxMainWindow * mixxx, m_pSkinLoader(pSkinLoader), m_pPlayerManager(pPlayerManager), m_iNumConfiguredDecks(0), - m_iNumConfiguredSamplers(0), - m_rebootNotifiedRowHeight(false) { + m_iNumConfiguredSamplers(0) { setupUi(this); m_pNumDecks = new ControlObjectSlave("[Master]", "num_decks", this); @@ -81,14 +78,6 @@ DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxMainWindow * mixxx, connect(ComboBoxPosition, SIGNAL(activated(int)), this, SLOT(slotSetPositionDisplay(int))); - // Set default direction as stored in config file - int rowHeight = m_pConfig->getValueString(ConfigKey("[Library]","RowHeight"), - QString::number(kDefaultRowHeight)).toInt(); - spinBoxRowHeight->setValue(rowHeight); - connect(spinBoxRowHeight, SIGNAL(valueChanged(int)), - this, SLOT(slotRowHeightValueChanged(int))); - - // Set default direction as stored in config file if (m_pConfig->getValueString(ConfigKey("[Controls]","RateDir")).length() == 0) m_pConfig->set(ConfigKey("[Controls]","RateDir"),ConfigValue(0)); @@ -376,10 +365,6 @@ void DlgPrefControls::slotUpdate() { ComboBoxRateDir->setCurrentIndex(0); else ComboBoxRateDir->setCurrentIndex(1); - - int rowHeight = m_pConfig->getValueString(ConfigKey("[Library]","RowHeight"), - QString::number(kDefaultRowHeight)).toInt(); - spinBoxRowHeight->setValue(rowHeight); } void DlgPrefControls::slotResetToDefaults() { @@ -421,8 +406,6 @@ void DlgPrefControls::slotResetToDefaults() { spinBoxTempRateRight->setValue(2.0); spinBoxPermRateLeft->setValue(0.50); spinBoxPermRateRight->setValue(0.05); - - spinBoxRowHeight->setValue(kDefaultRowHeight); } void DlgPrefControls::slotSetLocale(int pos) { @@ -599,11 +582,6 @@ void DlgPrefControls::slotApply() { } else { m_pConfig->set(ConfigKey("[Controls]","RateDir"), ConfigValue(1)); } - - int rowHeight = spinBoxRowHeight->value(); - m_pConfig->set(ConfigKey("[Library]","RowHeight"), - ConfigValue(rowHeight)); - } //Returns TRUE if skin fits to screen resolution, FALSE otherwise @@ -684,11 +662,3 @@ void DlgPrefControls::slotNumSamplersChanged(double new_count) { slotSetRateDir(m_pConfig->getValueString(ConfigKey("[Controls]","RateDir")).toInt()); slotSetRateRange(m_pConfig->getValueString(ConfigKey("[Controls]","RateRange")).toInt()); } - -void DlgPrefControls::slotRowHeightValueChanged(int height) { - Q_UNUSED(height); - if(!m_rebootNotifiedRowHeight) { - notifyRebootNecessary(); - m_rebootNotifiedRowHeight = true; - } -} diff --git a/src/dlgprefcontrols.h b/src/dlgprefcontrols.h index 32af90b58b68..670a4b91e75e 100644 --- a/src/dlgprefcontrols.h +++ b/src/dlgprefcontrols.h @@ -72,8 +72,6 @@ class DlgPrefControls : public DlgPreferencePage, public Ui::DlgPrefControlsDlg void slotNumDecksChanged(double); void slotNumSamplersChanged(double); - void slotRowHeightValueChanged(int); - private: void notifyRebootNecessary(); bool checkSkinResolution(QString skin); @@ -92,8 +90,6 @@ class DlgPrefControls : public DlgPreferencePage, public Ui::DlgPrefControlsDlg int m_iNumConfiguredDecks; int m_iNumConfiguredSamplers; - - bool m_rebootNotifiedRowHeight; }; #endif diff --git a/src/dlgprefcontrolsdlg.ui b/src/dlgprefcontrolsdlg.ui index 765de0ff688d..a369a283752b 100644 --- a/src/dlgprefcontrolsdlg.ui +++ b/src/dlgprefcontrolsdlg.ui @@ -6,7 +6,7 @@ 0 0 - 538 + 561 690 @@ -245,8 +245,8 @@ - - + + 0 @@ -256,32 +256,35 @@ + + Select from different color schemes of a skin if available. + - - - - - 0 - 0 - + + + + Cue mode - - + + true + + + ComboBoxCueDefault - - + + - + Track load behavior - - Qt::AlignJustify|Qt::AlignVCenter + + ComboBoxAllowTrackLoadToPlayingDeck - + Mixxx mode: @@ -300,29 +303,45 @@ Numark mode: - - - - Start in full screen mode + + + + + 0 + 0 + + + + + + + A small pop-up box displays a brief description of a control's purpose when the cursor rests on the control. - - - - true + + + + + 0 + 0 + - - Position display - - - false + + + + + + + 0 + 0 + - - ComboBoxPosition + + @@ -345,8 +364,15 @@ Numark mode: - - + + + + Start in full screen mode + + + + + true @@ -354,106 +380,57 @@ Numark mode: - Speed slider range + Position display false - ComboBoxRateRange + ComboBoxPosition - - - - - 0 - 0 - - - - + + + + - - A small pop-up box displays a brief description of a control's purpose when the cursor rests on the control. + + Qt::AlignJustify|Qt::AlignVCenter - - - - - 0 - 0 - + + + + true - - Select from different color schemes of a skin if available. - - - - - - - Track load behavior - - - ComboBoxAllowTrackLoadToPlayingDeck - - - - - - Cue mode + Speed slider range - - true + + false - ComboBoxCueDefault + ComboBoxRateRange - - + + 0 0 - - - - - Adjusts the range of the speed (Vinyl "Pitch") slider. - - - - - - - Locale - - - ComboBoxLocale - - - - - - - Locales determine country and language specific settings. - - - + + true @@ -461,13 +438,29 @@ Numark mode: - Speed slider direction + Tool tips false - ComboBoxRateDir + ComboBoxTooltips + + + + + + + + + + + + + Auto Recall Cue + + + ComboBoxCueRecall @@ -503,24 +496,15 @@ Numark mode: - - - - Auto Recall Cue - - - ComboBoxCueRecall + + + + Locales determine country and language specific settings. - - - - - - - - + + true @@ -528,46 +512,39 @@ Numark mode: - Tool tips + Speed slider direction false - ComboBoxTooltips + ComboBoxRateDir - - + + + + Locale + + + ComboBoxLocale + + + + + 0 0 - - - - - - Library Row Height - - - - - - - px - - - 10 - - - 50 + + - - 20 + + Adjusts the range of the speed (Vinyl "Pitch") slider. diff --git a/src/dlgpreflibrary.cpp b/src/dlgpreflibrary.cpp index 32d437361786..005b4e09cb31 100644 --- a/src/dlgpreflibrary.cpp +++ b/src/dlgpreflibrary.cpp @@ -20,20 +20,23 @@ #include #include #include +#include +#include +#include #include "dlgpreflibrary.h" #include "soundsourceproxy.h" #define MIXXX_ADDONS_URL "http://www.mixxx.org/wiki/doku.php/add-ons" - DlgPrefLibrary::DlgPrefLibrary(QWidget * parent, ConfigObject * config, Library *pLibrary) : DlgPreferencePage(parent), m_dirListModel(), m_pconfig(config), m_pLibrary(pLibrary), - m_baddedDirectory(false) { + m_baddedDirectory(false), + m_iOriginalTrackTableRowHeight(Library::kDefaultRowHeightPx) { setupUi(this); slotUpdate(); checkbox_ID3_sync->setVisible(false); @@ -60,6 +63,19 @@ DlgPrefLibrary::DlgPrefLibrary(QWidget * parent, if (plugins.length() > 0) { pluginsLabel->setText(plugins.join(", ")); } + + // Set default direction as stored in config file + int rowHeight = m_pLibrary->getTrackTableRowHeight(); + spinBoxRowHeight->setValue(rowHeight); + connect(spinBoxRowHeight, SIGNAL(valueChanged(int)), + this, SLOT(slotRowHeightValueChanged(int))); + + connect(libraryFontButton, SIGNAL(clicked()), + this, SLOT(slotSelectFont())); + connect(this, SIGNAL(setTrackTableFont(QFont)), + m_pLibrary, SLOT(slotSetTrackTableFont(QFont))); + connect(this, SIGNAL(setTrackTableRowHeight(int)), + m_pLibrary, SLOT(slotSetTrackTableRowHeight(int))); } DlgPrefLibrary::~DlgPrefLibrary() { @@ -128,6 +144,8 @@ void DlgPrefLibrary::slotResetToDefaults() { radioButton_dbclick_bottom->setChecked(false); radioButton_dbclick_top->setChecked(false); radioButton_dbclick_deck->setChecked(true); + spinBoxRowHeight->setValue(Library::kDefaultRowHeightPx); + setLibraryFont(QApplication::font()); } void DlgPrefLibrary::slotUpdate() { @@ -159,6 +177,17 @@ void DlgPrefLibrary::slotUpdate() { radioButton_dbclick_deck->setChecked(true); break; } + + m_originalTrackTableFont = m_pLibrary->getTrackTableFont(); + m_iOriginalTrackTableRowHeight = m_pLibrary->getTrackTableRowHeight(); + spinBoxRowHeight->setValue(m_iOriginalTrackTableRowHeight); + setLibraryFont(m_originalTrackTableFont); +} + +void DlgPrefLibrary::slotCancel() { + // Undo any changes in the library font or row height. + emit(setTrackTableRowHeight(m_iOriginalTrackTableRowHeight)); + emit(setTrackTableFont(m_originalTrackTableFont)); } void DlgPrefLibrary::slotAddDir() { @@ -279,5 +308,46 @@ void DlgPrefLibrary::slotApply() { m_pconfig->set(ConfigKey("[Library]","TrackLoadAction"), ConfigValue(dbclick_status)); + QFont font = m_pLibrary->getTrackTableFont(); + if (m_originalTrackTableFont != font) { + m_pconfig->set(ConfigKey("[Library]", "Font"), + ConfigValue(font.toString())); + } + + int rowHeight = spinBoxRowHeight->value(); + if (m_iOriginalTrackTableRowHeight != rowHeight) { + m_pconfig->set(ConfigKey("[Library]","RowHeight"), + ConfigValue(rowHeight)); + } + + // TODO(rryan): Don't save here. m_pconfig->Save(); } + +void DlgPrefLibrary::slotRowHeightValueChanged(int height) { + emit(setTrackTableRowHeight(height)); +} + +void DlgPrefLibrary::setLibraryFont(const QFont& font) { + libraryFont->setText(QString("%1 %2 %3pt").arg( + font.family(), font.styleName(), QString::number(font.pointSizeF()))); + emit(setTrackTableFont(font)); + + // Don't let the row height exceed the library height. + QFontMetrics metrics(font); + int fontHeight = metrics.height(); + if (fontHeight > spinBoxRowHeight->value()) { + spinBoxRowHeight->setValue(fontHeight); + } + spinBoxRowHeight->setMinimum(fontHeight); +} + +void DlgPrefLibrary::slotSelectFont() { + // False if the user cancels font selection. + bool ok = false; + QFont font = QFontDialog::getFont(&ok, m_pLibrary->getTrackTableFont(), + this, tr("Select Library Font")); + if (ok) { + setLibraryFont(font); + } +} diff --git a/src/dlgpreflibrary.h b/src/dlgpreflibrary.h index 786a19769420..3977812a62d7 100644 --- a/src/dlgpreflibrary.h +++ b/src/dlgpreflibrary.h @@ -20,6 +20,7 @@ #include #include +#include #include "ui_dlgpreflibrarydlg.h" #include "configobject.h" @@ -50,6 +51,7 @@ class DlgPrefLibrary : public DlgPreferencePage, public Ui::DlgPrefLibraryDlg { void slotHide(); void slotResetToDefaults(); void slotApply(); + void slotCancel(); // Dialog to browse for music file directory void slotAddDir(); @@ -63,13 +65,23 @@ class DlgPrefLibrary : public DlgPreferencePage, public Ui::DlgPrefLibraryDlg { void requestAddDir(QString dir); void requestRemoveDir(QString dir, Library::RemovalType removalType); void requestRelocateDir(QString currentDir, QString newDir); + void setTrackTableFont(const QFont& font); + void setTrackTableRowHeight(int rowHeight); + + private slots: + void slotRowHeightValueChanged(int); + void slotSelectFont(); private: void initialiseDirList(); + void setLibraryFont(const QFont& font); + QStandardItemModel m_dirListModel; ConfigObject* m_pconfig; - Library *m_pLibrary; + Library* m_pLibrary; bool m_baddedDirectory; + QFont m_originalTrackTableFont; + int m_iOriginalTrackTableRowHeight; }; #endif diff --git a/src/dlgpreflibrarydlg.ui b/src/dlgpreflibrarydlg.ui index 0020dc5ca0d9..07d910e158ba 100644 --- a/src/dlgpreflibrarydlg.ui +++ b/src/dlgpreflibrarydlg.ui @@ -7,7 +7,7 @@ 0 0 546 - 731 + 791 @@ -166,7 +166,27 @@ Miscellaneous - + + + + Library Font: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Library Row Height: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + false @@ -176,7 +196,14 @@ - + + + + Use relative paths for playlist export if possible + + + + Rescan library on start-up @@ -186,10 +213,33 @@ - - + + - Use relative paths for playlist export if possible + ... + + + + + + + px + + + 5 + + + 100 + + + 20 + + + + + + + true diff --git a/src/dlgrecording.cpp b/src/dlgrecording.cpp index 5a27a0d56354..ce08c62bf043 100644 --- a/src/dlgrecording.cpp +++ b/src/dlgrecording.cpp @@ -8,7 +8,7 @@ #include "widget/wtracktableview.h" DlgRecording::DlgRecording(QWidget* parent, ConfigObject* pConfig, - TrackCollection* pTrackCollection, + Library* pLibrary, TrackCollection* pTrackCollection, RecordingManager* pRecordingManager, MixxxKeyboard* pKeyboard) : QWidget(parent), m_pConfig(pConfig), @@ -26,6 +26,10 @@ DlgRecording::DlgRecording(QWidget* parent, ConfigObject* pConfig, this, SIGNAL(loadTrack(TrackPointer))); connect(m_pTrackTableView, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool)), this, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool))); + connect(pLibrary, SIGNAL(setTrackTableFont(QFont)), + m_pTrackTableView, SLOT(setTrackTableFont(QFont))); + connect(pLibrary, SIGNAL(setTrackTableRowHeight(int)), + m_pTrackTableView, SLOT(setTrackTableRowHeight(int))); connect(m_pRecordingManager, SIGNAL(isRecording(bool)), this, SLOT(slotRecordingEnabled(bool))); @@ -131,3 +135,11 @@ void DlgRecording::refreshLabel() { .arg(m_durationRecordedStr); label->setText(text); } + +void DlgRecording::setTrackTableFont(const QFont& font) { + m_pTrackTableView->setTrackTableFont(font); +} + +void DlgRecording::setTrackTableRowHeight(int rowHeight) { + m_pTrackTableView->setTrackTableRowHeight(rowHeight); +} diff --git a/src/dlgrecording.h b/src/dlgrecording.h index e794bbd01e6c..42adc6f52b20 100644 --- a/src/dlgrecording.h +++ b/src/dlgrecording.h @@ -5,6 +5,7 @@ #include "library/browse/browsetablemodel.h" #include "library/libraryview.h" #include "library/proxytrackmodel.h" +#include "library/library.h" #include "library/trackcollection.h" #include "mixxxkeyboard.h" #include "recording/recordingmanager.h" @@ -20,7 +21,7 @@ class DlgRecording : public QWidget, public Ui::DlgRecording, public virtual Lib Q_OBJECT public: DlgRecording(QWidget *parent, ConfigObject* pConfig, - TrackCollection* pTrackCollection, + Library* pLibrary, TrackCollection* pTrackCollection, RecordingManager* pRecManager, MixxxKeyboard* pKeyboard); virtual ~DlgRecording(); @@ -38,6 +39,8 @@ class DlgRecording : public QWidget, public Ui::DlgRecording, public virtual Lib void refreshBrowseModel(); void slotRestoreSearch(); void slotDurationRecorded(QString durationRecorded); + void setTrackTableFont(const QFont& font); + void setTrackTableRowHeight(int rowHeight); signals: void loadTrack(TrackPointer tio); diff --git a/src/library/analysisfeature.cpp b/src/library/analysisfeature.cpp index e7aeb44701fb..886b354dc3ec 100644 --- a/src/library/analysisfeature.cpp +++ b/src/library/analysisfeature.cpp @@ -59,10 +59,10 @@ QIcon AnalysisFeature::getIcon() { } void AnalysisFeature::bindWidget(WLibrary* libraryWidget, - MixxxKeyboard* keyboard) { + MixxxKeyboard* keyboard) { m_pAnalysisView = new DlgAnalysis(libraryWidget, - m_pConfig, - m_pTrackCollection); + m_pConfig, + m_pTrackCollection); connect(m_pAnalysisView, SIGNAL(loadTrack(TrackPointer)), this, SIGNAL(loadTrack(TrackPointer))); connect(m_pAnalysisView, SIGNAL(loadTrackToPlayer(TrackPointer, QString)), diff --git a/src/library/autodj/autodjfeature.cpp b/src/library/autodj/autodjfeature.cpp index c862a8866015..a141140a00c4 100644 --- a/src/library/autodj/autodjfeature.cpp +++ b/src/library/autodj/autodjfeature.cpp @@ -10,6 +10,7 @@ #include "library/autodj/autodjfeature.h" +#include "library/library.h" #include "library/parser.h" #include "playermanager.h" #include "library/autodj/autodjprocessor.h" @@ -23,12 +24,13 @@ const QString AutoDJFeature::m_sAutoDJViewName = QString("Auto DJ"); -AutoDJFeature::AutoDJFeature(QObject* parent, +AutoDJFeature::AutoDJFeature(Library* pLibrary, ConfigObject* pConfig, PlayerManagerInterface* pPlayerManager, TrackCollection* pTrackCollection) - : LibraryFeature(parent), + : LibraryFeature(pLibrary), m_pConfig(pConfig), + m_pLibrary(pLibrary), m_pTrackCollection(pTrackCollection), m_crateDao(pTrackCollection->getCrateDAO()), m_playlistDao(pTrackCollection->getPlaylistDAO()), @@ -106,6 +108,7 @@ void AutoDJFeature::bindWidget(WLibrary* libraryWidget, MixxxKeyboard* keyboard) { m_pAutoDJView = new DlgAutoDJ(libraryWidget, m_pConfig, + m_pLibrary, m_pAutoDJProcessor, m_pTrackCollection, keyboard); diff --git a/src/library/autodj/autodjfeature.h b/src/library/autodj/autodjfeature.h index d48027333f9a..f00ef68affdf 100644 --- a/src/library/autodj/autodjfeature.h +++ b/src/library/autodj/autodjfeature.h @@ -19,12 +19,13 @@ #include "library/libraryfeature.h" #include "configobject.h" #include "library/treeitemmodel.h" -#include "dlgautodj.h" #ifdef __AUTODJCRATES__ #include "library/dao/autodjcratesdao.h" #endif // __AUTODJCRATES__ +class DlgAutoDJ; +class Library; class PlayerManagerInterface; class TrackCollection; class AutoDJProcessor; @@ -32,7 +33,7 @@ class AutoDJProcessor; class AutoDJFeature : public LibraryFeature { Q_OBJECT public: - AutoDJFeature(QObject* parent, + AutoDJFeature(Library* pLibrary, ConfigObject* pConfig, PlayerManagerInterface* pPlayerManager, TrackCollection* pTrackCollection); @@ -59,6 +60,7 @@ class AutoDJFeature : public LibraryFeature { private: ConfigObject* m_pConfig; + Library* m_pLibrary; TrackCollection* m_pTrackCollection; CrateDAO& m_crateDao; PlaylistDAO& m_playlistDao; diff --git a/src/library/library.cpp b/src/library/library.cpp index cc9cdb2f6a62..7caa9b147f63 100644 --- a/src/library/library.cpp +++ b/src/library/library.cpp @@ -38,13 +38,16 @@ // WLibrary const QString Library::m_sTrackViewName = QString("WTrackTableView"); +// The default row height of the library. +const int Library::kDefaultRowHeightPx = 20; + Library::Library(QObject* parent, ConfigObject* pConfig, PlayerManagerInterface* pPlayerManager, RecordingManager* pRecordingManager) : m_pConfig(pConfig), m_pSidebarModel(new SidebarModel(parent)), m_pTrackCollection(new TrackCollection(pConfig)), - m_pLibraryControl(new LibraryControl), + m_pLibraryControl(new LibraryControl(this)), m_pRecordingManager(pRecordingManager) { qRegisterMetaType("Library::RemovalType"); @@ -108,6 +111,16 @@ Library::Library(QObject* parent, ConfigObject* pConfig, bool hasAccess = Sandbox::askForAccess(directory.canonicalFilePath()); qDebug() << "Checking for access to" << directoryPath << ":" << hasAccess; } + + m_iTrackTableRowHeight = m_pConfig->getValueString( + ConfigKey("[Library]", "RowHeight"), + QString::number(kDefaultRowHeightPx)).toInt(); + QString fontStr = m_pConfig->getValueString(ConfigKey("[Library]", "Font")); + if (!fontStr.isEmpty()) { + m_trackTableFont.fromString(fontStr); + } else { + m_trackTableFont = QApplication::font(); + } } Library::~Library() { @@ -145,6 +158,10 @@ void Library::bindSidebarWidget(WLibrarySidebar* pSidebarWidget) { connect(pSidebarWidget, SIGNAL(rightClicked(const QPoint&, const QModelIndex&)), m_pSidebarModel, SLOT(rightClicked(const QPoint&, const QModelIndex&))); + + pSidebarWidget->slotSetFont(m_trackTableFont); + connect(this, SIGNAL(setTrackTableFont(QFont)), + pSidebarWidget, SLOT(slotSetFont(QFont))); } void Library::bindWidget(WLibrary* pLibraryWidget, @@ -166,6 +183,11 @@ void Library::bindWidget(WLibrary* pLibraryWidget, connect(pTrackTableView, SIGNAL(trackSelected(TrackPointer)), this, SIGNAL(trackSelected(TrackPointer))); + connect(this, SIGNAL(setTrackTableFont(QFont)), + pTrackTableView, SLOT(setTrackTableFont(QFont))); + connect(this, SIGNAL(setTrackTableRowHeight(int)), + pTrackTableView, SLOT(setTrackTableRowHeight(int))); + m_pLibraryControl->bindWidget(pLibraryWidget, pKeyboard); QListIterator feature_it(m_features); @@ -173,6 +195,11 @@ void Library::bindWidget(WLibrary* pLibraryWidget, LibraryFeature* feature = feature_it.next(); feature->bindWidget(pLibraryWidget, pKeyboard); } + + // Set the current font and row height on all the WTrackTableViews that were + // just connected to us. + emit(setTrackTableFont(m_trackTableFont)); + emit(setTrackTableRowHeight(m_iTrackTableRowHeight)); } void Library::addFeature(LibraryFeature* feature) { @@ -330,3 +357,13 @@ void Library::slotRequestRelocateDir(QString oldDir, QString newDir) { QStringList Library::getDirs() { return m_pTrackCollection->getDirectoryDAO().getDirs(); } + +void Library::slotSetTrackTableFont(const QFont& font) { + m_trackTableFont = font; + emit(setTrackTableFont(font)); +} + +void Library::slotSetTrackTableRowHeight(int rowHeight) { + m_iTrackTableRowHeight = rowHeight; + emit(setTrackTableRowHeight(rowHeight)); +} diff --git a/src/library/library.h b/src/library/library.h index cf33b4fe3dcc..57332302ab45 100644 --- a/src/library/library.h +++ b/src/library/library.h @@ -10,6 +10,7 @@ #include #include #include +#include #include "configobject.h" #include "trackinfoobject.h" @@ -56,6 +57,14 @@ class Library : public QObject { return m_pTrackCollection; } + inline int getTrackTableRowHeight() const { + return m_iTrackTableRowHeight; + } + + inline const QFont& getTrackTableFont() const { + return m_trackTableFont; + } + //static Library* buildDefaultLibrary(); enum RemovalType { @@ -64,6 +73,8 @@ class Library : public QObject { PurgeTracks }; + static const int kDefaultRowHeightPx; + public slots: void slotShowTrackModel(QAbstractItemModel* model); void slotSwitchToView(const QString& view); @@ -78,6 +89,8 @@ class Library : public QObject { void slotRequestRemoveDir(QString directory, Library::RemovalType removalType); void slotRequestRelocateDir(QString previousDirectory, QString newDirectory); void onSkinLoadFinished(); + void slotSetTrackTableFont(const QFont& font); + void slotSetTrackTableRowHeight(int rowHeight); signals: void showTrackModel(QAbstractItemModel* model); @@ -92,6 +105,9 @@ class Library : public QObject { void enableCoverArtDisplay(bool); void trackSelected(TrackPointer pTrack); + void setTrackTableFont(const QFont& font); + void setTrackTableRowHeight(int rowHeight); + private: ConfigObject* m_pConfig; SidebarModel* m_pSidebarModel; @@ -105,6 +121,8 @@ class Library : public QObject { AnalysisFeature* m_pAnalysisFeature; LibraryControl* m_pLibraryControl; RecordingManager* m_pRecordingManager; + QFont m_trackTableFont; + int m_iTrackTableRowHeight; }; #endif /* LIBRARY_H */ diff --git a/src/library/librarycontrol.cpp b/src/library/librarycontrol.cpp index db95f0ce9b50..b5c44953af3f 100644 --- a/src/library/librarycontrol.cpp +++ b/src/library/librarycontrol.cpp @@ -11,6 +11,7 @@ #include "playermanager.h" #include "widget/wlibrary.h" #include "widget/wlibrarysidebar.h" +#include "library/library.h" #include "library/libraryview.h" #include "util/container.h" @@ -46,8 +47,9 @@ void LoadToGroupController::slotLoadToGroupAndPlay(double v) { } } -LibraryControl::LibraryControl(QObject* pParent) - : QObject(pParent), +LibraryControl::LibraryControl(Library* pLibrary) + : QObject(pLibrary), + m_pLibrary(pLibrary), m_pLibraryWidget(NULL), m_pSidebarWidget(NULL), m_numDecks("[Master]", "num_decks"), @@ -64,8 +66,7 @@ LibraryControl::LibraryControl(QObject* pParent) connect(&m_numPreviewDecks, SIGNAL(valueChanged(double)), this, SLOT(slotNumPreviewDecksChanged(double))); - // Make controls for library navigation and track loading. Leaking all these - // CO's, but oh well? + // Make controls for library navigation and track loading. m_pSelectNextTrack = new ControlPushButton(ConfigKey("[Playlist]", "SelectNextTrack")); connect(m_pSelectNextTrack, SIGNAL(valueChanged(double)), @@ -101,7 +102,21 @@ LibraryControl::LibraryControl(QObject* pParent) connect(m_pLoadSelectedIntoFirstStopped, SIGNAL(valueChanged(double)), this, SLOT(slotLoadSelectedIntoFirstStopped(double))); - + // Ignoring no-ops is important since this is for +/- tickers. + m_pFontSizeKnob = new ControlObject( + ConfigKey("[Library]", "font_size_knob"), false); + connect(m_pFontSizeKnob, SIGNAL(valueChanged(double)), + this, SLOT(slotFontSize(double))); + + m_pFontSizeDecrement = new ControlPushButton( + ConfigKey("[Library]", "font_size_decrement")); + connect(m_pFontSizeDecrement, SIGNAL(valueChanged(double)), + this, SLOT(slotDecrementFontSize(double))); + + m_pFontSizeIncrement = new ControlPushButton( + ConfigKey("[Library]", "font_size_increment")); + connect(m_pFontSizeIncrement, SIGNAL(valueChanged(double)), + this, SLOT(slotIncrementFontSize(double))); } LibraryControl::~LibraryControl() { @@ -277,3 +292,24 @@ void LibraryControl::slotToggleSelectedSidebarItem(double v) { m_pSidebarWidget->toggleSelectedItem(); } } + +void LibraryControl::slotFontSize(double v) { + if (v == 0.0) { + return; + } + QFont font = m_pLibrary->getTrackTableFont(); + font.setPointSizeF(font.pointSizeF() + v); + m_pLibrary->slotSetTrackTableFont(font); +} + +void LibraryControl::slotIncrementFontSize(double v) { + if (v > 0.0) { + slotFontSize(1); + } +} + +void LibraryControl::slotDecrementFontSize(double v) { + if (v > 0.0) { + slotFontSize(-1); + } +} diff --git a/src/library/librarycontrol.h b/src/library/librarycontrol.h index 6df47dad07dc..4731488987ab 100644 --- a/src/library/librarycontrol.h +++ b/src/library/librarycontrol.h @@ -6,6 +6,8 @@ #include "controlobjectthread.h" class ControlObject; +class ControlPushButton; +class Library; class WLibrary; class WLibrarySidebar; class MixxxKeyboard; @@ -32,7 +34,7 @@ class LoadToGroupController : public QObject { class LibraryControl : public QObject { Q_OBJECT public: - LibraryControl(QObject* pParent=NULL); + LibraryControl(Library* pLibrary); virtual ~LibraryControl(); void bindWidget(WLibrary* pLibrary, MixxxKeyboard* pKeyboard); @@ -56,7 +58,13 @@ class LibraryControl : public QObject { void slotNumSamplersChanged(double v); void slotNumPreviewDecksChanged(double v); + void slotFontSize(double v); + void slotIncrementFontSize(double v); + void slotDecrementFontSize(double v); + private: + Library* m_pLibrary; + ControlObject* m_pSelectNextTrack; ControlObject* m_pSelectPrevTrack; ControlObject* m_pSelectTrack; @@ -68,6 +76,10 @@ class LibraryControl : public QObject { ControlObject* m_pToggleSidebarItem; ControlObject* m_pLoadSelectedIntoFirstStopped; + ControlObject* m_pFontSizeKnob; + ControlPushButton* m_pFontSizeIncrement; + ControlPushButton* m_pFontSizeDecrement; + WLibrary* m_pLibraryWidget; WLibrarySidebar* m_pSidebarWidget; ControlObjectThread m_numDecks; diff --git a/src/library/mixxxlibraryfeature.cpp b/src/library/mixxxlibraryfeature.cpp index bacbfd74e563..bba2b00b9f4d 100644 --- a/src/library/mixxxlibraryfeature.cpp +++ b/src/library/mixxxlibraryfeature.cpp @@ -6,6 +6,7 @@ #include "library/mixxxlibraryfeature.h" #include "library/parser.h" +#include "library/library.h" #include "library/basetrackcache.h" #include "library/librarytablemodel.h" #include "library/missingtablemodel.h" @@ -16,13 +17,16 @@ #include "soundsourceproxy.h" #include "widget/wlibrary.h" #include "util/dnd.h" +#include "dlghidden.h" +#include "dlgmissing.h" -MixxxLibraryFeature::MixxxLibraryFeature(QObject* parent, +MixxxLibraryFeature::MixxxLibraryFeature(Library* pLibrary, TrackCollection* pTrackCollection, ConfigObject* pConfig) - : LibraryFeature(parent), + : LibraryFeature(pLibrary), kMissingTitle(tr("Missing Tracks")), kHiddenTitle(tr("Hidden Tracks")), + m_pLibrary(pLibrary), m_pMissingView(NULL), m_pHiddenView(NULL), m_trackDao(pTrackCollection->getTrackDAO()), @@ -118,19 +122,17 @@ MixxxLibraryFeature::~MixxxLibraryFeature() { delete m_pLibraryTableModel; } -void MixxxLibraryFeature::bindWidget(WLibrary* pLibrary, +void MixxxLibraryFeature::bindWidget(WLibrary* pLibraryWidget, MixxxKeyboard* pKeyboard) { - m_pHiddenView = new DlgHidden(pLibrary, - m_pConfig, m_pTrackCollection, - pKeyboard); - pLibrary->registerView(kHiddenTitle, m_pHiddenView); + m_pHiddenView = new DlgHidden(pLibraryWidget, m_pConfig, m_pLibrary, + m_pTrackCollection, pKeyboard); + pLibraryWidget->registerView(kHiddenTitle, m_pHiddenView); connect(m_pHiddenView, SIGNAL(trackSelected(TrackPointer)), this, SIGNAL(trackSelected(TrackPointer))); - m_pMissingView = new DlgMissing(pLibrary, - m_pConfig, m_pTrackCollection, - pKeyboard); - pLibrary->registerView(kMissingTitle, m_pMissingView); + m_pMissingView = new DlgMissing(pLibraryWidget, m_pConfig, m_pLibrary, + m_pTrackCollection, pKeyboard); + pLibraryWidget->registerView(kMissingTitle, m_pMissingView); connect(m_pMissingView, SIGNAL(trackSelected(TrackPointer)), this, SIGNAL(trackSelected(TrackPointer))); } diff --git a/src/library/mixxxlibraryfeature.h b/src/library/mixxxlibraryfeature.h index 38cbc0864ab6..01604b5d424f 100644 --- a/src/library/mixxxlibraryfeature.h +++ b/src/library/mixxxlibraryfeature.h @@ -18,10 +18,10 @@ #include "library/dao/trackdao.h" #include "treeitemmodel.h" #include "configobject.h" -#include "dlghidden.h" -#include "dlgmissing.h" - +class DlgHidden; +class DlgMissing; +class Library; class BaseTrackCache; class LibraryTableModel; class TrackCollection; @@ -29,7 +29,7 @@ class TrackCollection; class MixxxLibraryFeature : public LibraryFeature { Q_OBJECT public: - MixxxLibraryFeature(QObject* parent, + MixxxLibraryFeature(Library* pLibrary, TrackCollection* pTrackCollection, ConfigObject* pConfig); virtual ~MixxxLibraryFeature(); @@ -50,6 +50,7 @@ class MixxxLibraryFeature : public LibraryFeature { private: const QString kMissingTitle; const QString kHiddenTitle; + Library* m_pLibrary; QSharedPointer m_pBaseTrackCache; LibraryTableModel* m_pLibraryTableModel; DlgMissing* m_pMissingView; diff --git a/src/library/recording/recordingfeature.cpp b/src/library/recording/recordingfeature.cpp index 3021384df91f..5f8dcfd5116d 100644 --- a/src/library/recording/recordingfeature.cpp +++ b/src/library/recording/recordingfeature.cpp @@ -5,17 +5,20 @@ #include "trackinfoobject.h" #include "library/treeitem.h" #include "library/recording/recordingfeature.h" +#include "library/library.h" #include "library/trackcollection.h" #include "widget/wlibrary.h" #include "mixxxkeyboard.h" const QString RecordingFeature::m_sRecordingViewName = QString("Recording"); -RecordingFeature::RecordingFeature(QObject* parent, ConfigObject* pConfig, +RecordingFeature::RecordingFeature(Library* pLibrary, + ConfigObject* pConfig, TrackCollection* pTrackCollection, RecordingManager* pRecordingManager) - : LibraryFeature(parent), + : LibraryFeature(pLibrary), m_pConfig(pConfig), + m_pLibrary(pLibrary), m_pTrackCollection(pTrackCollection), m_pRecordingManager(pRecordingManager) { } @@ -35,17 +38,18 @@ QIcon RecordingFeature::getIcon() { TreeItemModel* RecordingFeature::getChildModel() { return &m_childModel; } -void RecordingFeature::bindWidget(WLibrary *libraryWidget, +void RecordingFeature::bindWidget(WLibrary* pLibraryWidget, MixxxKeyboard *keyboard) { //The view will be deleted by LibraryWidget - DlgRecording* pRecordingView = new DlgRecording(libraryWidget, - m_pConfig, - m_pTrackCollection, - m_pRecordingManager, - keyboard); + DlgRecording* pRecordingView = new DlgRecording(pLibraryWidget, + m_pConfig, + m_pLibrary, + m_pTrackCollection, + m_pRecordingManager, + keyboard); pRecordingView->installEventFilter(keyboard); - libraryWidget->registerView(m_sRecordingViewName, pRecordingView); + pLibraryWidget->registerView(m_sRecordingViewName, pRecordingView); connect(pRecordingView, SIGNAL(loadTrack(TrackPointer)), this, SIGNAL(loadTrack(TrackPointer))); connect(pRecordingView, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool)), diff --git a/src/library/recording/recordingfeature.h b/src/library/recording/recordingfeature.h index 66b08358e293..1f2c9da6f252 100644 --- a/src/library/recording/recordingfeature.h +++ b/src/library/recording/recordingfeature.h @@ -14,15 +14,16 @@ #include "library/proxytrackmodel.h" #include "recording/recordingmanager.h" +class Library; class TrackCollection; class RecordingFeature : public LibraryFeature { Q_OBJECT public: - RecordingFeature(QObject* parent, - ConfigObject* pConfig, - TrackCollection* pTrackCollection, - RecordingManager* pRecordingManager); + RecordingFeature(Library* parent, + ConfigObject* pConfig, + TrackCollection* pTrackCollection, + RecordingManager* pRecordingManager); virtual ~RecordingFeature(); QVariant title(); @@ -43,6 +44,7 @@ class RecordingFeature : public LibraryFeature { private: ConfigObject* m_pConfig; + Library* m_pLibrary; TrackCollection* m_pTrackCollection; FolderTreeModel m_childModel; const static QString m_sRecordingViewName; diff --git a/src/mixxx.cpp b/src/mixxx.cpp index 3dae6d996ccf..d10bad25dce4 100644 --- a/src/mixxx.cpp +++ b/src/mixxx.cpp @@ -75,6 +75,7 @@ #include "waveform/guitick.h" #include "util/math.h" #include "util/experiment.h" +#include "util/font.h" #ifdef __VINYLCONTROL__ #include "vinylcontrol/defs_vinylcontrol.h" @@ -130,6 +131,8 @@ MixxxMainWindow::MixxxMainWindow(QApplication* pApp, const CmdlineArgs& args) QString resourcePath = m_pConfig->getResourcePath(); initializeTranslations(pApp); + initializeFonts(); + // Set the visibility of tooltips, default "1" = ON m_toolTipsCfg = m_pConfig->getValueString(ConfigKey("[Controls]", "Tooltips"), "1").toInt(); @@ -671,6 +674,28 @@ void MixxxMainWindow::initializeWindow() { setWindowIcon(QIcon(":/images/ic_mixxx_window.png")); } +void MixxxMainWindow::initializeFonts() { + QDir fontsDir(m_pConfig->getResourcePath()); + if (!fontsDir.cd("fonts")) { + return; + } + + QList files = fontsDir.entryInfoList( + QDir::NoDotAndDotDot | QDir::Files | QDir::Readable); + foreach (const QFileInfo& file, files) { + const QString& path = file.filePath(); + + // Skip text files (e.g. license files). For all others we let Qt tell + // us whether the font format is supported since there is no way to + // check other than adding. + if (path.endsWith(".txt", Qt::CaseInsensitive)) { + continue; + } + + FontUtils::addFont(path); + } +} + void MixxxMainWindow::initializeTranslations(QApplication* pApp) { QString resourcePath = m_pConfig->getResourcePath(); QString translationsFolder = resourcePath + "translations/"; diff --git a/src/mixxx.h b/src/mixxx.h index 45cd8eb64be3..487e5cd74d8a 100644 --- a/src/mixxx.h +++ b/src/mixxx.h @@ -156,6 +156,7 @@ class MixxxMainWindow : public QMainWindow { void initializeWindow(); void initializeKeyboard(); void initializeTranslations(QApplication* pApp); + void initializeFonts(); bool loadTranslations(const QLocale& systemLocale, QString userLocale, const QString& translation, const QString& prefix, const QString& translationPath, QTranslator* pTranslator); diff --git a/src/util/font.h b/src/util/font.h new file mode 100644 index 000000000000..906b61e19449 --- /dev/null +++ b/src/util/font.h @@ -0,0 +1,45 @@ +#ifndef FONT_H +#define FONT_H + +#include +#include +#include + +#include "util/cmdlineargs.h" + +class FontUtils { + public: + static bool addFont(const QString& path) { + int result = QFontDatabase::addApplicationFont(path); + if (result == -1) { + qWarning() << "Failed to add font:" << path; + return false; + } + + // In developer mode, spit out all the families / styles / sizes + // supported by the new font. + if (CmdlineArgs::Instance().getDeveloper()) { + QFontDatabase database; + QStringList families = QFontDatabase::applicationFontFamilies(result); + foreach (const QString& family, families) { + QStringList styles = database.styles(family); + foreach (const QString& style, styles) { + QList pointSizes = database.pointSizes(family, style); + QStringList pointSizesStr; + foreach (int point, pointSizes) { + pointSizesStr.append(QString::number(point)); + } + qDebug() << "FONT LOADED family:" << family + << "style:" << style + << "point sizes:" << pointSizesStr.join(","); + } + } + } + return true; + } + + private: + FontUtils() {} +}; + +#endif /* FONT_H */ diff --git a/src/widget/wlibrarysidebar.cpp b/src/widget/wlibrarysidebar.cpp index 8ba2088b1650..cccef4169344 100644 --- a/src/widget/wlibrarysidebar.cpp +++ b/src/widget/wlibrarysidebar.cpp @@ -208,3 +208,7 @@ bool WLibrarySidebar::event(QEvent* pEvent) { } return QTreeView::event(pEvent); } + +void WLibrarySidebar::slotSetFont(const QFont& font) { + setFont(font); +} diff --git a/src/widget/wlibrarysidebar.h b/src/widget/wlibrarysidebar.h index a301febed81b..6c8c538cdebe 100644 --- a/src/widget/wlibrarysidebar.h +++ b/src/widget/wlibrarysidebar.h @@ -30,6 +30,7 @@ class WLibrarySidebar : public QTreeView, public WBaseWidget { public slots: void selectIndex(const QModelIndex&); + void slotSetFont(const QFont& font); signals: void rightClicked(const QPoint&, const QModelIndex&); diff --git a/src/widget/wlibrarytableview.cpp b/src/widget/wlibrarytableview.cpp index a3ec6c9dec6e..192092b14f27 100644 --- a/src/widget/wlibrarytableview.cpp +++ b/src/widget/wlibrarytableview.cpp @@ -4,10 +4,12 @@ #include #include #include +#include #include "widget/wwidget.h" #include "widget/wskincolor.h" #include "widget/wlibrarytableview.h" +#include "util/math.h" WLibraryTableView::WLibraryTableView(QWidget* parent, ConfigObject* pConfig, @@ -37,8 +39,6 @@ WLibraryTableView::WLibraryTableView(QWidget* parent, setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); verticalHeader()->hide(); - int rowHeight = m_pConfig->getValueString(ConfigKey("[Library]","RowHeight"), "20").toInt(); - verticalHeader()->setDefaultSectionSize(rowHeight); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); setAlternatingRowColors(true); @@ -110,3 +110,14 @@ void WLibraryTableView::moveSelection(int delta) { } } +void WLibraryTableView::setTrackTableFont(const QFont& font) { + setFont(font); + setTrackTableRowHeight(verticalHeader()->defaultSectionSize()); +} + +void WLibraryTableView::setTrackTableRowHeight(int rowHeight) { + QFontMetrics metrics(font()); + int fontHeightPx = metrics.height(); + verticalHeader()->setDefaultSectionSize(math_max( + rowHeight, fontHeightPx)); +} diff --git a/src/widget/wlibrarytableview.h b/src/widget/wlibrarytableview.h index 66bb303b9833..7277604c8f7b 100644 --- a/src/widget/wlibrarytableview.h +++ b/src/widget/wlibrarytableview.h @@ -6,6 +6,7 @@ #include #include +#include #include "configobject.h" #include "library/libraryview.h" @@ -34,6 +35,8 @@ class WLibraryTableView : public QTableView, public virtual LibraryView { public slots: void saveVScrollBarPos(); void restoreVScrollBarPos(); + void setTrackTableFont(const QFont& font); + void setTrackTableRowHeight(int rowHeight); private: void loadVScrollBarPosState();