Fxi saving, etc.
This commit is contained in:
@@ -47,7 +47,7 @@ void DevicePropertiesDialog::show(const QString &path, const QString &coverName,
|
||||
|
||||
void DevicePropertiesDialog::enableOkButton()
|
||||
{
|
||||
enableButtonOk(devProp->isSaveable());
|
||||
enableButtonOk(devProp->isSaveable() && devProp->isModified());
|
||||
}
|
||||
|
||||
void DevicePropertiesDialog::slotButtonClicked(int button)
|
||||
|
||||
@@ -81,8 +81,8 @@ DevicePropertiesWidget::DevicePropertiesWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, schemeDlg(0)
|
||||
, noCoverText(i18n("Don't copy covers"))
|
||||
, modified(false)
|
||||
, saveable(false)
|
||||
, isCreating(false)
|
||||
{
|
||||
setupUi(this);
|
||||
configFilename->setIcon(QIcon::fromTheme("configure"));
|
||||
@@ -108,9 +108,8 @@ DevicePropertiesWidget::DevicePropertiesWidget(QWidget *parent)
|
||||
}
|
||||
}
|
||||
|
||||
void DevicePropertiesWidget::update(const QString &path, const QString &coverName, const Device::Options &opts, int props, bool create)
|
||||
void DevicePropertiesWidget::update(const QString &path, const QString &coverName, const Device::Options &opts, int props)
|
||||
{
|
||||
isCreating=create;
|
||||
filenameScheme->setText(opts.scheme);
|
||||
vfatSafe->setChecked(opts.vfatSafe);
|
||||
asciiOnly->setChecked(opts.asciiOnly);
|
||||
@@ -189,6 +188,7 @@ void DevicePropertiesWidget::update(const QString &path, const QString &coverNam
|
||||
connect(transcoderName, SIGNAL(currentIndexChanged(int)), this, SLOT(transcoderChanged()));
|
||||
connect(transcoderValue, SIGNAL(valueChanged(int)), this, SLOT(checkSaveable()));
|
||||
connect(useCache, SIGNAL(stateChanged(int)), this, SLOT(checkSaveable()));
|
||||
modified=false;
|
||||
checkSaveable();
|
||||
}
|
||||
|
||||
@@ -219,9 +219,8 @@ void DevicePropertiesWidget::checkSaveable()
|
||||
{
|
||||
Device::Options opts=settings();
|
||||
|
||||
saveable=isCreating
|
||||
? (!opts.scheme.isEmpty() && !musicFolder->text().trimmed().isEmpty() && !albumCovers->currentText().isEmpty())
|
||||
: (!opts.scheme.isEmpty() && (musicFolder->text().trimmed()!=origMusicFolder || opts!=origOpts || albumCovers->currentText()!=origCoverName));
|
||||
modified=musicFolder->text().trimmed()!=origMusicFolder || opts!=origOpts || albumCovers->currentText()!=origCoverName;
|
||||
saveable=!opts.scheme.isEmpty() && !musicFolder->text().trimmed().isEmpty() && !albumCovers->currentText().isEmpty();
|
||||
emit updated();
|
||||
}
|
||||
|
||||
|
||||
@@ -46,8 +46,9 @@ public:
|
||||
};
|
||||
DevicePropertiesWidget(QWidget *parent);
|
||||
virtual ~DevicePropertiesWidget() { }
|
||||
void update(const QString &path, const QString &coverName, const Device::Options &opts, int props, bool create=false);
|
||||
void update(const QString &path, const QString &coverName, const Device::Options &opts, int props);
|
||||
Device::Options settings();
|
||||
bool isModified() const { return modified; }
|
||||
bool isSaveable() const { return saveable; }
|
||||
QString music() const { return musicFolder->text().trimmed(); }
|
||||
QString cover() const;
|
||||
@@ -66,8 +67,8 @@ private:
|
||||
QString origMusicFolder;
|
||||
QString origCoverName;
|
||||
QString noCoverText;
|
||||
bool modified;
|
||||
bool saveable;
|
||||
bool isCreating;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
RemoteDevicePropertiesDialog::RemoteDevicePropertiesDialog(QWidget *parent)
|
||||
: KDialog(parent)
|
||||
, isCreate(false)
|
||||
{
|
||||
setButtons(KDialog::Ok|KDialog::Cancel);
|
||||
setCaption(i18n("Remote Device Properties"));
|
||||
@@ -48,11 +49,12 @@ RemoteDevicePropertiesDialog::RemoteDevicePropertiesDialog(QWidget *parent)
|
||||
|
||||
void RemoteDevicePropertiesDialog::show(const QString &path, const QString &coverName, const Device::Options &opts, const RemoteDevice::Details &det, int props, bool create)
|
||||
{
|
||||
if (create) {
|
||||
isCreate=create;
|
||||
if (isCreate) {
|
||||
setCaption(i18n("Add Remote Device"));
|
||||
}
|
||||
devProp->update(path, coverName, opts, props, create);
|
||||
remoteProp->update(det, create);
|
||||
devProp->update(path, coverName, opts, props);
|
||||
remoteProp->update(det);
|
||||
connect(devProp, SIGNAL(updated()), SLOT(enableOkButton()));
|
||||
connect(remoteProp, SIGNAL(updated()), SLOT(enableOkButton()));
|
||||
KDialog::show();
|
||||
@@ -61,7 +63,8 @@ void RemoteDevicePropertiesDialog::show(const QString &path, const QString &cove
|
||||
|
||||
void RemoteDevicePropertiesDialog::enableOkButton()
|
||||
{
|
||||
enableButtonOk(remoteProp->isSaveable() && devProp->isSaveable());
|
||||
enableButtonOk(remoteProp->isSaveable() && devProp->isSaveable() &&
|
||||
(isCreate || remoteProp->isModified() || devProp->isModified()));
|
||||
}
|
||||
|
||||
void RemoteDevicePropertiesDialog::slotButtonClicked(int button)
|
||||
|
||||
@@ -52,6 +52,7 @@ private:
|
||||
private:
|
||||
RemoteDevicePropertiesWidget *remoteProp;
|
||||
DevicePropertiesWidget *devProp;
|
||||
bool isCreate;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -32,7 +32,8 @@
|
||||
|
||||
RemoteDevicePropertiesWidget::RemoteDevicePropertiesWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, isCreating(false)
|
||||
, modified(false)
|
||||
, saveable(false)
|
||||
{
|
||||
setupUi(this);
|
||||
if (qobject_cast<QTabWidget *>(parent)) {
|
||||
@@ -40,9 +41,8 @@ RemoteDevicePropertiesWidget::RemoteDevicePropertiesWidget(QWidget *parent)
|
||||
}
|
||||
}
|
||||
|
||||
void RemoteDevicePropertiesWidget::update(const RemoteDevice::Details &d, bool create)
|
||||
void RemoteDevicePropertiesWidget::update(const RemoteDevice::Details &d)
|
||||
{
|
||||
isCreating=create;
|
||||
orig=d;
|
||||
name->setText(d.name);
|
||||
host->setText(d.host);
|
||||
@@ -55,13 +55,15 @@ void RemoteDevicePropertiesWidget::update(const RemoteDevice::Details &d, bool c
|
||||
connect(user, SIGNAL(textChanged(const QString &)), this, SLOT(checkSaveable()));
|
||||
connect(folder, SIGNAL(textChanged(const QString &)), this, SLOT(checkSaveable()));
|
||||
connect(port, SIGNAL(valueChanged(int)), this, SLOT(checkSaveable()));
|
||||
modified=false;
|
||||
checkSaveable();
|
||||
}
|
||||
|
||||
void RemoteDevicePropertiesWidget::checkSaveable()
|
||||
{
|
||||
RemoteDevice::Details det=details();
|
||||
saveable=isCreating ? !det.isEmpty() : (!det.isEmpty() && det!=orig);
|
||||
modified=det!=orig;
|
||||
saveable=!det.isEmpty();
|
||||
emit updated();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,9 +35,10 @@ public:
|
||||
|
||||
RemoteDevicePropertiesWidget(QWidget *parent);
|
||||
virtual ~RemoteDevicePropertiesWidget() { }
|
||||
void update(const RemoteDevice::Details &d, bool create=false);
|
||||
void update(const RemoteDevice::Details &d);
|
||||
RemoteDevice::Details details();
|
||||
const RemoteDevice::Details & origDetails() const { return orig; }
|
||||
bool isModified() const { return modified; }
|
||||
bool isSaveable() const { return saveable; }
|
||||
|
||||
Q_SIGNALS:
|
||||
@@ -48,8 +49,8 @@ private Q_SLOTS:
|
||||
|
||||
private:
|
||||
RemoteDevice::Details orig;
|
||||
bool modified;
|
||||
bool saveable;
|
||||
bool isCreating;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user