Changeset View
Changeset View
Standalone View
Standalone View
app/kookaimage.cpp
Show First 20 Lines • Show All 120 Lines • ▼ Show 20 Line(s) | 114 | { | |||
---|---|---|---|---|---|
121 | if (url.hasFragment()) // is this a subimage? | 121 | if (url.hasFragment()) // is this a subimage? | ||
122 | { | 122 | { | ||
123 | int subno = url.fragment().toInt(); // get subimage number | 123 | int subno = url.fragment().toInt(); // get subimage number | ||
124 | if (subno>0) // valid number from fragment | 124 | if (subno>0) // valid number from fragment | ||
125 | { // get local file without fragment | 125 | { // get local file without fragment | ||
126 | const QString fileName = url.adjusted(QUrl::RemoveFragment).toLocalFile(); | 126 | const QString fileName = url.adjusted(QUrl::RemoveFragment).toLocalFile(); | ||
127 | qDebug() << "subimage" << subno << "from" << fileName; | 127 | qDebug() << "subimage" << subno << "from" << fileName; | ||
128 | loadTiffDir(fileName, subno); // load TIFF subimage | 128 | loadTiffDir(fileName, subno); // load TIFF subimage | ||
129 | return (QString::null); | 129 | return (QString()); | ||
130 | } | 130 | } | ||
131 | 131 | | |||
132 | } | 132 | } | ||
133 | 133 | | |||
134 | const QString filename = url.toLocalFile(); // local path of image | 134 | const QString filename = url.toLocalFile(); // local path of image | ||
135 | ImageFormat format = ImageFormat::formatForUrl(url); | 135 | ImageFormat format = ImageFormat::formatForUrl(url); | ||
136 | 136 | | |||
137 | // If the file is TIFF and QImageReader supports TIFF files, 'format' as | 137 | // If the file is TIFF and QImageReader supports TIFF files, 'format' as | ||
Show All 36 Lines | 173 | #ifdef HAVE_TIFF | |||
174 | else // a TIFF file, multi-page or not | 174 | else // a TIFF file, multi-page or not | ||
175 | { | 175 | { | ||
176 | loadTiffDir(filename, 0); // read by TIFFlib directly | 176 | loadTiffDir(filename, 0); // read by TIFFlib directly | ||
177 | } | 177 | } | ||
178 | #endif | 178 | #endif | ||
179 | 179 | | |||
180 | m_url = url; // record image source | 180 | m_url = url; // record image source | ||
181 | m_fileBound = true; // note loaded from file | 181 | m_fileBound = true; // note loaded from file | ||
182 | return (QString::null); // loaded OK | 182 | return (QString()); // loaded OK | ||
183 | } | 183 | } | ||
184 | 184 | | |||
185 | 185 | | |||
186 | QString KookaImage::loadTiffDir(const QString &filename, int subno) | 186 | QString KookaImage::loadTiffDir(const QString &filename, int subno) | ||
187 | { | 187 | { | ||
188 | #ifdef HAVE_TIFF | 188 | #ifdef HAVE_TIFF | ||
189 | // if it is TIFF, check with TIFFlib if it is multiple images | 189 | // if it is TIFF, check with TIFFlib if it is multiple images | ||
190 | qDebug() << "Trying to load TIFF, subimage" << subno; | 190 | qDebug() << "Trying to load TIFF, subimage" << subno; | ||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 252 | tmpImg = tmpImg.scaled(int(imgWidth * xScalefactor), imgHeight, | |||
253 | Qt::IgnoreAspectRatio, Qt::SmoothTransformation); | 253 | Qt::IgnoreAspectRatio, Qt::SmoothTransformation); | ||
254 | } | 254 | } | ||
255 | } | 255 | } | ||
256 | 256 | | |||
257 | QImage::operator=(tmpImg); // copy as our image | 257 | QImage::operator=(tmpImg); // copy as our image | ||
258 | #else | 258 | #else | ||
259 | return (i18n("TIFF not supported")); | 259 | return (i18n("TIFF not supported")); | ||
260 | #endif // HAVE_TIFF | 260 | #endif // HAVE_TIFF | ||
261 | return (QString::null); // TIFF read succeeded | 261 | return (QString()); // TIFF read succeeded | ||
262 | } | 262 | } | ||
263 | 263 | | |||
264 | 264 | | |||
265 | int KookaImage::subImagesCount() const | 265 | int KookaImage::subImagesCount() const | ||
266 | { | 266 | { | ||
267 | return (m_subImages); | 267 | return (m_subImages); | ||
268 | } | 268 | } | ||
269 | 269 | | |||
▲ Show 20 Lines • Show All 89 Lines • Show Last 20 Lines |