diff --git a/AnnotationDialog/ImagePreview.h b/AnnotationDialog/ImagePreview.h index 7808a57f..2b2ff951 100644 --- a/AnnotationDialog/ImagePreview.h +++ b/AnnotationDialog/ImagePreview.h @@ -1,143 +1,142 @@ /* Copyright (C) 2003-2010 Jesper K. Pedersen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef IMAGEPREVIEW_H #define IMAGEPREVIEW_H #include #include #include #include class QResizeEvent; class QRubberBand; namespace AnnotationDialog { class ResizableFrame; class ImagePreview : public QLabel, public ImageManager::ImageClientInterface { Q_OBJECT public: explicit ImagePreview(QWidget *parent); int heightForWidth(int width) const override; QSize sizeHint() const override; void rotate(int angle); void setImage(const DB::ImageInfo &info); void setImage(const QString &fileName); int angle() const; void anticipate(DB::ImageInfo &info1); void pixmapLoaded(ImageManager::ImageRequest *request, const QImage &image) override; QRect areaPreviewToActual(QRect area) const; QRect minMaxAreaPreview() const; void createTaggedArea(QString category, QString tag, QRect geometry, bool showArea); QSize getActualImageSize(); void acceptProposedTag(QPair tagData, ResizableFrame *area); QPixmap grabAreaImage(QRect area); public slots: void setAreaCreationEnabled(bool state); signals: void areaCreated(ResizableFrame *area); void proposedTagSelected(QString category, QString tag); protected: void resizeEvent(QResizeEvent *) override; void mousePressEvent(QMouseEvent *event) override; void mouseMoveEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent *event) override; void reload(); void setCurrentImage(const QImage &image); QImage rotateAndScale(QImage, int width, int height, int angle) const; void updateScaleFactors(); QRect areaActualToPreview(QRect area) const; void processNewArea(); void remapAreas(); void rotateAreas(int angle); class PreviewImage { public: bool has(const DB::FileName &fileName, int angle) const; QImage &getImage(); void set(const DB::FileName &fileName, const QImage &image, int angle); void set(const PreviewImage &other); void setAngle(int angle); void reset(); protected: DB::FileName m_fileName; QImage m_image; int m_angle; }; struct PreloadInfo { PreloadInfo(); void set(const DB::FileName &fileName, int angle); DB::FileName m_fileName; int m_angle; }; class PreviewLoader : public ImageManager::ImageClientInterface, public PreviewImage { public: void preloadImage(const DB::FileName &fileName, int width, int height, int angle); void cancelPreload(); void pixmapLoaded(ImageManager::ImageRequest *request, const QImage &image) override; }; PreviewLoader m_preloader; protected slots: void resizeFinished(); private: DB::ImageInfo m_info; QString m_fileName; PreviewImage m_currentImage, m_lastImage; PreloadInfo m_anticipated; int m_angle; int m_minX; int m_maxX; int m_minY; int m_maxY; QPoint m_areaStart; QPoint m_areaEnd; QPoint m_currentPos; QRubberBand *m_selectionRect; double m_scaleWidth; double m_scaleHeight; double m_aspectRatio; QTimer *m_reloadTimer; void createNewArea(QRect geometry, QRect actualGeometry); QRect rotateArea(QRect originalAreaGeometry, int angle); bool m_areaCreationEnabled; - QMap> m_imageSizes; QImage m_fullSizeImage; void fetchFullSizeImage(); bool fuzzyAreaExists(QList &existingAreas, QRect area); float distance(QPoint point1, QPoint point2); }; } #endif /* IMAGEPREVIEW_H */ // vi:expandtab:tabstop=4 shiftwidth=4: diff --git a/DB/OptimizedFileList.h b/DB/OptimizedFileList.h index 09b80913..d51eb11a 100644 --- a/DB/OptimizedFileList.h +++ b/DB/OptimizedFileList.h @@ -1,64 +1,65 @@ /* Copyright (C) 2018 Robert Krawitz This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef OPTIMIZEDFILELIST_H #define OPTIMIZEDFILELIST_H #include "FileNameList.h" +#include #include #include #include namespace DB { typedef QSet StringSet; typedef QMap DirMap; // Key is MD5 hash of the (opaque) contents of f_fsid typedef QMap FSMap; /** * Provide a list of files optimized by filesystem. * File names are interleaved across all filesystems * with files belonging to them. * * In other words, you can put in a list of files, and get * back a list that is optimized for read performance. */ class OptimizedFileList { public: explicit OptimizedFileList(const DB::FileNameList &files); explicit OptimizedFileList(const QStringList &files); QStringList optimizedFiles() const; DB::FileNameList optimizedDbFiles() const; private: OptimizedFileList(); void optimizeFiles() const; const QStringList m_fileList; mutable QStringList m_optimizedList; mutable bool m_haveOptimizedFiles; mutable FSMap m_fsMap; static QString getDirName(const QString &); }; } #endif /* OPTIMIZEDFILELIST_H */ // vi:expandtab:tabstop=4 shiftwidth=4: diff --git a/ImportExport/ImportSettings.h b/ImportExport/ImportSettings.h index 2432037b..8c6ed83a 100644 --- a/ImportExport/ImportSettings.h +++ b/ImportExport/ImportSettings.h @@ -1,94 +1,95 @@ /* Copyright (C) 2003-2010 Jesper K. Pedersen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef IMPORTSETTINGS_H #define IMPORTSETTINGS_H #include +#include #include namespace ImportExport { class CategoryMatchSetting { public: CategoryMatchSetting(const QString &DBCategoryName, const QString &XMLFileCategoryName) : m_XMLCategoryName(XMLFileCategoryName) , m_DBCategoryName(DBCategoryName) { } void add(const QString &DBFileNameItem, const QString &XMLFileNameItem); QString XMLCategoryName() const; QString DBCategoryName() const; const QMap &XMLtoDB() const; private: QString m_XMLCategoryName; QString m_DBCategoryName; QMap m_XMLtoDB; }; /** * The class contains all the data that is transported between the * ImportDialog, and the ImportHandler. The purpose of this class is to * decouple the above two. */ class ImportSettings { public: enum ImportAction { Replace = 1, Keep = 2, Merge = 3 }; void setSelectedImages(const DB::ImageInfoList &); DB::ImageInfoList selectedImages() const; void setDestination(const QString &); QString destination() const; void setExternalSource(bool b); bool externalSource() const; void setKimFile(const QUrl &kimFile); QUrl kimFile() const; void setBaseURL(const QUrl &url); QUrl baseURL() const; void setImportActions(const QMap &actions); ImportAction importAction(const QString &item); void addCategoryMatchSetting(const CategoryMatchSetting &); QList categoryMatchSetting() const; private: DB::ImageInfoList m_selectedImages; QString m_destination; bool m_externalSource; QUrl m_kimFile; QUrl m_baseURL; QMap m_actions; QList m_categoryMatchSettings; }; } #endif /* IMPORTSETTINGS_H */ // vi:expandtab:tabstop=4 shiftwidth=4: