PropertiesDialog::PropertiesDialog(QWidget *parent):QDialog(parent) { setupUi(this); QObject::connect(AlbumBox,SIGNAL(textEdited(QString)),this,SLOT(propChanged())); QObject::connect(ArtistBox,SIGNAL(textEdited(QString)),this,SLOT(propChanged())); QObject::connect(TitleBox,SIGNAL(textEdited(QString)),this,SLOT(propChanged())); QObject::connect(localsetButton,SIGNAL(clicked()),this,SLOT(setCover())); QObject::connect(removeButton,SIGNAL(clicked()),this,SLOT(removeCover())); QObject::connect(this,SIGNAL(accepted()),this,SLOT(write())); coverChanged=false; }
void PropertiesDialog::setCover() { QString filename=QFileDialog::getOpenFileName(this,"Select an image","/home","Images (*.png *.jpg *.jpeg *.gif)"); if(!filename.isNull()) { QPixmap pic=QPixmap(filename).scaled(128,128,Qt::IgnoreAspectRatio); AlbumArt->setPixmap(pic); propChanged(); coverChanged=true; } }
bool SSPropModel::setData(const QModelIndex &index, const QVariant &value, int role) { if(role == Qt::EditRole && index.isValid() && index.column() == 1){ QList<QByteArray> names = m_object->dynamicPropertyNames(); m_object->setProperty(names.at(index.row()), value); emit dataChanged(index, index); emit propChanged(); return true; } return false; }
void QUPowerDeviceInterface::connectNotify(const char *signal) { if (QLatin1String(signal) == SIGNAL(changed())) { if (!connection().connect(QLatin1String(UPOWER_SERVICE), path, UPOWER_DEVICE_SERVICE, QLatin1String("Changed"), this, SIGNAL(changed()))) { qDebug() << "Error" << connection().lastError().message(); } } else if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) { if (!connection().connect(QLatin1String(UPOWER_SERVICE), path, UPOWER_DEVICE_SERVICE, QLatin1String("Changed"), this, SIGNAL(propChanged()))) { qDebug() << "Error" << connection().lastError().message(); } } }
void PropertiesDialog::removeCover() { itdb_track_remove_thumbnails(currentTrack); AlbumArt->setPixmap(QPixmap(":/images/no-cover-art.jpg")); propChanged(); }
SSPropModel::SSPropModel(QObject* obj, QObject *parent) : QAbstractItemModel(parent), m_object(obj) { connect(this, SIGNAL(propChanged()), obj, SLOT(update())); connect(this, SIGNAL(propChanged()), obj, SLOT(updateCanvas())); }