Changeset View
Changeset View
Standalone View
Standalone View
imagemapchoosedialog.cpp
Show All 11 Lines | |||||
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * | ||
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * | ||
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * | ||
15 | * * | 15 | * * | ||
16 | ***************************************************************************/ | 16 | ***************************************************************************/ | ||
17 | #include "imagemapchoosedialog.h" | 17 | #include "imagemapchoosedialog.h" | ||
18 | 18 | | |||
19 | #include <QDialogButtonBox> | 19 | #include <QDialogButtonBox> | ||
20 | #include <QDir> | ||||
20 | #include <QLineEdit> | 21 | #include <QLineEdit> | ||
21 | #include <QListWidget> | 22 | #include <QListWidget> | ||
22 | #include <QLabel> | 23 | #include <QLabel> | ||
23 | #include <QPushButton> | 24 | #include <QPushButton> | ||
24 | #include <QTableWidget> | 25 | #include <QTableWidget> | ||
25 | #include <QVBoxLayout> | 26 | #include <QVBoxLayout> | ||
26 | #include <QGridLayout> | 27 | #include <QGridLayout> | ||
27 | #include <QHeaderView> | 28 | #include <QHeaderView> | ||
28 | 29 | | |||
29 | #include <KConfigGroup> | 30 | #include <KConfigGroup> | ||
30 | 31 | | |||
31 | #include "kimagemapeditor_debug.h" | 32 | #include "kimagemapeditor_debug.h" | ||
32 | 33 | | |||
33 | ImageMapChooseDialog::ImageMapChooseDialog( | 34 | ImageMapChooseDialog::ImageMapChooseDialog( | ||
34 | QWidget* parent, | 35 | QWidget* parent, | ||
35 | QList<MapTag*> _maps, | 36 | QList<MapTag*> _maps, | ||
36 | QList<ImageTag*> _images, | 37 | QList<ImageTag*> _images, | ||
37 | const KUrl & _baseUrl) | 38 | const QUrl & _baseUrl) | ||
38 | : QDialog(parent) | 39 | : QDialog(parent) | ||
39 | { | 40 | { | ||
40 | qCDebug(KIMAGEMAPEDITOR_LOG) << "ImageMapChooseDialog::ImageMapChooseDialog"; | 41 | qCDebug(KIMAGEMAPEDITOR_LOG) << "ImageMapChooseDialog::ImageMapChooseDialog"; | ||
41 | if (parent == 0) { | 42 | if (parent == 0) { | ||
42 | qCWarning(KIMAGEMAPEDITOR_LOG) << "ImageMapChooseDialog: parent is null!"; | 43 | qCWarning(KIMAGEMAPEDITOR_LOG) << "ImageMapChooseDialog: parent is null!"; | ||
43 | } | 44 | } | ||
44 | 45 | | |||
45 | setWindowTitle(i18n( "Choose Map & Image to Edit" )); | 46 | setWindowTitle(i18n( "Choose Map & Image to Edit" )); | ||
▲ Show 20 Lines • Show All 152 Lines • ▼ Show 20 Line(s) | 198 | { | |||
198 | qCDebug(KIMAGEMAPEDITOR_LOG) << "ImageMapChooseDialog::slotImageChanged"; | 199 | qCDebug(KIMAGEMAPEDITOR_LOG) << "ImageMapChooseDialog::slotImageChanged"; | ||
199 | int i=imageListTable->currentRow(); | 200 | int i=imageListTable->currentRow(); | ||
200 | if (i < 0 || i > images.count()) | 201 | if (i < 0 || i > images.count()) | ||
201 | i = 0; | 202 | i = 0; | ||
202 | QImage pix; | 203 | QImage pix; | ||
203 | if (images.at(i)->contains("src")) { | 204 | if (images.at(i)->contains("src")) { | ||
204 | QString str = images.at(i)->value("src"); | 205 | QString str = images.at(i)->value("src"); | ||
205 | // relative url | 206 | // relative url | ||
206 | pixUrl=KUrl(baseUrl,str); | 207 | if (baseUrl.path().isEmpty() | !baseUrl.path().endsWith('/')) { | ||
208 | pixUrl=QUrl(baseUrl.path() + '/').resolved(QUrl(str)); | ||||
209 | } | ||||
210 | else { | ||||
211 | pixUrl=baseUrl.resolved(QUrl(str)); | ||||
212 | } | ||||
207 | pix=QImage(pixUrl.path()); | 213 | pix=QImage(pixUrl.path()); | ||
208 | double zoom1=1; | 214 | double zoom1=1; | ||
209 | double zoom2=1; | 215 | double zoom2=1; | ||
210 | if (pix.width()>300) | 216 | if (pix.width()>300) | ||
211 | zoom1=(double) 300/pix.width(); | 217 | zoom1=(double) 300/pix.width(); | ||
212 | if (pix.height()>200) | 218 | if (pix.height()>200) | ||
213 | zoom2=(double) 200/pix.height(); | 219 | zoom2=(double) 200/pix.height(); | ||
214 | 220 | | |||
Show All 35 Lines |