A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
at master 108 lines 3.0 kB view raw
1/*************************************************************************** 2 * __________ __ ___. 3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 * \/ \/ \/ \/ \/ 8 * $Id$ 9 * 10 * Copyright (C) 2010 Robert Bieber 11 * 12 * This program is free software; you can redistribute it and/or 13 * modify it under the terms of the GNU General Public License 14 * as published by the Free Software Foundation; either version 2 15 * of the License, or (at your option) any later version. 16 * 17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 * KIND, either express or implied. 19 * 20 ****************************************************************************/ 21 22#include "skinviewer.h" 23#include "ui_skinviewer.h" 24 25SkinViewer::SkinViewer(QWidget *parent) : 26 QWidget(parent), 27 ui(new Ui::SkinViewer) 28{ 29 ui->setupUi(this); 30 31 QObject::connect(ui->zoomOutButton, SIGNAL(pressed()), 32 this, SLOT(zoomOut())); 33 QObject::connect(ui->zoomInButton, SIGNAL(pressed()), 34 this, SLOT(zoomIn())); 35 QObject::connect(ui->zoomEvenButton, SIGNAL(pressed()), 36 this, SLOT(zoomEven())); 37 38} 39 40SkinViewer::~SkinViewer() 41{ 42 delete ui; 43} 44 45void SkinViewer::changeEvent(QEvent *e) 46{ 47 QWidget::changeEvent(e); 48 switch (e->type()) { 49 case QEvent::LanguageChange: 50 ui->retranslateUi(this); 51 break; 52 default: 53 break; 54 } 55} 56 57void SkinViewer::connectSkin(SkinDocument *skin) 58{ 59 if(skin) 60 { 61 ui->viewer->setScene(skin->scene()); 62 QObject::connect(skin, SIGNAL(antiSync(bool)), 63 ui->codeGenButton, SLOT(setEnabled(bool))); 64 QObject::connect(skin, SIGNAL(antiSync(bool)), 65 ui->codeUndoButton, SLOT(setEnabled(bool))); 66 67 QObject::connect(ui->codeGenButton, SIGNAL(pressed()), 68 skin, SLOT(genCode())); 69 QObject::connect(ui->codeUndoButton, SIGNAL(pressed()), 70 skin, SLOT(parseCode())); 71 72 QObject::connect(skin->scene(), SIGNAL(mouseMoved(QString)), 73 ui->coordinateLabel, SLOT(setText(QString))); 74 75 doc = skin; 76 } 77 else 78 { 79 ui->viewer->setScene(0); 80 ui->coordinateLabel->setText(""); 81 82 doc = 0; 83 } 84 85 bool antiSync; 86 if(skin && !skin->isSynced()) 87 antiSync = true; 88 else 89 antiSync = false; 90 91 ui->codeGenButton->setEnabled(antiSync); 92 ui->codeUndoButton->setEnabled(antiSync); 93} 94 95void SkinViewer::zoomIn() 96{ 97 ui->viewer->scale(1.2, 1.2); 98} 99 100void SkinViewer::zoomOut() 101{ 102 ui->viewer->scale(1/1.2, 1/1.2); 103} 104 105void SkinViewer::zoomEven() 106{ 107 ui->viewer->resetTransform(); 108}