[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/games/kamefu/kamefu/widgets
From: Brian S. Stephan <bssteph () incorporeal ! org>
Date: 2006-02-04 17:51:41
Message-ID: 1139075501.050211.13395.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 505731 by bssteph:
use KURLRequester. thanks mlarouche
M +8 -30 metadataedit.cpp
M +0 -4 metadataedit.h
--- trunk/playground/games/kamefu/kamefu/widgets/metadataedit.cpp #505730:505731
@@ -28,6 +28,7 @@
#include <kurl.h>
#include <kfiledialog.h>
#include <kmessagebox.h>
+#include <kurlrequester.h>
#include "metadataedit.h"
#include "rommetainformation.h"
@@ -52,7 +53,7 @@
KLineEdit* countryLineEdit;
KLineEdit* genreLineEdit;
KLineEdit* pathLineEdit;
- KLineEdit* titleScreenLineEdit;
+ KURLRequester* titleScreenURLRequester;
};
MetadataEdit::MetadataEdit(QWidget *parent, const char *name) :
@@ -117,7 +118,7 @@
metainfo->setYear(d->yearSpinBox->text());
metainfo->setCountry(d->countryLineEdit->text());
metainfo->setGenre(d->genreLineEdit->text());
- metainfo->setTitlescreenPath(d->titleScreenLineEdit->text());
+ metainfo->setTitlescreenPath(d->titleScreenURLRequester->url());
// do transaction
Kamefu::CollectionAccess::self()->modifyExistingRom(metainfo);
@@ -145,7 +146,7 @@
d->countryLineEdit->setText(metainfo->country());
d->genreLineEdit->setText(metainfo->genre());
d->pathLineEdit->setText(metainfo->url());
- d->titleScreenLineEdit->setText(metainfo->titlescreenPath());
+ d->titleScreenURLRequester->setURL(metainfo->titlescreenPath());
}
}
@@ -184,19 +185,10 @@
QVBoxLayout *fieldsLayout = new QVBoxLayout(layout, 2);
// a couple things go outside the columns and span both
- d->titleScreenLineEdit = new KLineEdit(this, "titleScreenLineEdit");
+ d->titleScreenURLRequester = new KURLRequester(this, "titleScreenURLRequester");
+ d->titleScreenURLRequester->setFilter("image/png");
+ addItem(i18n("&Title Screen Image:"), d->titleScreenURLRequester, fieldsLayout);
- QLabel *label = new QLabel(d->titleScreenLineEdit, i18n("&Title Screen Image:"), \
this);
- fieldsLayout->addWidget(label);
-
- // all on one line, time for another layout
- QHBoxLayout *openTitleLayout = new QHBoxLayout(fieldsLayout, 2);
- KPushButton *openTitlePushButton = new KPushButton(SmallIcon("fileopen"),
- "", this, "openTitlePushButton");
- connect(openTitlePushButton, SIGNAL(clicked()), this, \
SLOT(slotOpenTitleClicked()));
- openTitleLayout->addWidget(d->titleScreenLineEdit);
- openTitleLayout->addWidget(openTitlePushButton);
-
d->hashLineEdit = new KLineEdit(this, "hashLineEdit");
d->hashLineEdit->setReadOnly(true);
addItem(i18n("&Hash:"), d->hashLineEdit, fieldsLayout);
@@ -216,7 +208,7 @@
connect(d->countryLineEdit, SIGNAL(textChanged(const QString&)), this, \
SLOT(slotFieldsChanged())); connect(d->yearSpinBox, SIGNAL(valueChanged(int)), this, \
SLOT(slotFieldsChanged())); connect(d->genreLineEdit, SIGNAL(textChanged(const \
QString&)), this, SLOT(slotFieldsChanged()));
- connect(d->titleScreenLineEdit, SIGNAL(textChanged(const QString&)), this, \
SLOT(slotFieldsChanged())); + connect(d->titleScreenURLRequester, \
SIGNAL(textChanged(const QString&)), this, SLOT(slotFieldsChanged())); }
void MetadataEdit::addItem(const QString &text, QWidget *item, QBoxLayout *layout, \
const QString &iconName) @@ -250,18 +242,4 @@
}
}
-void MetadataEdit::slotOpenTitleClicked()
-{
- KURL url = KFileDialog::getOpenURL(QString::null, "image/png", this, i18n("Open \
Title Screen Image"));
-
- if(url.isEmpty())
- return;
-
- if(url.isLocalFile()) {
- d->titleScreenLineEdit->setText(url.path());
- } else {
- KMessageBox::queuedMessageBox(this, KMessageBox::Error, i18n("Can't load remote \
files at the moment."));
- }
-}
-
#include "metadataedit.moc"
--- trunk/playground/games/kamefu/kamefu/widgets/metadataedit.h #505730:505731
@@ -64,10 +64,6 @@
* Note that fields in the widget have changed.
*/
void slotFieldsChanged(bool changed = true);
- /**
- * User is selecting a filename to set as the ROM's title screen
- */
- void slotOpenTitleClicked();
signals:
/**
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic