| 1 | /* |
| 2 | Copyright (C) 2005-2014 Mario Stephan <[email protected]> |
| 3 | |
| 4 | This library is free software; you can redistribute it and/or modify |
| 5 | it under the terms of the GNU Lesser General Public License as published |
| 6 | by the Free Software Foundation; either version 2.1 of the License, or |
| 7 | (at your option) any later version. |
| 8 | |
| 9 | This program is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | GNU General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public License |
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | |
| 18 | #include "djwidget.h"cxx . . $ `<file>/src/djwidget.h`/ |
| 19 | #include "ui_djwidget.h"cxx . . $ `<file>/src/ui_djwidget.h`/ |
| 20 | |
| 21 | #include <QMouseEvent> |
| 22 | #include <QSettings> |
| 23 | #include <QTimer> |
| 24 | #include <qdebug.h> |
| 25 | |
| 26 | struct DjWidgetPrivatecxx . . $ DjWidgetPrivate# { |
| 27 | Djcxx . . $ Dj#* djcxx . . $ DjWidgetPrivate#dj.; |
| 28 | bool isActivecxx . . $ DjWidgetPrivate#isActive.; |
| 29 | QTimercxx . . $ QTimer#* timerSlidecxx . . $ DjWidgetPrivate#timerSlide.; |
| 30 | int targetWidthcxx . . $ DjWidgetPrivate#targetWidth.; |
| 31 | }; |
| 32 | |
| 33 | DjWidgetcxx . . $ DjWidget#::DjWidgetcxx . . $ DjWidget#DjWidget(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget#* parent) |
| 34 | : QWidgetcxx . . $ QWidget#QWidget(872e7b0c281abd8d).(parent) |
| 35 | , uicxx . . $ DjWidget#ui.(new Uicxx . . $ Ui/::DjWidgetcxx . . $ Ui/DjWidget#) |
| 36 | , pcxx . . $ DjWidget#p.(new DjWidgetPrivatecxx . . $ DjWidgetPrivate#) |
| 37 | { |
| 38 | setFocusPolicycxx . . $ QWidget#setFocusPolicy(84f385f4ea7c1696).(Qtcxx . . $ Qt/::ClickFocuscxx . . $ Qt/ClickFocus.); |
| 39 | uicxx . . $ DjWidget#ui.->setupUicxx . . $ Ui_DjWidget#setupUi(108f35f7aa7f3cf9).(this); |
| 40 | uicxx . . $ DjWidget#ui.->lblDesciptioncxx . . $ Ui_DjWidget#lblDesciption.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).(QStringcxx . . $ QString#QString(ee6b7ef95d0103b6).::nullcxx . . $ QString#null.); |
| 41 | uicxx . . $ DjWidget#ui.->widgetClosecxx . . $ Ui_DjWidget#widgetClose.->setMinimumWidthcxx . . $ QWidget#setMinimumWidth(d4f767463ce0a6b3).(0); |
| 42 | uicxx . . $ DjWidget#ui.->widgetClosecxx . . $ Ui_DjWidget#widgetClose.->setMaximumWidthcxx . . $ QWidget#setMaximumWidth(d4f767463ce0a6b3).(0); |
| 43 | |
| 44 | QFontcxx . . $ QFont# font = uicxx . . $ QFont#QFont(d0a4bd0c8524b912).->lblDesciptioncxx . . $ Ui_DjWidget#lblDesciption.->fontcxx . . $ QWidget#font(c5040538afc47120).(); |
| 45 | #if defined(Q_OS_DARWIN) |
| 46 | int newSize = font.pointSize() - 4; |
| 47 | #else |
| 48 | int newSize = font.pointSizecxx . . $ QFont#pointSize(455f465bc33b4cdf).() - 1; |
| 49 | #endif |
| 50 | font.setPointSizecxx . . $ QFont#setPointSize(d4f767463ce0a6b3).(newSize); |
| 51 | uicxx . . $ DjWidget#ui.->lblDesciptioncxx . . $ Ui_DjWidget#lblDesciption.->setFontcxx . . $ QWidget#setFont(d0a4bd0c8524b912).(font); |
| 52 | |
| 53 | pcxx . . $ DjWidget#p.->timerSlidecxx . . $ DjWidgetPrivate#timerSlide. = new QTimercxx . . $ QTimer#QTimer(749de1b6ae65bddd).(this); |
| 54 | pcxx . . $ DjWidget#p.->timerSlidecxx . . $ DjWidgetPrivate#timerSlide.->setIntervalcxx . . $ QTimer#setInterval(d4f767463ce0a6b3).(10); |
| 55 | connectcxx . . $ QObject#connect(f4332061c7e4ca89).(pcxx . . $ DjWidget#p.->timerSlidecxx . . $ DjWidgetPrivate#timerSlide., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(timeout()), SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(timerSlide_timeOut())); |
| 56 | } |
| 57 | |
| 58 | DjWidgetcxx . . $ DjWidget#::~cxx . . $ DjWidget#`~DjWidget`(ced63f7c635d850d).DjWidgetcxx . . $ DjWidget#() |
| 59 | { |
| 60 | delete uicxx . . $ DjWidget#ui.; |
| 61 | delete pcxx . . $ DjWidget#p.; |
| 62 | } |
| 63 | |
| 64 | void DjWidgetcxx . . $ DjWidget#::changeEventcxx . . $ DjWidget#changeEvent(c2473e2e70986fd7).(QEventcxx . . $ QEvent#* event) |
| 65 | { |
| 66 | QWidgetcxx . . $ QWidget#::changeEventcxx . . $ QWidget#changeEvent(c2473e2e70986fd7).(event); |
| 67 | switch (event->typecxx . . $ QEvent#type(916a8de57f4d422b).()) { |
| 68 | case QEventcxx . . $ QEvent#::LanguageChangecxx . . $ QEvent#LanguageChange.: |
| 69 | uicxx . . $ DjWidget#ui.->retranslateUicxx . . $ Ui_DjWidget#retranslateUi(108f35f7aa7f3cf9).(this); |
| 70 | break; |
| 71 | default: |
| 72 | break; |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | void DjWidgetcxx . . $ DjWidget#::mousePressEventcxx . . $ DjWidget#mousePressEvent(702858a82d06265c).(QMouseEventcxx . . $ QMouseEvent#* event) |
| 77 | { |
| 78 | |
| 79 | if (uicxx . . $ DjWidget#ui.->widgetClosecxx . . $ Ui_DjWidget#widgetClose.->geometrycxx . . $ QWidget#geometry(f4023511c62cad66).().containscxx . . $ QRect#contains(eaee943b37977784).(event->poscxx . . $ QMouseEvent#pos(75d69cfbd3c4b2dd).())) { |
| 80 | Q_EMITcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:95:10`! deletedcxx . . $ DjWidget#deleted(49f6e7a06ebc5aa8).(); |
| 81 | } else { |
| 82 | slideCloseWidgetcxx . . $ DjWidget#slideCloseWidget(b45ddcbc8423892c).(false); |
| 83 | Q_EMITcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:95:10`! activatedcxx . . $ DjWidget#activated(49f6e7a06ebc5aa8).(); |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | void DjWidgetcxx . . $ DjWidget#::setDjcxx . . $ DjWidget#setDj(2e881ee79eb0ae9e).(Djcxx . . $ Dj#* dj) |
| 88 | { |
| 89 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). Q_FUNC_INFOcxx . . $ `<external>/4507883856836070869/qcompilerdetection.h:240:11`!; |
| 90 | pcxx . . $ DjWidget#p.->djcxx . . $ DjWidgetPrivate#dj. = dj; |
| 91 | |
| 92 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(pcxx . . $ DjWidget#p.->djcxx . . $ DjWidgetPrivate#dj., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(countChanged()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(updateView())); |
| 93 | deactivateDJcxx . . $ DjWidget#deactivateDJ(49f6e7a06ebc5aa8).(); |
| 94 | } |
| 95 | |
| 96 | Djcxx . . $ Dj#* DjWidgetcxx . . $ DjWidget#::djcxx . . $ DjWidget#dj(e9895b3307cb1926).() |
| 97 | { |
| 98 | return pcxx . . $ DjWidget#p.->djcxx . . $ DjWidgetPrivate#dj.; |
| 99 | } |
| 100 | |
| 101 | // auto connect slot |
| 102 | void DjWidgetcxx . . $ DjWidget#::on_lblName_linkActivatedcxx . . $ DjWidget#on_lblName_linkActivated(3520e46b33348bf6).(const QStringcxx . . $ QString#& link) |
| 103 | { |
| 104 | Q_UNUSEDcxx . . $ `<external>/15045578679651060896/qglobal.h:117:9`!(link); |
| 105 | Q_EMITcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:95:10`! activatedcxx . . $ DjWidget#activated(49f6e7a06ebc5aa8).(); |
| 106 | } |
| 107 | |
| 108 | void DjWidgetcxx . . $ DjWidget#::clickedcxx . . $ DjWidget#clicked(49f6e7a06ebc5aa8).() |
| 109 | { |
| 110 | Q_EMITcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:95:10`! activatedcxx . . $ DjWidget#activated(49f6e7a06ebc5aa8).(); |
| 111 | } |
| 112 | |
| 113 | void DjWidgetcxx . . $ DjWidget#::activateDJcxx . . $ DjWidget#activateDJ(49f6e7a06ebc5aa8).() |
| 114 | { |
| 115 | pcxx . . $ DjWidget#p.->isActivecxx . . $ DjWidgetPrivate#isActive. = true; |
| 116 | updateViewcxx . . $ DjWidget#updateView(49f6e7a06ebc5aa8).(); |
| 117 | } |
| 118 | |
| 119 | void DjWidgetcxx . . $ DjWidget#::deactivateDJcxx . . $ DjWidget#deactivateDJ(49f6e7a06ebc5aa8).() |
| 120 | { |
| 121 | pcxx . . $ DjWidget#p.->isActivecxx . . $ DjWidgetPrivate#isActive. = false; |
| 122 | updateViewcxx . . $ DjWidget#updateView(49f6e7a06ebc5aa8).(); |
| 123 | } |
| 124 | |
| 125 | void DjWidgetcxx . . $ DjWidget#::updateViewcxx . . $ DjWidget#updateView(49f6e7a06ebc5aa8).() |
| 126 | { |
| 127 | // Filter description and count update |
| 128 | |
| 129 | // update Labels |
| 130 | setToolTipcxx . . $ QWidget#setToolTip(3520e46b33348bf6).(trcxx . . $ DjWidget#tr(75d9f1c324b4579d).("This Dj plays: ") +cxx . . $ operator+(fab9b4f80031f353). pcxx . . $ DjWidget#p.->djcxx . . $ DjWidgetPrivate#dj.->descriptioncxx . . $ Dj#description(4365c3963150523e).()); |
| 131 | QStringcxx . . $ QString# strCase = (pcxx . . $ DjWidget#p.->djcxx . . $ DjWidgetPrivate#dj.->filterscxx . . $ Dj#filters(7f69582c18edfd8d).().countcxx . . $ QList#count(455f465bc33b4cdf).() > 1) ? trcxx . . $ DjWidget#tr(75d9f1c324b4579d).("cases") : trcxx . . $ DjWidget#tr(75d9f1c324b4579d).("case"); |
| 132 | |
| 133 | uicxx . . $ DjWidget#ui.->lblDesciptioncxx . . $ Ui_DjWidget#lblDesciption.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).(QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(pcxx . . $ DjWidget#p.->djcxx . . $ DjWidgetPrivate#dj.->filterscxx . . $ Dj#filters(7f69582c18edfd8d).().countcxx . . $ QList#count(455f465bc33b4cdf).()) +cxx . . $ operator+(3d22f08efddf8107). " " +cxx . . $ operator+(fab9b4f80031f353). strCase +cxx . . $ operator+(3d22f08efddf8107). " " |
| 134 | +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f6cb4ef476e726c4).(pcxx . . $ DjWidget#p.->djcxx . . $ DjWidgetPrivate#dj.->countTrackscxx . . $ Dj#countTracks(da6335ded91d79c2).()) +cxx . . $ operator+(3d22f08efddf8107). " " +cxx . . $ operator+(fab9b4f80031f353). trcxx . . $ DjWidget#tr(75d9f1c324b4579d).("tracks") +cxx . . $ operator+(3d22f08efddf8107). " " |
| 135 | +cxx . . $ operator+(fab9b4f80031f353). Trackcxx . . $ Track#::prettyTimecxx . . $ Track#prettyTime(dbfc6ea7cdb6729e).(pcxx . . $ DjWidget#p.->djcxx . . $ DjWidgetPrivate#dj.->lengthTrackscxx . . $ Dj#lengthTracks(da6335ded91d79c2).(), true) +cxx . . $ operator+(3d22f08efddf8107). " " +cxx . . $ operator+(fab9b4f80031f353). trcxx . . $ DjWidget#tr(75d9f1c324b4579d).("hours")); |
| 136 | |
| 137 | // active/passive look differentiation |
| 138 | QStringcxx . . $ QString# activeStylecxx . . $ QString#QString(ced63f7c635d850d).; |
| 139 | if (pcxx . . $ DjWidget#p.->isActivecxx . . $ DjWidgetPrivate#isActive.) { |
| 140 | activeStyle =cxx . . $ QString#`operator=`(d02845eef0c33901). "color:#ff6464;'>"; |
| 141 | this->setStyleSheetcxx . . $ QWidget#setStyleSheet(3520e46b33348bf6).("#frameDj{ background: qlineargradient("cxx . . $ QString#QString(85c52e162fed56f9). |
| 142 | "x1:0, y1:0, x2:0, y2:1," |
| 143 | "stop: 0.01 #202020," |
| 144 | "stop:0.11 #505050," |
| 145 | "stop:1 #505050" |
| 146 | ");}"); |
| 147 | } else { |
| 148 | activeStyle =cxx . . $ QString#`operator=`(d02845eef0c33901). "color:#eeeeee;'>"; |
| 149 | this->setStyleSheetcxx . . $ QWidget#setStyleSheet(3520e46b33348bf6).("#frameDj{ background: qlineargradient("cxx . . $ QString#QString(85c52e162fed56f9). |
| 150 | "x1:0, y1:0, x2:0, y2:1," |
| 151 | "stop: 0.01 #202020," |
| 152 | "stop:0.11 #404040," |
| 153 | "stop:1 #404040" |
| 154 | ");}"); |
| 155 | } |
| 156 | |
| 157 | uicxx . . $ DjWidget#ui.->lblNamecxx . . $ Ui_DjWidget#lblName.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).("<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0//EN' 'http://www.w3.org/TR/REC-html40/strict.dtd'>" |
| 158 | "<html><head><meta name='qrichtext' content='1' /><style type='text/css'>p, li { white-space: pre-wrap; }" |
| 159 | "</style></head><body style='font-size:8.25pt; font-weight:400; font-style:normal;'><p style=' margin-top:0px; " |
| 160 | "margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;'>" |
| 161 | "<a href='fdadfaf'><span style=' font-size:12pt;font-style:normal;font-weight:bold; text-decoration: underline; " |
| 162 | +cxx . . $ operator+(c75c3ae4eb9af1a8). activeStyle |
| 163 | +cxx . . $ operator+(fab9b4f80031f353). pcxx . . $ DjWidget#p.->djcxx . . $ DjWidgetPrivate#dj.->namecxx . . $ Dj#name. +cxx . . $ operator+(3d22f08efddf8107). "</span></a></p></body></html>"); |
| 164 | } |
| 165 | |
| 166 | // esc key for exit close |
| 167 | void DjWidgetcxx . . $ DjWidget#::keyPressEventcxx . . $ DjWidget#keyPressEvent(c92999c1b6b09cc0).(QKeyEventcxx . . $ QKeyEvent#* e) |
| 168 | { |
| 169 | if (e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() == Qtcxx . . $ Qt/::Key_Escapecxx . . $ Qt/Key_Escape.) |
| 170 | slideCloseWidgetcxx . . $ DjWidget#slideCloseWidget(b45ddcbc8423892c).(false); |
| 171 | else |
| 172 | QWidgetcxx . . $ QWidget#::keyPressEventcxx . . $ QWidget#keyPressEvent(c92999c1b6b09cc0).(e); |
| 173 | } |
| 174 | |
| 175 | void DjWidgetcxx . . $ DjWidget#::on_butPlayWidget_pressedcxx . . $ DjWidget#on_butPlayWidget_pressed(49f6e7a06ebc5aa8).() |
| 176 | { |
| 177 | Q_EMITcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:95:10`! startedcxx . . $ DjWidget#started(49f6e7a06ebc5aa8).(); |
| 178 | } |
| 179 | |
| 180 | void DjWidgetcxx . . $ DjWidget#::on_pushClose_clickedcxx . . $ DjWidget#on_pushClose_clicked(49f6e7a06ebc5aa8).() |
| 181 | { |
| 182 | slideCloseWidgetcxx . . $ DjWidget#slideCloseWidget(b45ddcbc8423892c).((uicxx . . $ DjWidget#ui.->widgetClosecxx . . $ Ui_DjWidget#widgetClose.->minimumWidthcxx . . $ QWidget#minimumWidth(455f465bc33b4cdf).() < 50)); |
| 183 | } |
| 184 | |
| 185 | void DjWidgetcxx . . $ DjWidget#::slideCloseWidgetcxx . . $ DjWidget#slideCloseWidget(b45ddcbc8423892c).(bool open) |
| 186 | { |
| 187 | pcxx . . $ DjWidget#p.->targetWidthcxx . . $ DjWidgetPrivate#targetWidth. = (open) ? 70 : 0; |
| 188 | pcxx . . $ DjWidget#p.->timerSlidecxx . . $ DjWidgetPrivate#timerSlide.->startcxx . . $ QTimer#start(49f6e7a06ebc5aa8).(); |
| 189 | } |
| 190 | |
| 191 | void DjWidgetcxx . . $ DjWidget#::timerSlide_timeOutcxx . . $ DjWidget#timerSlide_timeOut(49f6e7a06ebc5aa8).() |
| 192 | { |
| 193 | int mWidth = uicxx . . $ DjWidget#ui.->widgetClosecxx . . $ Ui_DjWidget#widgetClose.->minimumWidthcxx . . $ QWidget#minimumWidth(455f465bc33b4cdf).(); |
| 194 | if (pcxx . . $ DjWidget#p.->targetWidthcxx . . $ DjWidgetPrivate#targetWidth. > mWidth) { |
| 195 | uicxx . . $ DjWidget#ui.->widgetClosecxx . . $ Ui_DjWidget#widgetClose.->setMinimumWidthcxx . . $ QWidget#setMinimumWidth(d4f767463ce0a6b3).(mWidth + 5); |
| 196 | uicxx . . $ DjWidget#ui.->widgetClosecxx . . $ Ui_DjWidget#widgetClose.->setMaximumWidthcxx . . $ QWidget#setMaximumWidth(d4f767463ce0a6b3).(mWidth + 5); |
| 197 | } else if (pcxx . . $ DjWidget#p.->targetWidthcxx . . $ DjWidgetPrivate#targetWidth. < mWidth) { |
| 198 | uicxx . . $ DjWidget#ui.->widgetClosecxx . . $ Ui_DjWidget#widgetClose.->setMinimumWidthcxx . . $ QWidget#setMinimumWidth(d4f767463ce0a6b3).(mWidth - 5); |
| 199 | uicxx . . $ DjWidget#ui.->widgetClosecxx . . $ Ui_DjWidget#widgetClose.->setMaximumWidthcxx . . $ QWidget#setMaximumWidth(d4f767463ce0a6b3).(mWidth - 5); |
| 200 | } else { |
| 201 | pcxx . . $ DjWidget#p.->timerSlidecxx . . $ DjWidgetPrivate#timerSlide.->stopcxx . . $ QTimer#stop(49f6e7a06ebc5aa8).(); |
| 202 | } |
| 203 | } |