A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Theme Editor: Implemented timer panel functionality, added missing seconds field to device control panel

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27354 a1c6a512-1295-4272-9138-f99709370657

+146 -5
+8
utils/themeeditor/gui/devicestate.cpp
··· 402 402 { 403 403 return data("?cw"); 404 404 } 405 + else if(tag == "cs") 406 + { 407 + int seconds = data("seconds").toInt(); 408 + if(seconds < 10) 409 + return "0" + QString::number(seconds); 410 + else 411 + return seconds; 412 + } 405 413 406 414 QPair<InputType, QWidget*> found = 407 415 inputs.value(tag, QPair<InputType, QWidget*>(Slide, 0));
+122 -1
utils/themeeditor/gui/skintimer.cpp
··· 22 22 #include "skintimer.h" 23 23 #include "ui_skintimer.h" 24 24 25 - const int SkinTimer::millisPerTick = 10; 25 + const int SkinTimer::millisPerTick = 250; 26 26 27 27 SkinTimer::SkinTimer(DeviceState* device, QWidget *parent) : 28 28 QWidget(parent), ··· 30 30 device(device) 31 31 { 32 32 ui->setupUi(this); 33 + setupUI(); 33 34 } 34 35 35 36 SkinTimer::~SkinTimer() ··· 37 38 delete ui; 38 39 } 39 40 41 + void SkinTimer::setupUI() 42 + { 43 + playStateButtons.append(ui->playButton); 44 + playStateButtons.append(ui->pauseButton); 45 + playStateButtons.append(ui->rwndButton); 46 + playStateButtons.append(ui->ffwdButton); 47 + 48 + QObject::connect(ui->startButton, SIGNAL(clicked()), 49 + this, SLOT(start())); 50 + QObject::connect(ui->stopButton, SIGNAL(clicked()), 51 + this, SLOT(stop())); 52 + QObject::connect(&timer, SIGNAL(timeout()), 53 + this, SLOT(tick())); 54 + for(int i = 0; i < playStateButtons.count(); i++) 55 + QObject::connect(playStateButtons[i], SIGNAL(toggled(bool)), 56 + this, SLOT(stateChange())); 57 + QObject::connect(device, SIGNAL(settingsChanged()), 58 + this, SLOT(deviceChange())); 59 + 60 + int playState = device->data("?mp").toInt(); 61 + switch(playState) 62 + { 63 + default: 64 + case 1: 65 + ui->playButton->setChecked(true); 66 + break; 67 + case 2: 68 + ui->pauseButton->setChecked(true); 69 + break; 70 + case 3: 71 + ui->ffwdButton->setChecked(true); 72 + break; 73 + case 4: 74 + ui->rwndButton->setChecked(true); 75 + break; 76 + } 77 + } 78 + 40 79 void SkinTimer::start() 41 80 { 81 + ui->startButton->setEnabled(false); 82 + ui->stopButton->setEnabled(true); 83 + ui->speedBox->setEnabled(false); 84 + ui->durationBox->setEnabled(false); 42 85 86 + totalTime = ui->durationBox->value() * 1000; 87 + elapsedTime = 0; 88 + 89 + timer.setInterval(millisPerTick); 90 + ui->statusBar->setValue(0); 91 + timer.start(); 43 92 } 44 93 45 94 void SkinTimer::stop() 46 95 { 96 + ui->startButton->setEnabled(true); 97 + ui->stopButton->setEnabled(false); 98 + ui->speedBox->setEnabled(true); 99 + ui->durationBox->setEnabled(true); 47 100 101 + timer.stop(); 48 102 } 49 103 50 104 void SkinTimer::tick() 51 105 { 52 106 107 + elapsedTime += millisPerTick * ui->speedBox->value(); 108 + if(elapsedTime >= totalTime) 109 + { 110 + ui->statusBar->setValue(100); 111 + stop(); 112 + } 113 + 114 + /* Calculating the simulated time elapsed */ 115 + double dTime = millisPerTick * ui->speedBox->value() / 1000; 116 + 117 + /* Adding to the device's simtime */ 118 + device->setData("simtime", device->data("simtime").toDouble() + dTime); 119 + 120 + /* Adding to the song time depending on mode*/ 121 + double songTime = device->data("?pc").toDouble(); 122 + double trackTime = device->data("?pt").toDouble(); 123 + if(ui->playButton->isChecked()) 124 + songTime += dTime; 125 + else if(ui->rwndButton->isChecked()) 126 + songTime -= 2 * dTime; 127 + else if(ui->ffwdButton->isChecked()) 128 + songTime += 2 * dTime; 129 + 130 + if(songTime > trackTime) 131 + { 132 + songTime = trackTime; 133 + ui->pauseButton->setChecked(true); 134 + } 135 + if(songTime < 0) 136 + { 137 + songTime = 0; 138 + ui->pauseButton->setChecked(true); 139 + } 140 + 141 + device->setData("?pc", songTime); 142 + 143 + /* Updating the status bar */ 144 + ui->statusBar->setValue(elapsedTime * 100 / totalTime); 53 145 } 54 146 55 147 void SkinTimer::stateChange() 56 148 { 149 + if(ui->playButton->isChecked()) 150 + device->setData("mp", "Play"); 151 + else if(ui->pauseButton->isChecked()) 152 + device->setData("mp", "Pause"); 153 + else if(ui->rwndButton->isChecked()) 154 + device->setData("mp", "Rewind"); 155 + else if(ui->ffwdButton->isChecked()) 156 + device->setData("mp", "Fast Forward"); 157 + } 57 158 159 + void SkinTimer::deviceChange() 160 + { 161 + int playState = device->data("?mp").toInt(); 162 + switch(playState) 163 + { 164 + case 1: 165 + ui->playButton->setChecked(true); 166 + break; 167 + case 2: 168 + ui->pauseButton->setChecked(true); 169 + break; 170 + case 3: 171 + ui->ffwdButton->setChecked(true); 172 + break; 173 + case 4: 174 + ui->rwndButton->setChecked(true); 175 + break; 176 + default: 177 + break; 178 + } 58 179 }
+5
utils/themeeditor/gui/skintimer.h
··· 24 24 25 25 #include <QWidget> 26 26 #include <QTimer> 27 + #include <QToolButton> 27 28 28 29 #include "devicestate.h" 29 30 ··· 44 45 void stop(); 45 46 void tick(); 46 47 void stateChange(); 48 + void deviceChange(); 47 49 48 50 private: 49 51 void setupUI(); ··· 53 55 54 56 QTimer timer; 55 57 unsigned long int elapsedTime; 58 + unsigned long int totalTime; 59 + 60 + QList<QToolButton*> playStateButtons; 56 61 }; 57 62 58 63 #endif // SKINTIMER_H
+10 -4
utils/themeeditor/gui/skintimer.ui
··· 7 7 <x>0</x> 8 8 <y>0</y> 9 9 <width>238</width> 10 - <height>204</height> 10 + <height>198</height> 11 11 </rect> 12 12 </property> 13 13 <property name="windowTitle"> ··· 39 39 <number>1</number> 40 40 </property> 41 41 <property name="minimum"> 42 - <double>0.100000000000000</double> 42 + <double>0.600000000000000</double> 43 43 </property> 44 44 <property name="maximum"> 45 45 <double>3.000000000000000</double> ··· 58 58 <string>Duration</string> 59 59 </property> 60 60 <property name="buddy"> 61 - <cstring>spinBox</cstring> 61 + <cstring>durationBox</cstring> 62 62 </property> 63 63 </widget> 64 64 </item> 65 65 <item row="1" column="1"> 66 - <widget class="QSpinBox" name="spinBox"> 66 + <widget class="QSpinBox" name="durationBox"> 67 67 <property name="suffix"> 68 68 <string>s</string> 69 69 </property> ··· 82 82 </item> 83 83 <item> 84 84 <widget class="QProgressBar" name="statusBar"> 85 + <property name="enabled"> 86 + <bool>false</bool> 87 + </property> 85 88 <property name="value"> 86 89 <number>0</number> 90 + </property> 91 + <property name="textVisible"> 92 + <bool>false</bool> 87 93 </property> 88 94 </widget> 89 95 </item>
+1
utils/themeeditor/resources/deviceoptions
··· 131 131 ?cw ; Day of Week ; combo(Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday) ; Tuesday 132 132 hour ; Hour (24h) ; spin(0, 23) ; 12 133 133 minute ; Minute ; spin(0, 59) ; 25 134 + second ; Second ; spin(0, 59) ; 20 134 135 135 136 [Recording Status] 136 137 Rp ; Target Has Recorder ; check ; false