diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/debian/changelog gallery-app-0.0.67daily13.06.04ubuntu.unity.next/debian/changelog --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/debian/changelog 2013-06-04 07:12:43.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/debian/changelog 2013-06-04 07:12:43.000000000 +0000 @@ -1,3 +1,17 @@ +gallery-app (0.0.67daily13.06.04ubuntu.unity.next-0ubuntu1) raring; urgency=low + + [ Omer Akram ] + * Fixes a few pep8 complaints. + + [ Guenter Schwann ] + * Split gallery into static libraries, for better modualirity, and + easier testing. + + [ Ubuntu daily release ] + * Automatic snapshot from revision 680 (ubuntu-unity/next) + + -- Ubuntu daily release Tue, 04 Jun 2013 06:59:09 +0000 + gallery-app (0.0.67daily13.05.31.1ubuntu.unity.next-0ubuntu1) raring; urgency=low [ Ken VanDine ] diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/CMakeLists.txt gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/CMakeLists.txt --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/CMakeLists.txt 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/CMakeLists.txt 2013-06-04 06:58:54.000000000 +0000 @@ -1,5 +1,14 @@ project(gallery_src) +add_subdirectory(album) +add_subdirectory(core) +add_subdirectory(database) +add_subdirectory(event) +add_subdirectory(media) +add_subdirectory(photo) +add_subdirectory(qml) +add_subdirectory(util) + configure_file( config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @@ -10,117 +19,35 @@ include_directories( ${CMAKE_BINARY_DIR} - ${EXIV2_INCLUDEDIR} ${GSTLIB_INCLUDE_DIRS} ) set(gallery_HDRS gallery-application.h - album/album.h - album/album-collection.h - album/album-default-template.h - album/album-page.h - album/album-template.h - album/album-template-page.h - core/command-line-parser.h - core/container-source.h - core/container-source-collection.h - core/data-collection.h - core/data-object.h - core/data-source.h - core/gallery-manager.h - core/selectable-view-collection.h - core/source-collection.h - core/view-collection.h - database/album-table.h - database/database.h - database/media-table.h - database/photo-edit-table.h - event/event.h - event/event-collection.h - media/media-collection.h - media/media-monitor.h - media/media-source.h - media/preview-manager.h - photo/photo.h - photo/photo-caches.h - photo/photo-edit-state.h - photo/photo-metadata.h - qml/gallery-standard-image-provider.h - qml/gallery-thumbnail-image-provider.h - qml/qml-album-collection-model.h - qml/qml-event-collection-model.h - qml/qml-event-overview-model.h - qml/qml-media-collection-model.h - qml/qml-view-collection-model.h - util/collections.h - util/imaging.h - util/resource.h - util/sharefile.h - util/variants.h + gallery-manager.h ) set(gallery_SRCS gallery-application.cpp + gallery-manager.cpp main.cpp - album/album.cpp - album/album-default-template.cpp - album/album-collection.cpp - album/album-page.cpp - album/album-template.cpp - album/album-template-page.cpp - core/command-line-parser.cpp - core/container-source.cpp - core/container-source-collection.cpp - core/data-collection.cpp - core/data-object.cpp - core/data-source.cpp - core/gallery-manager.cpp - core/selectable-view-collection.cpp - core/source-collection.cpp - core/view-collection.cpp - database/album-table.cpp - database/database.cpp - database/media-table.cpp - database/photo-edit-table.cpp - event/event.cpp - event/event-collection.cpp - media/media-collection.cpp - media/media-monitor.cpp - media/media-source.cpp - media/preview-manager.cpp - photo/photo.cpp - photo/photo-caches.cpp - photo/photo-edit-state.cpp - photo/photo-metadata.cpp - qml/gallery-standard-image-provider.cpp - qml/gallery-thumbnail-image-provider.cpp - qml/qml-album-collection-model.cpp - qml/qml-event-collection-model.cpp - qml/qml-event-overview-model.cpp - qml/qml-media-collection-model.cpp - qml/qml-view-collection-model.cpp - util/imaging.cpp - util/resource.cpp - util/sharefile.cpp ) add_executable(${GALLERY} - ${gallery_MOC_SRCS} ${gallery_SRCS} ) -qt5_use_modules(${GALLERY} Widgets Core Qml Quick OpenGL Sql) - -if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") - set(GL_LIBRARIES ${GLESv2_LIBRARIES}) -else() - set(GL_LIBRARIES ${OPENGL_LIBRARIES}) -endif() +qt5_use_modules(${GALLERY} Widgets Core Qml Quick Sql) target_link_libraries( ${GALLERY} - ${EXIV2_LIBRARIES} - ${GL_LIBRARIES} + gallery-album + gallery-core + gallery-database + gallery-event + gallery-media + gallery-photo + gallery-qml + gallery-util ${GSTLIB_LDFLAGS} ) diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/album/CMakeLists.txt gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/album/CMakeLists.txt --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/album/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/album/CMakeLists.txt 2013-06-04 06:58:54.000000000 +0000 @@ -0,0 +1,37 @@ +project(gallery_album_src) + +set(GALLERY_ALBUM_LIB gallery-album) + +include_directories( + ${gallery_src_SOURCE_DIR} + ${CMAKE_BINARY_DIR} + ${GSTLIB_INCLUDE_DIRS} + ) + +set(gallery_album_HDRS + album.h + album-collection.h + album-default-template.h + album-page.h + album-template.h + album-template-page.h + ) + +set(gallery_album_SRCS + album.cpp + album-default-template.cpp + album-collection.cpp + album-page.cpp + album-template.cpp + album-template-page.cpp + ) + +add_library(${GALLERY_ALBUM_LIB} + ${gallery_album_SRCS} + ) + +qt5_use_modules(${GALLERY_ALBUM_LIB} Widgets Core Qml) + +target_link_libraries( ${GALLERY_ALBUM_LIB} + ${GSTLIB_LDFLAGS} + ) diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/album/album-collection.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/album/album-collection.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/album/album-collection.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/album/album-collection.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -17,11 +17,11 @@ * Jim Nelson */ -#include "album/album-collection.h" +#include "album-collection.h" #include "media/media-collection.h" #include "database/database.h" #include "database/album-table.h" -#include "core/gallery-manager.h" +#include "gallery-manager.h" /*! * \brief AlbumCollection::AlbumCollection diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/album/album-collection.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/album/album-collection.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/album/album-collection.h 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/album/album-collection.h 2013-06-04 06:58:54.000000000 +0000 @@ -22,7 +22,7 @@ #include -#include "album/album.h" +#include "album.h" #include "core/container-source-collection.h" #include "core/data-object.h" diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/album/album-default-template.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/album/album-default-template.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/album/album-default-template.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/album/album-default-template.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -18,7 +18,7 @@ * Charles Lindsay */ -#include "album/album-default-template.h" +#include "album-default-template.h" /*! * \brief AlbumDefaultTemplate::AlbumDefaultTemplate diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/album/album-default-template.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/album/album-default-template.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/album/album-default-template.h 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/album/album-default-template.h 2013-06-04 06:58:54.000000000 +0000 @@ -23,7 +23,7 @@ #include -#include "album/album-template.h" +#include "album-template.h" /*! * \brief The AlbumDefaultTemplate class diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/album/album-page.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/album/album-page.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/album/album-page.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/album/album-page.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -18,11 +18,11 @@ */ #include "album-page.h" -#include "album/album.h" +#include "album.h" #include "media/media-collection.h" #include "util/collections.h" #include "util/resource.h" -#include "core/gallery-manager.h" +#include "gallery-manager.h" /*! * \brief AlbumPage::AlbumPage @@ -88,7 +88,7 @@ */ QUrl AlbumPage::qml_rc() const { - return GalleryManager::instance()->resource()->get_rc_url(template_page_->qml_rc()); + return Resource::get_rc_url(template_page_->qml_rc()); } /*! diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/album/album-page.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/album/album-page.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/album/album-page.h 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/album/album-page.h 2013-06-04 06:58:54.000000000 +0000 @@ -23,7 +23,7 @@ #include #include -#include "album/album-template-page.h" +#include "album-template-page.h" #include "core/container-source.h" #include "media/media-source.h" diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/album/album-template-page.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/album/album-template-page.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/album/album-template-page.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/album/album-template-page.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -17,7 +17,7 @@ * Jim Nelson */ -#include "album/album-template-page.h" +#include "album-template-page.h" /*! * \brief AlbumTemplatePage::AlbumTemplatePage diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/album/album-template.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/album/album-template.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/album/album-template.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/album/album-template.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -17,7 +17,7 @@ * Jim Nelson */ -#include "album/album-template.h" +#include "album-template.h" /*! * \brief AlbumTemplate::AlbumTemplate diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/album/album-template.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/album/album-template.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/album/album-template.h 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/album/album-template.h 2013-06-04 06:58:54.000000000 +0000 @@ -24,7 +24,7 @@ #include #include -#include "album/album-template-page.h" +#include "album-template-page.h" /*! * \brief The AlbumTemplate class diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/album/album.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/album/album.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/album/album.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/album/album.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -20,12 +20,12 @@ #include "album.h" -#include "album/album-collection.h" -#include "album/album-default-template.h" -#include "core/gallery-manager.h" +#include "album-collection.h" +#include "album-default-template.h" #include "core/selectable-view-collection.h" #include "database/album-table.h" #include "database/database.h" +#include "gallery-manager.h" #include "media/media-collection.h" #include "qml/qml-media-collection-model.h" #include "util/variants.h" diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/album/album.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/album/album.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/album/album.h 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/album/album.h 2013-06-04 06:58:54.000000000 +0000 @@ -26,8 +26,8 @@ #include #include -#include "album/album-page.h" -#include "album/album-template.h" +#include "album-page.h" +#include "album-template.h" #include "core/container-source.h" #include "media/media-source.h" diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/CMakeLists.txt gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/CMakeLists.txt --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/CMakeLists.txt 2013-06-04 06:58:54.000000000 +0000 @@ -0,0 +1,41 @@ +project(gallery_core_src) + +set(GALLERY_CORE_LIB gallery-core) + +include_directories( + ${gallery_src_SOURCE_DIR} + ${CMAKE_BINARY_DIR} + ${GSTLIB_INCLUDE_DIRS} + ) + +set(gallery_core_HDRS + container-source.h + container-source-collection.h + data-collection.h + data-object.h + data-source.h + selectable-view-collection.h + source-collection.h + view-collection.h + ) + +set(gallery_core_SRCS + container-source.cpp + container-source-collection.cpp + data-collection.cpp + data-object.cpp + data-source.cpp + selectable-view-collection.cpp + source-collection.cpp + view-collection.cpp + ) + +add_library(${GALLERY_CORE_LIB} + ${gallery_core_SRCS} + ) + +qt5_use_modules(${GALLERY_CORE_LIB} Core Quick) + +target_link_libraries( ${GALLERY_CORE_LIB} + ${GSTLIB_LDFLAGS} + ) diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/command-line-parser.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/command-line-parser.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/command-line-parser.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/command-line-parser.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,122 +0,0 @@ -/* - * Copyright (C) 2013 Canonical, Ltd. - * - * Authors: - * Nicolas d'Offay - * - * 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; version 3. - * - * 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. If not, see . - * - */ - -#include "core/command-line-parser.h" - -#include -#include -#include - -CommandLineParser::CommandLineParser(const QHash& form_factors) - : startup_timer_(false), - is_fullscreen_(false), - is_portrait_(false), - pictures_dir_(QDir(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation))), - log_image_loading_(false), - form_factors_(form_factors), - form_factor_("desktop") -{ -} - -/*! - * @brief CommandLineParser::process_args parsers our input commandline args and sets attributes accordingly. - * @param QStringList of commandline args to parse and set attributes. - * @return false if invalid parameter is input or -h/--help is called. - */ -bool CommandLineParser::process_args(const QStringList& args) -{ - bool valid_args = true; - - for (int i = 1; i < args.count(); ++i) - { - QString value = (i + 1 < args.count() ? args[i + 1] : ""); - - if (args[i] == "--help" || args[i] == "-h") { - usage(); - return false; - } - else if (args[i] == "--landscape") { - is_portrait_ = false; - } - else if (args[i] == "--portrait") { - is_portrait_ = true; - } - else if (args[i] == "--fullscreen") { - is_fullscreen_ = true; - } - else if (args[i] == "--startup-timer") { - startup_timer_ = true; - } - else if (args[i] == "--log-image-loading") { - log_image_loading_ = true; - } - else { - QString form_factor = args[i].mid(2); // minus initial "--" - - if (args[i].startsWith("--") && form_factors_.keys().contains(form_factor)) { - form_factor_ = form_factor; - } - else if (args[i].startsWith("--desktop_file_hint")) { - // ignore this command line switch, hybris uses it to get application info - } - else if (i == args.count() - 1 && QDir(args[i]).exists()) { - pictures_dir_ = QDir(args[i]); - } - else { - valid_args = !invalid_arg(args[i]); - } - } - } - - return valid_args; -} - -/*! - * @brief CommandLineParser::usage() prints out our form factors. - */ -void CommandLineParser::usage() -{ - QTextStream out(stdout); - out << "Usage: gallery [options] [pictures_dir]" << endl; - out << "Options:" << endl; - out << " --landscape\trun in landscape orientation (default)" << endl; - out << " --portrait\trun in portrait orientation" << endl; - out << " --fullscreen\trun fullscreen" << endl; - - foreach (const QString& form_factor, form_factors_.keys()) { - out << " --" << form_factor << "\trun in " << form_factor << " form factor" << endl; - } - - out << " --startup-timer\n\t\tdebug-print startup time" << endl; - out << " --log-image-loading\n\t\tlog image loading" << endl; - out << "pictures_dir defaults to ~/Pictures, and must exist prior to running gallery" << endl; -} - -/*! - * @brief CommandLineParser::invalid_arg() if an invalid argument is contained in our QStringList. - * @return returns true. - */ -bool CommandLineParser::invalid_arg(QString arg) -{ - QTextStream(stderr) << "Invalid argument '" << arg << "'" << endl; - usage(); - - return true; -} diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/command-line-parser.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/command-line-parser.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/command-line-parser.h 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/command-line-parser.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2013 Canonical, Ltd. - * - * Authors: - * Nicolas d'Offay - * - * 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; version 3. - * - * 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. If not, see . - * - */ - -#ifndef COMMANDLINEPARSER_H -#define COMMANDLINEPARSER_H - -#include -#include -#include -#include - -/*! - * @brief The CommandLineParser is used to parse our commandline inputs and set parameters accordingly. - */ -class CommandLineParser -{ -public: - CommandLineParser(const QHash& form_factors); - - bool process_args(const QStringList& args); - - QDir pictures_dir() const { return pictures_dir_; } - bool is_portrait() const { return is_portrait_; } - bool is_fullscreen() const { return is_fullscreen_; } - bool startup_timer() const { return startup_timer_; } - bool log_image_loading() const { return log_image_loading_; } - - QString form_factor() { return form_factor_; } - -private: - bool invalid_arg(QString arg); - void usage(); - - bool startup_timer_; - bool is_fullscreen_; - bool is_portrait_; - QDir pictures_dir_; - - bool log_image_loading_; - - const QHash form_factors_; - QString form_factor_; -}; - -#endif // COMMANDLINEPARSER_H diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/container-source-collection.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/container-source-collection.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/container-source-collection.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/container-source-collection.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -17,7 +17,7 @@ * Jim Nelson */ -#include "core/container-source-collection.h" +#include "container-source-collection.h" /*! * \brief ContainerSourceCollection::ContainerSourceCollection diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/container-source-collection.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/container-source-collection.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/container-source-collection.h 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/container-source-collection.h 2013-06-04 06:58:54.000000000 +0000 @@ -22,8 +22,8 @@ #include -#include "core/data-object.h" -#include "core/source-collection.h" +#include "data-object.h" +#include "source-collection.h" /** * ContainerSourceCollection is a SourceCollection that holds ContainerSources. diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/container-source.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/container-source.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/container-source.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/container-source.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -17,7 +17,7 @@ * Jim Nelson */ -#include "core/container-source.h" +#include "container-source.h" /*! * \brief ContainerSource::ContainerSource diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/container-source.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/container-source.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/container-source.h 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/container-source.h 2013-06-04 06:58:54.000000000 +0000 @@ -23,9 +23,9 @@ #include #include -#include "core/data-object.h" -#include "core/data-source.h" -#include "core/view-collection.h" +#include "data-object.h" +#include "data-source.h" +#include "view-collection.h" /** * A ContainerSource is a DataSource that holds other DataSources. Generally diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/data-collection.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/data-collection.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/data-collection.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/data-collection.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -20,8 +20,7 @@ #include #include "data-collection.h" -#include "core/data-object.h" -#include "gallery-application.h" +#include "data-object.h" /*! * \brief DataCollection::DataCollection @@ -31,7 +30,7 @@ : name_(name.toUtf8()), comparator_(DefaultDataObjectComparator) { // All DataCollections are registered as C++ ownership; QML should never GC them - GalleryApplication::instance()->setObjectOwnership(this, QQmlEngine::CppOwnership); + QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); } /*! diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/data-object.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/data-object.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/data-object.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/data-object.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -20,7 +20,6 @@ #include #include "data-object.h" -#include "gallery-application.h" DataObjectNumber DataObject::next_number_ = 0; @@ -32,7 +31,7 @@ : QObject(parent), number_(next_number_++) { // All DataObjects are registered as C++ ownership; QML should never GC them - GalleryApplication::instance()->setObjectOwnership(this, QQmlEngine::CppOwnership); + QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); } /*! diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/data-source.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/data-source.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/data-source.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/data-source.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -17,8 +17,8 @@ * Jim Nelson */ -#include "core/data-source.h" -#include "core/source-collection.h" +#include "data-source.h" +#include "source-collection.h" /*! * \brief DataSource::DataSource diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/data-source.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/data-source.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/data-source.h 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/data-source.h 2013-06-04 06:58:54.000000000 +0000 @@ -20,7 +20,7 @@ #ifndef GALLERY_DATA_SOURCE_H_ #define GALLERY_DATA_SOURCE_H_ -#include "core/data-object.h" +#include "data-object.h" class SourceCollection; diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/gallery-manager.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/gallery-manager.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/gallery-manager.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/gallery-manager.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,120 +0,0 @@ -/* - * Copyright (C) 2013 Canonical, Ltd. - * - * Authors: - * Nicolas d'Offay - * - * 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; version 3. - * - * 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. If not, see . - * - */ - -#include "gallery-manager.h" -#include "album/album-collection.h" -#include "album/album-default-template.h" -#include "core/command-line-parser.h" -#include "database/database.h" -#include "event/event-collection.h" -#include "media/media-collection.h" -#include "media/preview-manager.h" -#include "qml/gallery-standard-image-provider.h" -#include "qml/gallery-thumbnail-image-provider.h" -#include "util/resource.h" - -GalleryManager* GalleryManager::gallery_mgr_ = NULL; - -/*! - * \brief GalleryManager::instance - * \param application_path_dir the directory of where the executable is - * \param pictures_dir the directory of the images - * \param view the view is used to determine the max texture size - * \param log_image_loading if true, the image loadings times are printed to stdout - * \return - */ -GalleryManager* GalleryManager::instance(const QDir &pictures_dir, - QQuickView *view, const bool log_image_loading) -{ - if (!gallery_mgr_) - gallery_mgr_ = new GalleryManager(pictures_dir, view, log_image_loading); - - return gallery_mgr_; -} - -GalleryManager::GalleryManager(const QDir& pictures_dir, - QQuickView *view, const bool log_image_loading) - : collections_initialised(false), - resource_(new Resource(view)), - gallery_standard_image_provider_(new GalleryStandardImageProvider(log_image_loading)), - gallery_thumbnail_image_provider_(new GalleryThumbnailImageProvider(log_image_loading)), - database_(NULL), - default_template_(NULL), - media_collection_(NULL), - album_collection_(NULL), - event_collection_(NULL), - preview_manager_(NULL), - pictures_dir_(pictures_dir) -{ - const int maxTextureSize = resource_->maxTextureSize(); - gallery_standard_image_provider_->setMaxLoadResolution(maxTextureSize); -} - -void GalleryManager::post_init() -{ - if (!collections_initialised) - { - qDebug("Opening %s...", qPrintable(pictures_dir_.path())); - - Exiv2::LogMsg::setLevel(Exiv2::LogMsg::mute); - - database_ = new Database(pictures_dir_); - database_->get_media_table()->verify_files(); - default_template_ = new AlbumDefaultTemplate(); - media_collection_ = new MediaCollection(pictures_dir_); - album_collection_ = new AlbumCollection(); - event_collection_ = new EventCollection(); - preview_manager_ = new PreviewManager(); - - collections_initialised = true; - - qDebug("Opened %s", qPrintable(pictures_dir_.path())); - } -} - -GalleryManager::~GalleryManager() -{ - delete resource_; - resource_ = NULL; - - delete gallery_standard_image_provider_; - gallery_standard_image_provider_ = NULL; - - delete gallery_thumbnail_image_provider_; - gallery_thumbnail_image_provider_ = NULL; - - delete database_; - database_ = NULL; - - delete default_template_; - default_template_ = NULL; - - delete media_collection_; - media_collection_ = NULL; - - delete album_collection_; - album_collection_ = NULL; - - delete event_collection_; - event_collection_ = NULL; - - delete preview_manager_; - preview_manager_ = NULL; -} diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/gallery-manager.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/gallery-manager.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/gallery-manager.h 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/gallery-manager.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2013 Canonical, Ltd. - * - * Authors: - * Nicolas d'Offay - * - * 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; version 3. - * - * 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. If not, see . - * - */ -#ifndef GALLERYMANAGER_H -#define GALLERYMANAGER_H - -#include -#include - -class QQuickView; - -class Resource; -class GalleryStandardImageProvider; -class GalleryThumbnailImageProvider; -class Database; -class AlbumDefaultTemplate; -class MediaCollection; -class AlbumCollection; -class EventCollection; -class PreviewManager; -class GalleryManager; - -/*! - * Simple class which encapsulates instantiates objects which require only one instance. - */ -class GalleryManager -{ -public: - static GalleryManager* instance(const QDir& pictures_dir = QDir(), - QQuickView *view = 0, - const bool log_image_loading = false); - - /*! - * Called after main loop is initialised. See GalleryApplication::exec() comments. - */ - void post_init(); - - Database* database() { return database_; } - AlbumDefaultTemplate* album_default_template() { return default_template_; } - MediaCollection* media_collection() { return media_collection_; } - AlbumCollection* album_collection() { return album_collection_; } - EventCollection* event_collection() { return event_collection_; } - PreviewManager* preview_manager() { return preview_manager_; } - Resource* resource() { return resource_; } - GalleryStandardImageProvider* gallery_standard_image_provider() { return gallery_standard_image_provider_; } - GalleryThumbnailImageProvider* gallery_thumbnail_image_provider() { return gallery_thumbnail_image_provider_; } - -private: - GalleryManager(const QDir& pictures_dir, QQuickView *view, - const bool log_image_loading); - ~GalleryManager(); - - GalleryManager(const GalleryManager&); - void operator=(const GalleryManager&); - - static GalleryManager* gallery_mgr_; - - bool collections_initialised; - - Resource* resource_; - GalleryStandardImageProvider* gallery_standard_image_provider_; - GalleryThumbnailImageProvider* gallery_thumbnail_image_provider_; - - Database* database_; - AlbumDefaultTemplate* default_template_; - MediaCollection* media_collection_; - AlbumCollection* album_collection_; - EventCollection* event_collection_; - PreviewManager* preview_manager_; - - const QDir pictures_dir_; -}; - -#endif // GALLERYMANAGER_H diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/selectable-view-collection.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/selectable-view-collection.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/selectable-view-collection.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/selectable-view-collection.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -17,7 +17,7 @@ * Jim Nelson */ -#include "core/selectable-view-collection.h" +#include "selectable-view-collection.h" /*! * \brief SelectableViewCollection::SelectableViewCollection diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/selectable-view-collection.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/selectable-view-collection.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/selectable-view-collection.h 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/selectable-view-collection.h 2013-06-04 06:58:54.000000000 +0000 @@ -22,8 +22,8 @@ #include -#include "core/data-object.h" -#include "core/view-collection.h" +#include "data-object.h" +#include "view-collection.h" /** * SelectableViewCollection adds the notion of selection to a ViewCollection. diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/source-collection.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/source-collection.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/source-collection.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/source-collection.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -17,9 +17,8 @@ * Jim Nelson */ -#include "core/source-collection.h" - -#include "core/data-source.h" +#include "source-collection.h" +#include "data-source.h" /*! * \brief SourceCollection::SourceCollection diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/source-collection.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/source-collection.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/source-collection.h 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/source-collection.h 2013-06-04 06:58:54.000000000 +0000 @@ -20,7 +20,7 @@ #ifndef GALLERY_SOURCE_COLLECTION_H_ #define GALLERY_SOURCE_COLLECTION_H_ -#include "core/data-collection.h" +#include "data-collection.h" class DataSource; diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/view-collection.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/view-collection.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/view-collection.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/view-collection.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -17,7 +17,7 @@ * Jim Nelson */ -#include "core/view-collection.h" +#include "view-collection.h" /*! * \brief ViewCollection::ViewCollection diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/view-collection.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/view-collection.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/core/view-collection.h 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/core/view-collection.h 2013-06-04 06:58:54.000000000 +0000 @@ -20,8 +20,8 @@ #ifndef GALLERY_VIEW_COLLECTION_H_ #define GALLERY_VIEW_COLLECTION_H_ -#include "core/data-collection.h" -#include "core/source-collection.h" +#include "data-collection.h" +#include "source-collection.h" typedef bool (*SourceFilter)(DataObject* object); diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/database/CMakeLists.txt gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/database/CMakeLists.txt --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/database/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/database/CMakeLists.txt 2013-06-04 06:58:54.000000000 +0000 @@ -0,0 +1,33 @@ +project(gallery_database_src) + +set(GALLERY_DATABASE_LIB gallery-database) + +include_directories( + ${gallery_src_SOURCE_DIR} + ${CMAKE_BINARY_DIR} + ${GSTLIB_INCLUDE_DIRS} + ) + +set(gallery_database_HDRS + album-table.h + database.h + media-table.h + photo-edit-table.h + ) + +set(gallery_database_SRCS + album-table.cpp + database.cpp + media-table.cpp + photo-edit-table.cpp + ) + +add_library(${GALLERY_DATABASE_LIB} + ${gallery_database_SRCS} + ) + +qt5_use_modules(${GALLERY_DATABASE_LIB} Widgets Core Qml Quick Sql) + +target_link_libraries( ${GALLERY_DATABASE_LIB} + ${GSTLIB_LDFLAGS} + ) diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/database/album-table.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/database/album-table.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/database/album-table.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/database/album-table.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -21,7 +21,9 @@ #include "database.h" #include "album/album.h" #include "album/album-default-template.h" -#include "core/gallery-manager.h" +#include "gallery-manager.h" + +#include /*! * \brief AlbumTable::AlbumTable diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/database/database.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/database/database.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/database/database.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/database/database.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -22,10 +22,11 @@ #include "album-table.h" #include "media-table.h" #include "photo-edit-table.h" -#include "core/gallery-manager.h" #include "util/resource.h" #include +#include +#include const QString Database::DATABASE_DIR = ".database"; @@ -35,7 +36,8 @@ * \param parent */ Database::Database(const QDir& pictures_dir, QObject* parent) : - QObject(parent) + QObject(parent), + db_(new QSqlDatabase()) { QDir db_dir(pictures_dir); db_dir.mkdir(DATABASE_DIR); @@ -51,13 +53,13 @@ restore_from_backup(); // Attempt a query to make sure the DB is valid. - QSqlQuery test_query(db_); + QSqlQuery test_query(*db_); if (!test_query.exec("SELECT * FROM SQLITE_MASTER LIMIT 1")) { log_sql_error(test_query); restore_from_backup(); } - QSqlQuery query(db_); + QSqlQuery query(*db_); // Turn synchronous off. if (!query.exec("PRAGMA synchronous = OFF")) { log_sql_error(query); @@ -82,6 +84,7 @@ delete album_table_; delete media_table_; delete photo_edit_table_; + delete db_; create_backup(); } @@ -102,10 +105,10 @@ */ bool Database::open_db() { - db_ = QSqlDatabase::addDatabase("QSQLITE"); - db_.setDatabaseName(get_db_name()); - if (!db_.open()) { - qDebug() << "Error opening DB: " << db_.lastError().text(); + *db_ = QSqlDatabase::addDatabase("QSQLITE"); + db_->setDatabaseName(get_db_name()); + if (!db_->open()) { + qDebug() << "Error opening DB: " << db_->lastError().text(); return false; } @@ -118,7 +121,7 @@ */ int Database::get_schema_version() const { - QSqlQuery query(db_); + QSqlQuery query(*db_); if (!query.exec("PRAGMA user_version") || !query.next()) { log_sql_error(query); return -1; @@ -135,7 +138,7 @@ { // Must use string concats here since prepared statements // appear not to work with PRAGMAs. - QSqlQuery query(db_); + QSqlQuery query(*db_); if (!query.exec("PRAGMA user_version = " + QString::number(version))) log_sql_error(query); } @@ -190,7 +193,7 @@ continue; // Execute each statement. - QSqlQuery query(db_); + QSqlQuery query(*db_); if (!query.exec(statement)) { qDebug() << "Error executing database file: " << file.fileName(); log_sql_error(query); @@ -233,7 +236,7 @@ */ QSqlDatabase* Database::get_db() { - return &db_; + return db_; } /*! @@ -242,7 +245,7 @@ */ QDir Database::get_sql_dir() { - return QDir(GalleryManager::instance()->resource()->get_rc_url("sql").path()); + return QDir(Resource::get_rc_url("sql").path()); } /*! @@ -250,7 +253,7 @@ */ void Database::restore_from_backup() { - db_.close(); + db_->close(); // Remove existing DB. QFile bad_db(get_db_name()); diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/database/database.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/database/database.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/database/database.h 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/database/database.h 2013-06-04 06:58:54.000000000 +0000 @@ -21,20 +21,17 @@ #define DATABASE_H #include - -#include -#include -#include +#include #include - -#include "album-table.h" -#include "media-table.h" -#include "photo-edit-table.h" +#include class AlbumTable; class MediaTable; class PhotoEditTable; +class QSqlQuery; +class QSqlDatabase; + const qint64 INVALID_ID = -1; /*! @@ -90,7 +87,7 @@ void create_backup(); - QSqlDatabase db_; + QSqlDatabase* db_; QDir db_dir_; AlbumTable* album_table_; diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/database/media-table.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/database/media-table.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/database/media-table.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/database/media-table.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -18,6 +18,7 @@ */ #include +#include #include "media-table.h" #include "database.h" diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/database/photo-edit-table.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/database/photo-edit-table.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/database/photo-edit-table.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/database/photo-edit-table.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -18,9 +18,10 @@ */ #include +#include #include "photo-edit-table.h" -#include "database/database.h" +#include "database.h" #include "photo/photo-edit-state.h" /*! diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/event/CMakeLists.txt gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/event/CMakeLists.txt --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/event/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/event/CMakeLists.txt 2013-06-04 06:58:54.000000000 +0000 @@ -0,0 +1,29 @@ +project(gallery_event_src) + +set(GALLERY_EVENT_LIB gallery-event) + +include_directories( + ${gallery_src_SOURCE_DIR} + ${CMAKE_BINARY_DIR} + ${GSTLIB_INCLUDE_DIRS} + ) + +set(gallery_event_HDRS + event.h + event-collection.h + ) + +set(gallery_event_SRCS + event.cpp + event-collection.cpp + ) + +add_library(${GALLERY_EVENT_LIB} + ${gallery_event_SRCS} + ) + +qt5_use_modules(${GALLERY_EVENT_LIB} Widgets Core Qml) + +target_link_libraries( ${GALLERY_EVENT_LIB} + ${GSTLIB_LDFLAGS} + ) diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/event/event-collection.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/event/event-collection.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/event/event-collection.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/event/event-collection.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -18,11 +18,11 @@ */ #include "event-collection.h" +#include "event.h" #include "core/data-object.h" -#include "core/gallery-manager.h" -#include "event/event.h" #include "media/media-collection.h" #include "media/media-source.h" +#include "gallery-manager.h" /*! * \brief EventCollection::EventCollection diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/gallery-application.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/gallery-application.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/gallery-application.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/gallery-application.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -22,10 +22,9 @@ #include #include "gallery-application.h" +#include "gallery-manager.h" #include "album/album.h" #include "album/album-page.h" -#include "core/command-line-parser.h" -#include "core/gallery-manager.h" #include "event/event.h" #include "media/media-collection.h" #include "media/media-monitor.h" @@ -37,6 +36,7 @@ #include "qml/qml-event-collection-model.h" #include "qml/qml-event-overview-model.h" #include "qml/qml-media-collection-model.h" +#include "util/command-line-parser.h" #include "util/resource.h" #include "util/sharefile.h" @@ -156,7 +156,7 @@ view_.engine()->addImageProvider(GalleryThumbnailImageProvider::PROVIDER_ID, GalleryManager::instance()->gallery_thumbnail_image_provider()); - view_.setSource(GalleryManager::instance()->resource()->get_rc_url("qml/GalleryApplication.qml")); + view_.setSource(Resource::get_rc_url("qml/GalleryApplication.qml")); QObject::connect(view_.engine(), SIGNAL(quit()), this, SLOT(quit())); // Hook up our media_loaded signal to GalleryApplication's onLoaded function. @@ -206,16 +206,6 @@ } /*! - * \brief GalleryApplication::setObjectOwnership register objects' ownership (QML/Javascript vs. C++) - * \param object - * \param ownership - */ -void GalleryApplication::setObjectOwnership(QObject* object, QQmlEngine::ObjectOwnership ownership) -{ - view_.engine()->setObjectOwnership(object, ownership); -} - -/*! * \brief GalleryApplication::on_media_item_added * \param item_info */ diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/gallery-application.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/gallery-application.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/gallery-application.h 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/gallery-application.h 2013-06-04 06:58:54.000000000 +0000 @@ -20,16 +20,14 @@ #ifndef GALLERYAPPLICATION_H #define GALLERYAPPLICATION_H -#include "media/media-monitor.h" - #include -#include #include #include #include class CommandLineParser; class GalleryManager; +class MediaMonitor; /*! * \brief The GalleryApplication class @@ -46,8 +44,6 @@ static GalleryApplication* instance(); - void setObjectOwnership(QObject* object, QQmlEngine::ObjectOwnership ownership); - Q_INVOKABLE bool run_command(const QString &cmd, const QString &arg); QHash& form_factors() { return form_factors_; } diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/gallery-manager.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/gallery-manager.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/gallery-manager.cpp 1970-01-01 00:00:00.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/gallery-manager.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2013 Canonical, Ltd. + * + * Authors: + * Nicolas d'Offay + * + * 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; version 3. + * + * 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. If not, see . + * + */ + +#include "gallery-manager.h" +#include "album/album-collection.h" +#include "album/album-default-template.h" +#include "database/database.h" +#include "database/media-table.h" +#include "event/event-collection.h" +#include "media/media-collection.h" +#include "media/preview-manager.h" +#include "qml/gallery-standard-image-provider.h" +#include "qml/gallery-thumbnail-image-provider.h" +#include "util/command-line-parser.h" +#include "util/resource.h" + +GalleryManager* GalleryManager::gallery_mgr_ = NULL; + +/*! + * \brief GalleryManager::instance + * \param application_path_dir the directory of where the executable is + * \param pictures_dir the directory of the images + * \param view the view is used to determine the max texture size + * \param log_image_loading if true, the image loadings times are printed to stdout + * \return + */ +GalleryManager* GalleryManager::instance(const QDir &pictures_dir, + QQuickView *view, const bool log_image_loading) +{ + if (!gallery_mgr_) + gallery_mgr_ = new GalleryManager(pictures_dir, view, log_image_loading); + + return gallery_mgr_; +} + +GalleryManager::GalleryManager(const QDir& pictures_dir, + QQuickView *view, const bool log_image_loading) + : collections_initialised(false), + resource_(new Resource(view)), + gallery_standard_image_provider_(new GalleryStandardImageProvider()), + gallery_thumbnail_image_provider_(new GalleryThumbnailImageProvider()), + database_(NULL), + default_template_(NULL), + media_collection_(NULL), + album_collection_(NULL), + event_collection_(NULL), + preview_manager_(NULL), + pictures_dir_(pictures_dir) +{ + const int maxTextureSize = resource_->maxTextureSize(); + gallery_standard_image_provider_->setMaxLoadResolution(maxTextureSize); + gallery_standard_image_provider_->setLogging(log_image_loading); + gallery_thumbnail_image_provider_->setLogging(log_image_loading); +} + +void GalleryManager::post_init() +{ + if (!collections_initialised) + { + qDebug("Opening %s...", qPrintable(pictures_dir_.path())); + + Exiv2::LogMsg::setLevel(Exiv2::LogMsg::mute); + + database_ = new Database(pictures_dir_); + database_->get_media_table()->verify_files(); + default_template_ = new AlbumDefaultTemplate(); + media_collection_ = new MediaCollection(pictures_dir_); + album_collection_ = new AlbumCollection(); + event_collection_ = new EventCollection(); + preview_manager_ = new PreviewManager(); + + gallery_standard_image_provider_->setPreviewManager(preview_manager_); + gallery_thumbnail_image_provider_->setPreviewManager(preview_manager_); + + collections_initialised = true; + + qDebug("Opened %s", qPrintable(pictures_dir_.path())); + } +} + +GalleryManager::~GalleryManager() +{ + delete resource_; + resource_ = NULL; + + delete gallery_standard_image_provider_; + gallery_standard_image_provider_ = NULL; + + delete gallery_thumbnail_image_provider_; + gallery_thumbnail_image_provider_ = NULL; + + delete database_; + database_ = NULL; + + delete default_template_; + default_template_ = NULL; + + delete media_collection_; + media_collection_ = NULL; + + delete album_collection_; + album_collection_ = NULL; + + delete event_collection_; + event_collection_ = NULL; + + delete preview_manager_; + preview_manager_ = NULL; +} diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/gallery-manager.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/gallery-manager.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/gallery-manager.h 1970-01-01 00:00:00.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/gallery-manager.h 2013-06-04 06:58:54.000000000 +0000 @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2013 Canonical, Ltd. + * + * Authors: + * Nicolas d'Offay + * + * 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; version 3. + * + * 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. If not, see . + * + */ +#ifndef GALLERYMANAGER_H +#define GALLERYMANAGER_H + +#include +#include + +class QQuickView; + +class Resource; +class GalleryStandardImageProvider; +class GalleryThumbnailImageProvider; +class Database; +class AlbumDefaultTemplate; +class MediaCollection; +class AlbumCollection; +class EventCollection; +class PreviewManager; +class GalleryManager; + +/*! + * Simple class which encapsulates instantiates objects which require only one instance. + */ +class GalleryManager +{ +public: + static GalleryManager* instance(const QDir& pictures_dir = QDir(), + QQuickView *view = 0, + const bool log_image_loading = false); + + /*! + * Called after main loop is initialised. See GalleryApplication::exec() comments. + */ + void post_init(); + + Database* database() { return database_; } + AlbumDefaultTemplate* album_default_template() { return default_template_; } + MediaCollection* media_collection() { return media_collection_; } + AlbumCollection* album_collection() { return album_collection_; } + EventCollection* event_collection() { return event_collection_; } + PreviewManager* preview_manager() { return preview_manager_; } + Resource* resource() { return resource_; } + GalleryStandardImageProvider* gallery_standard_image_provider() { return gallery_standard_image_provider_; } + GalleryThumbnailImageProvider* gallery_thumbnail_image_provider() { return gallery_thumbnail_image_provider_; } + +private: + GalleryManager(const QDir& pictures_dir, QQuickView *view, + const bool log_image_loading); + ~GalleryManager(); + + GalleryManager(const GalleryManager&); + void operator=(const GalleryManager&); + + static GalleryManager* gallery_mgr_; + + bool collections_initialised; + + Resource* resource_; + GalleryStandardImageProvider* gallery_standard_image_provider_; + GalleryThumbnailImageProvider* gallery_thumbnail_image_provider_; + + Database* database_; + AlbumDefaultTemplate* default_template_; + MediaCollection* media_collection_; + AlbumCollection* album_collection_; + EventCollection* event_collection_; + PreviewManager* preview_manager_; + + const QDir pictures_dir_; +}; + +#endif // GALLERYMANAGER_H diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/media/CMakeLists.txt gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/media/CMakeLists.txt --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/media/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/media/CMakeLists.txt 2013-06-04 06:58:54.000000000 +0000 @@ -0,0 +1,33 @@ +project(gallery_media_src) + +set(GALLERY_MEDIA_LIB gallery-media) + +include_directories( + ${gallery_src_SOURCE_DIR} + ${CMAKE_BINARY_DIR} + ${GSTLIB_INCLUDE_DIRS} + ) + +set(gallery_media_HDRS + media-collection.h + media-monitor.h + media-source.h + preview-manager.h + ) + +set(gallery_media_SRCS + media-collection.cpp + media-monitor.cpp + media-source.cpp + preview-manager.cpp + ) + +add_library(${GALLERY_MEDIA_LIB} + ${gallery_media_SRCS} + ) + +qt5_use_modules(${GALLERY_MEDIA_LIB} Core Quick) + +target_link_libraries( ${GALLERY_MEDIA_LIB} + ${GSTLIB_LDFLAGS} + ) diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/media/media-collection.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/media/media-collection.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/media/media-collection.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/media/media-collection.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -22,10 +22,10 @@ #include #include "media-collection.h" -#include "core/gallery-manager.h" #include "photo/photo.h" #include "database/database.h" #include "database/media-table.h" +#include "gallery-manager.h" /*! * \brief MediaCollection::MediaCollection diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/media/media-source.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/media/media-source.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/media/media-source.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/media/media-source.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -17,17 +17,16 @@ * Jim Nelson */ -#include "media/media-source.h" - -#include "core/gallery-manager.h" +#include "media-source.h" +#include "preview-manager.h" #include "database/database.h" #include "database/media-table.h" #include "event/event.h" #include "event/event-collection.h" -#include "media/preview-manager.h" #include "qml/gallery-standard-image-provider.h" #include "qml/gallery-thumbnail-image-provider.h" #include "util/resource.h" +#include "gallery-manager.h" /*! * \brief MediaSource::MediaSource diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/media/preview-manager.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/media/preview-manager.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/media/preview-manager.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/media/preview-manager.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -21,9 +21,9 @@ #include #include "preview-manager.h" -#include "core/gallery-manager.h" -#include "media/media-collection.h" +#include "media-collection.h" #include "photo/photo.h" +#include "gallery-manager.h" const int PreviewManager::PREVIEW_WIDTH_MAX = 360; const int PreviewManager::PREVIEW_HEIGHT_MAX = 360; @@ -113,7 +113,7 @@ * \param file * \return */ -QFileInfo PreviewManager::PreviewFileFor(const QFileInfo& file) const +QFileInfo PreviewManager::PreviewFileFor(const QFileInfo& file) { return QFileInfo(file.dir(), PREVIEW_DIR + "/" + file.completeBaseName() + "_th." + PREVIEW_FILE_EXT); } @@ -123,7 +123,7 @@ * \param file * \return */ -QFileInfo PreviewManager::ThumbnailFileFor(const QFileInfo& file) const +QFileInfo PreviewManager::ThumbnailFileFor(const QFileInfo& file) { return QFileInfo(file.dir(), PREVIEW_DIR + "/" + file.completeBaseName() + "_th_s." + PREVIEW_FILE_EXT); } diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/media/preview-manager.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/media/preview-manager.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/media/preview-manager.h 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/media/preview-manager.h 2013-06-04 06:58:54.000000000 +0000 @@ -49,8 +49,8 @@ PreviewManager(); - QFileInfo PreviewFileFor(const QFileInfo& file) const; - QFileInfo ThumbnailFileFor(const QFileInfo& file) const; + static QFileInfo PreviewFileFor(const QFileInfo& file); + static QFileInfo ThumbnailFileFor(const QFileInfo& file); bool ensure_preview_for_media(QFileInfo file, bool regen = false); diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/photo/CMakeLists.txt gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/photo/CMakeLists.txt --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/photo/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/photo/CMakeLists.txt 2013-06-04 06:58:54.000000000 +0000 @@ -0,0 +1,35 @@ +project(gallery_photo_src) + +set(GALLERY_PHOTO_LIB gallery-photo) + +include_directories( + ${gallery_src_SOURCE_DIR} + ${CMAKE_BINARY_DIR} + ${EXIV2_INCLUDEDIR} + ${GSTLIB_INCLUDE_DIRS} + ) + +set(gallery_photo_HDRS + photo.h + photo-caches.h + photo-edit-state.h + photo-metadata.h + ) + +set(gallery_photo_SRCS + photo.cpp + photo-caches.cpp + photo-edit-state.cpp + photo-metadata.cpp + ) + +add_library(${GALLERY_PHOTO_LIB} + ${gallery_photo_SRCS} + ) + +qt5_use_modules(${GALLERY_PHOTO_LIB} Widgets Core Quick) + +target_link_libraries( ${GALLERY_PHOTO_LIB} + ${EXIV2_LIBRARIES} + ${GSTLIB_LDFLAGS} + ) diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/photo/photo-caches.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/photo/photo-caches.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/photo/photo-caches.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/photo/photo-caches.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -17,7 +17,7 @@ * Charles Lindsay */ -#include "photo/photo-caches.h" +#include "photo-caches.h" #include diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/photo/photo-edit-state.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/photo/photo-edit-state.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/photo/photo-edit-state.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/photo/photo-edit-state.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -17,7 +17,7 @@ * Charles Lindsay */ -#include "photo/photo-edit-state.h" +#include "photo-edit-state.h" /*! * \brief PhotoEditState::rotate_crop_rectangle diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/photo/photo-edit-state.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/photo/photo-edit-state.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/photo/photo-edit-state.h 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/photo/photo-edit-state.h 2013-06-04 06:58:54.000000000 +0000 @@ -23,7 +23,7 @@ #include #include -#include "photo/photo-metadata.h" +#include "photo-metadata.h" /*! * \brief The PhotoEditState class diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/photo/photo.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/photo/photo.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/photo/photo.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/photo/photo.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -28,7 +28,6 @@ #include #include "photo.h" -#include "core/gallery-manager.h" #include "database/database.h" #include "database/media-table.h" #include "database/photo-edit-table.h" @@ -36,6 +35,7 @@ #include "qml/gallery-standard-image-provider.h" #include "qml/gallery-thumbnail-image-provider.h" #include "util/imaging.h" +#include "gallery-manager.h" // A simple class for dealing with an undo-/redo-able stack of applied edits. class EditStack { diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/photo/photo.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/photo/photo.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/photo/photo.h 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/photo/photo.h 2013-06-04 06:58:54.000000000 +0000 @@ -25,10 +25,10 @@ #include #include +#include "photo-caches.h" +#include "photo-edit-state.h" +#include "photo-metadata.h" #include "media/media-source.h" -#include "photo/photo-metadata.h" -#include "photo/photo-edit-state.h" -#include "photo/photo-caches.h" class PhotoPrivate; diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/CMakeLists.txt gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/CMakeLists.txt --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/CMakeLists.txt 2013-06-04 06:58:54.000000000 +0000 @@ -0,0 +1,39 @@ +project(gallery_qml_src) + +set(GALLERY_QML_LIB gallery-qml) + +include_directories( + ${gallery_src_SOURCE_DIR} + ${CMAKE_BINARY_DIR} + ${GSTLIB_INCLUDE_DIRS} + ) + +set(gallery_qml_HDRS + gallery-standard-image-provider.h + gallery-thumbnail-image-provider.h + qml-album-collection-model.h + qml-event-collection-model.h + qml-event-overview-model.h + qml-media-collection-model.h + qml-view-collection-model.h + ) + +set(gallery_qml_SRCS + gallery-standard-image-provider.cpp + gallery-thumbnail-image-provider.cpp + qml-album-collection-model.cpp + qml-event-collection-model.cpp + qml-event-overview-model.cpp + qml-media-collection-model.cpp + qml-view-collection-model.cpp + ) + +add_library(${GALLERY_QML_LIB} + ${gallery_qml_SRCS} + ) + +qt5_use_modules(${GALLERY_QML_LIB} Core Quick) + +target_link_libraries( ${GALLERY_QML_LIB} + ${GSTLIB_LDFLAGS} + ) diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/gallery-standard-image-provider.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/gallery-standard-image-provider.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/gallery-standard-image-provider.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/gallery-standard-image-provider.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -26,7 +26,6 @@ #include "gallery-standard-image-provider.h" #include "media/preview-manager.h" -#include "core/gallery-manager.h" const char* GalleryStandardImageProvider::PROVIDER_ID = "gallery-standard"; const char* GalleryStandardImageProvider::PROVIDER_ID_SCHEME = "image://gallery-standard/"; @@ -45,10 +44,11 @@ /*! * \brief GalleryStandardImageProvider::GalleryStandardImageProvider */ -GalleryStandardImageProvider::GalleryStandardImageProvider(const bool log_image_loading) +GalleryStandardImageProvider::GalleryStandardImageProvider() : QQuickImageProvider(QQuickImageProvider::Image), cachedBytes_(0), - log_image_loading_(log_image_loading), + m_previewManager(0), + m_logImageLoading(false), maxLoadResolution_(INT_MAX) { } @@ -74,7 +74,7 @@ } #define LOG_IMAGE_STATUS(status) { \ - if (log_image_loading_) \ + if (m_logImageLoading) \ loggingStr += status; \ } @@ -88,6 +88,11 @@ QImage GalleryStandardImageProvider::requestImage(const QString& id, QSize* size, const QSize& requestedSize) { + if (!m_previewManager) { + qWarning() << Q_FUNC_INFO << "no PreviewManager set"; + return QImage(); + } + // for LOG_IMAGE_STATUS QString loggingStr = ""; QElapsedTimer timer; @@ -95,7 +100,7 @@ QUrl url(id); QFileInfo photoFile(url.path()); - GalleryManager::instance()->preview_manager()->ensure_preview_for_media(photoFile); + m_previewManager->ensure_preview_for_media(photoFile); CachedImage* cachedImage = claim_cached_image_entry(id, loggingStr); Q_ASSERT(cachedImage != NULL); @@ -110,7 +115,7 @@ int currentCacheEntries = 0; release_cached_image_entry(cachedImage, bytesLoaded, ¤tCachedBytes, ¤tCacheEntries); - if (log_image_loading_) { + if (m_logImageLoading) { if (bytesLoaded > 0) { qDebug("%s %s req:%dx%d ret:%dx%d cache:%ldb/%d loaded:%db time:%lldms", qPrintable(loggingStr), qPrintable(id), requestedSize.width(), requestedSize.height(), readyImage.width(), @@ -129,6 +134,16 @@ return readyImage; } +void GalleryStandardImageProvider::setPreviewManager(PreviewManager *previewManager) +{ + m_previewManager = previewManager; +} + +void GalleryStandardImageProvider::setLogging(bool enableLogging) +{ + m_logImageLoading = enableLogging; +} + /*! * \brief GalleryStandardImageProvider::setMaxLoadResolution sets the maximal size of the loaded * images. Images loaded are limited to a max width/height, but keep their aspect ratio. @@ -415,7 +430,7 @@ if (value == "1") { - QFileInfo thumbnailFile = GalleryManager::instance()->preview_manager()->PreviewFileFor(fileName); + QFileInfo thumbnailFile = PreviewManager::PreviewFileFor(fileName); fileName = thumbnailFile.absoluteFilePath(); } diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/gallery-standard-image-provider.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/gallery-standard-image-provider.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/gallery-standard-image-provider.h 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/gallery-standard-image-provider.h 2013-06-04 06:58:54.000000000 +0000 @@ -33,6 +33,8 @@ #include "photo/photo-metadata.h" +class PreviewManager; + /*! * Gallery uses a custom image provider for three reasons: * @@ -62,7 +64,7 @@ static const char* SIZE_KEY; - GalleryStandardImageProvider(const bool log_image_loading); + GalleryStandardImageProvider(); virtual ~GalleryStandardImageProvider(); static QUrl ToURL(const QFileInfo& file); @@ -70,6 +72,8 @@ virtual QImage requestImage(const QString& id, QSize* size, const QSize& requestedSize); + void setPreviewManager(PreviewManager* previewManager); + void setLogging(bool enableLogging); void setMaxLoadResolution(int resolution); private: @@ -105,7 +109,8 @@ QList fifo_; QMutex cacheMutex_; long cachedBytes_; - bool log_image_loading_; + PreviewManager* m_previewManager; + bool m_logImageLoading; int maxLoadResolution_; static QSize orientSize(const QSize& size, Orientation orientation); diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/gallery-thumbnail-image-provider.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/gallery-thumbnail-image-provider.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/gallery-thumbnail-image-provider.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/gallery-thumbnail-image-provider.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -18,7 +18,6 @@ */ #include "gallery-thumbnail-image-provider.h" -#include "core/gallery-manager.h" #include "media/preview-manager.h" #include @@ -26,15 +25,15 @@ const char* GalleryThumbnailImageProvider::PROVIDER_ID = "gallery-thumbnail"; const char* GalleryThumbnailImageProvider::PROVIDER_ID_SCHEME = "image://gallery-thumbnail/"; - const char* GalleryThumbnailImageProvider::REVISION_PARAM_NAME = "edit"; /*! * @brief GalleryThumbnailImageProvider::GalleryThumbnailImageProvider */ -GalleryThumbnailImageProvider::GalleryThumbnailImageProvider(const bool log_image_loading) +GalleryThumbnailImageProvider::GalleryThumbnailImageProvider() : QQuickImageProvider(QQuickImageProvider::Image), - log_image_loading_(log_image_loading) + m_previewManager(0), + m_logImageLoading(false) { } @@ -59,14 +58,20 @@ const QSize &requestedSize) { Q_UNUSED(requestedSize); + + if (!m_previewManager) { + qWarning() << Q_FUNC_INFO << "no PreviewManager set"; + return QImage(); + } + QElapsedTimer timer; timer.start(); QUrl url(id); QFileInfo photoFile(url.path()); - GalleryManager::instance()->preview_manager()->ensure_preview_for_media(photoFile); + m_previewManager->ensure_preview_for_media(photoFile); - QFileInfo thumbnailFile = GalleryManager::instance()->preview_manager()->ThumbnailFileFor(photoFile); + QFileInfo thumbnailFile = m_previewManager->ThumbnailFileFor(photoFile); QString fileName = thumbnailFile.absoluteFilePath(); QImage thumbnail; @@ -78,9 +83,19 @@ if (size != NULL) *size = thumbnail.size(); - if (log_image_loading_) { + if (m_logImageLoading) { qDebug() << id << thumbnail.size() << "time:" << timer.elapsed() << "ms"; } return thumbnail; } + +void GalleryThumbnailImageProvider::setPreviewManager(PreviewManager *previewManager) +{ + m_previewManager = previewManager; +} + +void GalleryThumbnailImageProvider::setLogging(bool enableLogging) +{ + m_logImageLoading = enableLogging; +} diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/gallery-thumbnail-image-provider.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/gallery-thumbnail-image-provider.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/gallery-thumbnail-image-provider.h 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/gallery-thumbnail-image-provider.h 2013-06-04 06:58:54.000000000 +0000 @@ -25,6 +25,8 @@ #include #include +class PreviewManager; + /*! * @brief The GalleryThumbailImageProvider class is used to load the small square thumbnails * @@ -39,15 +41,19 @@ static const char* PROVIDER_ID_SCHEME; static const char* REVISION_PARAM_NAME; - GalleryThumbnailImageProvider(const bool log_image_loading); + GalleryThumbnailImageProvider(); static QUrl ToURL(const QFileInfo& file); virtual QImage requestImage(const QString& id, QSize* size, const QSize& requestedSize); + void setPreviewManager(PreviewManager* previewManager); + void setLogging(bool enableLogging); + private: - bool log_image_loading_; + PreviewManager* m_previewManager; + bool m_logImageLoading; }; #endif // GALLERYTHUMBNAILIMAGEPROVIDER_H diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/qml-album-collection-model.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/qml-album-collection-model.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/qml-album-collection-model.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/qml-album-collection-model.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -21,9 +21,9 @@ #include "album/album.h" #include "album/album-collection.h" #include "album/album-default-template.h" -#include "core/gallery-manager.h" #include "core/selectable-view-collection.h" #include "util/variants.h" +#include "gallery-manager.h" /*! * \brief QmlAlbumCollectionModel::QmlAlbumCollectionModel diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/qml-album-collection-model.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/qml-album-collection-model.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/qml-album-collection-model.h 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/qml-album-collection-model.h 2013-06-04 06:58:54.000000000 +0000 @@ -24,7 +24,7 @@ #include #include -#include "qml/qml-view-collection-model.h" +#include "qml-view-collection-model.h" class Album; class DataObject; diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/qml-event-collection-model.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/qml-event-collection-model.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/qml-event-collection-model.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/qml-event-collection-model.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -18,10 +18,10 @@ */ #include "qml-event-collection-model.h" -#include "core/gallery-manager.h" #include "event/event.h" #include "event/event-collection.h" #include "util/variants.h" +#include "gallery-manager.h" /*! * \brief QmlEventCollectionModel::QmlEventCollectionModel diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/qml-event-collection-model.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/qml-event-collection-model.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/qml-event-collection-model.h 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/qml-event-collection-model.h 2013-06-04 06:58:54.000000000 +0000 @@ -24,7 +24,7 @@ #include #include -#include "qml/qml-view-collection-model.h" +#include "qml-view-collection-model.h" class DataObject; diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/qml-event-overview-model.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/qml-event-overview-model.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/qml-event-overview-model.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/qml-event-overview-model.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -19,11 +19,11 @@ #include "qml-event-overview-model.h" #include "core/data-object.h" -#include "core/gallery-manager.h" #include "core/selectable-view-collection.h" #include "event/event.h" #include "event/event-collection.h" #include "util/variants.h" +#include "gallery-manager.h" /*! * \brief QmlEventOverviewModel::QmlEventOverviewModel diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/qml-event-overview-model.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/qml-event-overview-model.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/qml-event-overview-model.h 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/qml-event-overview-model.h 2013-06-04 06:58:54.000000000 +0000 @@ -26,7 +26,7 @@ #include #include -#include "qml/qml-media-collection-model.h" +#include "qml-media-collection-model.h" class DataObject; diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/qml-media-collection-model.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/qml-media-collection-model.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/qml-media-collection-model.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/qml-media-collection-model.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -18,17 +18,17 @@ * Lucas Beeler */ -#include "qml/qml-media-collection-model.h" +#include "qml-media-collection-model.h" #include "album/album.h" #include "album/album-collection.h" #include "album/album-default-template.h" #include "core/data-object.h" -#include "core/gallery-manager.h" #include "core/selectable-view-collection.h" #include "media/media-source.h" #include "media/media-collection.h" #include "util/variants.h" +#include "gallery-manager.h" /*! * \brief QmlMediaCollectionModel::QmlMediaCollectionModel diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/qml-media-collection-model.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/qml-media-collection-model.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/qml/qml-media-collection-model.h 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/qml/qml-media-collection-model.h 2013-06-04 06:58:54.000000000 +0000 @@ -25,7 +25,7 @@ #include #include -#include "qml/qml-view-collection-model.h" +#include "qml-view-collection-model.h" class DataObject; diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/util/CMakeLists.txt gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/util/CMakeLists.txt --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/util/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/util/CMakeLists.txt 2013-06-04 06:58:54.000000000 +0000 @@ -0,0 +1,43 @@ +project(gallery_util_src) + +set(GALLERY_UTIL_LIB gallery-util) + +include_directories( + ${gallery_src_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/.. + ${CMAKE_BINARY_DIR} + ${GSTLIB_INCLUDE_DIRS} + ) + +set(gallery_util_HDRS + collections.h + command-line-parser.h + imaging.h + resource.h + sharefile.h + variants.h + ) + +set(gallery_util_SRCS + command-line-parser.cpp + imaging.cpp + resource.cpp + sharefile.cpp + ) + +add_library(${GALLERY_UTIL_LIB} + ${gallery_util_SRCS} + ) + +qt5_use_modules(${GALLERY_UTIL_LIB} Widgets Core) + +if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") + set(GL_LIBRARIES ${GLESv2_LIBRARIES}) +else() + set(GL_LIBRARIES ${OPENGL_LIBRARIES}) +endif() + +target_link_libraries( ${GALLERY_UTIL_LIB} + ${GL_LIBRARIES} + ${GSTLIB_LDFLAGS} + ) diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/util/command-line-parser.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/util/command-line-parser.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/util/command-line-parser.cpp 1970-01-01 00:00:00.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/util/command-line-parser.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2013 Canonical, Ltd. + * + * Authors: + * Nicolas d'Offay + * + * 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; version 3. + * + * 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. If not, see . + * + */ + +#include "command-line-parser.h" + +#include +#include +#include + +CommandLineParser::CommandLineParser(const QHash& form_factors) + : startup_timer_(false), + is_fullscreen_(false), + is_portrait_(false), + pictures_dir_(QDir(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation))), + log_image_loading_(false), + form_factors_(form_factors), + form_factor_("desktop") +{ +} + +/*! + * @brief CommandLineParser::process_args parsers our input commandline args and sets attributes accordingly. + * @param QStringList of commandline args to parse and set attributes. + * @return false if invalid parameter is input or -h/--help is called. + */ +bool CommandLineParser::process_args(const QStringList& args) +{ + bool valid_args = true; + + for (int i = 1; i < args.count(); ++i) + { + QString value = (i + 1 < args.count() ? args[i + 1] : ""); + + if (args[i] == "--help" || args[i] == "-h") { + usage(); + return false; + } + else if (args[i] == "--landscape") { + is_portrait_ = false; + } + else if (args[i] == "--portrait") { + is_portrait_ = true; + } + else if (args[i] == "--fullscreen") { + is_fullscreen_ = true; + } + else if (args[i] == "--startup-timer") { + startup_timer_ = true; + } + else if (args[i] == "--log-image-loading") { + log_image_loading_ = true; + } + else { + QString form_factor = args[i].mid(2); // minus initial "--" + + if (args[i].startsWith("--") && form_factors_.keys().contains(form_factor)) { + form_factor_ = form_factor; + } + else if (args[i].startsWith("--desktop_file_hint")) { + // ignore this command line switch, hybris uses it to get application info + } + else if (i == args.count() - 1 && QDir(args[i]).exists()) { + pictures_dir_ = QDir(args[i]); + } + else { + valid_args = !invalid_arg(args[i]); + } + } + } + + return valid_args; +} + +/*! + * @brief CommandLineParser::usage() prints out our form factors. + */ +void CommandLineParser::usage() +{ + QTextStream out(stdout); + out << "Usage: gallery [options] [pictures_dir]" << endl; + out << "Options:" << endl; + out << " --landscape\trun in landscape orientation (default)" << endl; + out << " --portrait\trun in portrait orientation" << endl; + out << " --fullscreen\trun fullscreen" << endl; + + foreach (const QString& form_factor, form_factors_.keys()) { + out << " --" << form_factor << "\trun in " << form_factor << " form factor" << endl; + } + + out << " --startup-timer\n\t\tdebug-print startup time" << endl; + out << " --log-image-loading\n\t\tlog image loading" << endl; + out << "pictures_dir defaults to ~/Pictures, and must exist prior to running gallery" << endl; +} + +/*! + * @brief CommandLineParser::invalid_arg() if an invalid argument is contained in our QStringList. + * @return returns true. + */ +bool CommandLineParser::invalid_arg(QString arg) +{ + QTextStream(stderr) << "Invalid argument '" << arg << "'" << endl; + usage(); + + return true; +} diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/util/command-line-parser.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/util/command-line-parser.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/util/command-line-parser.h 1970-01-01 00:00:00.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/util/command-line-parser.h 2013-06-04 06:58:54.000000000 +0000 @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2013 Canonical, Ltd. + * + * Authors: + * Nicolas d'Offay + * + * 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; version 3. + * + * 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. If not, see . + * + */ + +#ifndef COMMANDLINEPARSER_H +#define COMMANDLINEPARSER_H + +#include +#include +#include +#include + +/*! + * @brief The CommandLineParser is used to parse our commandline inputs and set parameters accordingly. + */ +class CommandLineParser +{ +public: + CommandLineParser(const QHash& form_factors); + + bool process_args(const QStringList& args); + + QDir pictures_dir() const { return pictures_dir_; } + bool is_portrait() const { return is_portrait_; } + bool is_fullscreen() const { return is_fullscreen_; } + bool startup_timer() const { return startup_timer_; } + bool log_image_loading() const { return log_image_loading_; } + + QString form_factor() { return form_factor_; } + +private: + bool invalid_arg(QString arg); + void usage(); + + bool startup_timer_; + bool is_fullscreen_; + bool is_portrait_; + QDir pictures_dir_; + + bool log_image_loading_; + + const QHash form_factors_; + QString form_factor_; +}; + +#endif // COMMANDLINEPARSER_H diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/util/imaging.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/util/imaging.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/util/imaging.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/util/imaging.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -21,7 +21,7 @@ #include #include -#include "util/imaging.h" +#include "imaging.h" /*! * \brief HSVTransformation::transform_pixel diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/util/resource.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/util/resource.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/util/resource.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/util/resource.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -42,7 +42,7 @@ * \param path * \return */ -QUrl Resource::get_rc_url(const QString& path) const +QUrl Resource::get_rc_url(const QString& path) { return isRunningInstalled() ? QUrl::fromLocalFile(galleryDirectory() + "/rc/" + path) : diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/util/resource.h gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/util/resource.h --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/src/util/resource.h 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/src/util/resource.h 2013-06-04 06:58:54.000000000 +0000 @@ -32,7 +32,7 @@ public: explicit Resource(QQuickView *view); - QUrl get_rc_url(const QString& path) const; + static QUrl get_rc_url(const QString& path); int maxTextureSize() const; diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/autopilot/gallery_app/emulators/album_editor.py gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/autopilot/gallery_app/emulators/album_editor.py --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/autopilot/gallery_app/emulators/album_editor.py 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/autopilot/gallery_app/emulators/album_editor.py 2013-06-04 06:58:54.000000000 +0000 @@ -52,5 +52,5 @@ def get_cover_menu_item(self, idx): """Returns the item of the cover menu with index idx""" - return self.app.select_many("Standard", + return self.app.select_many("Standard", objectName="albumCoverMenuItem")[idx] diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/autopilot/gallery_app/emulators/album_view.py gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/autopilot/gallery_app/emulators/album_view.py --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/autopilot/gallery_app/emulators/album_view.py 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/autopilot/gallery_app/emulators/album_view.py 2013-06-04 06:58:54.000000000 +0000 @@ -29,8 +29,8 @@ def get_first_photo(self): """Returns the first photo in a newly opened album""" - return self.app.select_many("FramePortrait", - visible=True, isLoaded=True)[0] + return self.app.select_many( + "FramePortrait", visible=True, isLoaded=True)[0] def get_album_photo_view(self): """Returns the photo view of the album viewer""" diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/autopilot/gallery_app/tests/__init__.py gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/autopilot/gallery_app/tests/__init__.py --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/autopilot/gallery_app/tests/__init__.py 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/autopilot/gallery_app/tests/__init__.py 2013-06-04 06:58:54.000000000 +0000 @@ -83,15 +83,18 @@ sleep(1) def launch_test_local(self): - self.app = self.launch_test_application(self.local_location, + self.app = self.launch_test_application( + self.local_location, self.sample_dir) def launch_test_installed(self): if model() == 'Desktop': - self.app = self.launch_test_application("gallery-app", + self.app = self.launch_test_application( + "gallery-app", self.sample_dir) else: - self.app = self.launch_test_application("gallery-app", + self.app = self.launch_test_application( + "gallery-app", "--desktop_file_hint=/usr/share/applications/gallery-app.desktop", self.sample_dir, app_type='qt') @@ -103,8 +106,8 @@ def click_item(self, item, delay=0.1): """Does a mouse click on the passed item, and moved the mouse there before""" - #In jenkins test may fail because we don't wait before clicking the target - #so we add a little delay before click. + # In jenkins test may fail because we don't wait before clicking the + # target so we add a little delay before click. if model() == 'Desktop' and delay <= 0.25: delay = 0.25 diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/autopilot/gallery_app/tests/test_album_editor.py gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/autopilot/gallery_app/tests/test_album_editor.py --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/autopilot/gallery_app/tests/test_album_editor.py 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/autopilot/gallery_app/tests/test_album_editor.py 2013-06-04 06:58:54.000000000 +0000 @@ -150,16 +150,16 @@ def test_cover_image(self): """Test to change the album cover image""" cover_image = self.album_editor.get_album_cover_image() - self.assertThat(cover_image.source.endswith("album-cover-default-large.png"), - Equals(True)) + self.assertThat( + cover_image.source.endswith("album-cover-default-large.png"), Equals(True)) # click somewhere rather at the bottom of the cover x, y, w, h = cover_image.globalRect - self.pointing_device.move(x + int(w/2), y + h - int(h/10) ) + self.pointing_device.move(x + int(w / 2), y + h - int(h / 10)) self.pointing_device.click() green_item = self.album_editor.get_cover_menu_item(2) self.click_item(green_item) - self.assertThat(cover_image.source.endswith("album-cover-green-large.png"), - Equals(True)) + self.assertThat( + cover_image.source.endswith("album-cover-green-large.png"), Equals(True)) diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/CMakeLists.txt gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/CMakeLists.txt --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/CMakeLists.txt 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/CMakeLists.txt 2013-06-04 06:58:54.000000000 +0000 @@ -1,5 +1,5 @@ -add_subdirectory(command-line-parser) -add_subdirectory(gallerystandardimageprovider) -add_subdirectory(gallerythumbnailimageprovider) -add_subdirectory(imaging) -add_subdirectory(resource) +add_subdirectory(command-line-parser) +add_subdirectory(gallerystandardimageprovider) +add_subdirectory(gallerythumbnailimageprovider) +add_subdirectory(imaging) +add_subdirectory(resource) diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/command-line-parser/CMakeLists.txt gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/command-line-parser/CMakeLists.txt --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/command-line-parser/CMakeLists.txt 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/command-line-parser/CMakeLists.txt 2013-06-04 06:58:54.000000000 +0000 @@ -7,20 +7,20 @@ include_directories( ${CMAKE_BINARY_DIR} ${gallery_src_SOURCE_DIR} - ${GSTLIB_INCLUDE_DIRS} ) add_executable(command-line-parser tst_commandlineparser.cpp - ${gallery_src_SOURCE_DIR}/core/command-line-parser.cpp ) qt5_use_modules(command-line-parser Quick Test) -add_test(command-line-parser command-line-parser -xunitxml -o test_resource.xml) + +add_test(command-line-parser command-line-parser -xunitxml -o test_commandlineparser.xml) set_tests_properties(command-line-parser PROPERTIES TIMEOUT ${CTEST_TESTING_TIMEOUT} ENVIRONMENT "QT_QPA_PLATFORM=minimal" ) + target_link_libraries(command-line-parser - ${GSTLIB_LDFLAGS} + gallery-util ) diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/command-line-parser/tst_commandlineparser.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/command-line-parser/tst_commandlineparser.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/command-line-parser/tst_commandlineparser.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/command-line-parser/tst_commandlineparser.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -21,7 +21,7 @@ #include #include -#include "core/command-line-parser.h" +#include "util/command-line-parser.h" class tst_CommandLineParser : public QObject { diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/gallerystandardimageprovider/CMakeLists.txt gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/gallerystandardimageprovider/CMakeLists.txt --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/gallerystandardimageprovider/CMakeLists.txt 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/gallerystandardimageprovider/CMakeLists.txt 2013-06-04 06:58:54.000000000 +0000 @@ -12,7 +12,6 @@ add_executable(gallerystandardimageprovider tst_gallerystandardimageprovidertest.cpp - gallery-manager.cpp preview-manager.cpp photometa-data.cpp ${gallery_src_SOURCE_DIR}/qml/gallery-standard-image-provider.cpp @@ -20,7 +19,7 @@ qt5_use_modules(gallerystandardimageprovider Quick Test) add_test(gallerystandardimageprovider gallerystandardimageprovider - -xunitxml -o test_resource.xml + -xunitxml -o test_gallerystandardimageprovider.xml ) set_tests_properties(gallerystandardimageprovider PROPERTIES TIMEOUT ${CTEST_TESTING_TIMEOUT} diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/gallerystandardimageprovider/gallery-manager.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/gallerystandardimageprovider/gallery-manager.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/gallerystandardimageprovider/gallery-manager.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/gallerystandardimageprovider/gallery-manager.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2013 Canonical, Ltd. - * - * Authors: - * Nicolas d'Offay - * - * 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; version 3. - * - * 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. If not, see . - * - */ - -#include "core/gallery-manager.h" -#include "core/command-line-parser.h" - -#include - -GalleryManager* GalleryManager::gallery_mgr_ = NULL; - -GalleryManager::GalleryManager(const QDir& pictures_dir, QQuickView*, const bool) - : collections_initialised(false), - resource_(NULL), - gallery_standard_image_provider_(NULL), - gallery_thumbnail_image_provider_(NULL), - database_(NULL), - default_template_(NULL), - media_collection_(NULL), - album_collection_(NULL), - event_collection_(NULL), - preview_manager_(NULL), - pictures_dir_(pictures_dir) -{ -} - -GalleryManager::~GalleryManager() -{ - delete gallery_mgr_; - gallery_mgr_ = NULL; -} - -GalleryManager* GalleryManager::instance(const QDir& pictures_dir, - QQuickView* view, const bool) -{ - if (!gallery_mgr_) - gallery_mgr_ = new GalleryManager(pictures_dir, view, false); - - return gallery_mgr_; -} diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/gallerystandardimageprovider/preview-manager.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/gallerystandardimageprovider/preview-manager.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/gallerystandardimageprovider/preview-manager.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/gallerystandardimageprovider/preview-manager.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -51,7 +51,7 @@ } -QFileInfo PreviewManager::PreviewFileFor(const QFileInfo &file) const +QFileInfo PreviewManager::PreviewFileFor(const QFileInfo &file) { return QFileInfo(file.dir(), PREVIEW_DIR + "/" + file.completeBaseName() + "_th." + PREVIEW_FILE_EXT); } diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/gallerystandardimageprovider/tst_gallerystandardimageprovidertest.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/gallerystandardimageprovider/tst_gallerystandardimageprovidertest.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/gallerystandardimageprovider/tst_gallerystandardimageprovidertest.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/gallerystandardimageprovider/tst_gallerystandardimageprovidertest.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -23,7 +23,6 @@ #include #include "qml/gallery-standard-image-provider.h" -#include "core/gallery-manager.h" #include "media/preview-manager.h" class tst_GalleryStandardImageProvider : public QObject @@ -42,7 +41,7 @@ }; tst_GalleryStandardImageProvider::tst_GalleryStandardImageProvider() - : gallery_standard_image_provider(false) + : gallery_standard_image_provider() { } diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/gallerythumbnailimageprovider/CMakeLists.txt gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/gallerythumbnailimageprovider/CMakeLists.txt --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/gallerythumbnailimageprovider/CMakeLists.txt 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/gallerythumbnailimageprovider/CMakeLists.txt 2013-06-04 06:58:54.000000000 +0000 @@ -12,14 +12,13 @@ add_executable(gallerythumbnailimageprovider tst_gallerythumbnailimageprovider.cpp - gallery-manager.cpp preview-manager.cpp ${gallery_src_SOURCE_DIR}/qml/gallery-thumbnail-image-provider.cpp ) qt5_use_modules(gallerythumbnailimageprovider Quick Test) add_test(gallerythumbnailimageprovider gallerythumbnailimageprovider - -xunitxml -o test_resource.xml + -xunitxml -o test_gallerythumbnailimageprovider.xml ) set_tests_properties(gallerythumbnailimageprovider PROPERTIES TIMEOUT ${CTEST_TESTING_TIMEOUT} diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/gallerythumbnailimageprovider/gallery-manager.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/gallerythumbnailimageprovider/gallery-manager.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/gallerythumbnailimageprovider/gallery-manager.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/gallerythumbnailimageprovider/gallery-manager.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2013 Canonical, Ltd. - * - * Authors: - * Nicolas d'Offay - * - * 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; version 3. - * - * 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. If not, see . - * - */ - -#include "core/gallery-manager.h" -#include "core/command-line-parser.h" - -#include -#include -#include - -GalleryManager* GalleryManager::gallery_mgr_ = NULL; - -GalleryManager::GalleryManager(const QDir& pictures_dir, QQuickView*, const bool) - : collections_initialised(false), - resource_(NULL), - gallery_standard_image_provider_(NULL), - gallery_thumbnail_image_provider_(NULL), - database_(NULL), - default_template_(NULL), - media_collection_(NULL), - album_collection_(NULL), - event_collection_(NULL), - preview_manager_(NULL), - pictures_dir_(pictures_dir) -{ - -} - -GalleryManager::~GalleryManager() -{ - delete gallery_mgr_; - gallery_mgr_ = NULL; -} - -GalleryManager* GalleryManager::instance(const QDir& pictures_dir, - QQuickView* view, const bool log_image_loading) -{ - if (!gallery_mgr_) - gallery_mgr_ = new GalleryManager(pictures_dir, view, log_image_loading); - - return gallery_mgr_; -} diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/gallerythumbnailimageprovider/preview-manager.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/gallerythumbnailimageprovider/preview-manager.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/gallerythumbnailimageprovider/preview-manager.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/gallerythumbnailimageprovider/preview-manager.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -48,6 +48,6 @@ } -QFileInfo PreviewManager::ThumbnailFileFor(const QFileInfo& file) const { +QFileInfo PreviewManager::ThumbnailFileFor(const QFileInfo& file) { return QFileInfo(file.dir(), PREVIEW_DIR + "/" + file.completeBaseName() + "_th_s." + PREVIEW_FILE_EXT); } diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/gallerythumbnailimageprovider/tst_gallerythumbnailimageprovider.cpp gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/gallerythumbnailimageprovider/tst_gallerythumbnailimageprovider.cpp --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/gallerythumbnailimageprovider/tst_gallerythumbnailimageprovider.cpp 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/gallerythumbnailimageprovider/tst_gallerythumbnailimageprovider.cpp 2013-06-04 06:58:54.000000000 +0000 @@ -37,7 +37,7 @@ }; tst_GalleryThumbnailImageProvider::tst_GalleryThumbnailImageProvider() - : gallery_thumbnail_image_provider(false) + : gallery_thumbnail_image_provider() { } diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/imaging/CMakeLists.txt gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/imaging/CMakeLists.txt --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/imaging/CMakeLists.txt 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/imaging/CMakeLists.txt 2013-06-04 06:58:54.000000000 +0000 @@ -7,20 +7,20 @@ include_directories( ${CMAKE_BINARY_DIR} ${gallery_src_SOURCE_DIR} - ${GSTLIB_INCLUDE_DIRS} ) add_executable(imaging tst_imaging.cpp - ${gallery_src_SOURCE_DIR}/util/imaging.cpp ) qt5_use_modules(imaging Quick Widgets Test) -add_test(imaging imaging -xunitxml -o test_resource.xml) + +add_test(imaging imaging -xunitxml -o test_imaging.xml) set_tests_properties(imaging PROPERTIES TIMEOUT ${CTEST_TESTING_TIMEOUT} ENVIRONMENT "QT_QPA_PLATFORM=minimal" ) + target_link_libraries(imaging - ${GSTLIB_LDFLAGS} + gallery-util ) diff -Nru gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/resource/CMakeLists.txt gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/resource/CMakeLists.txt --- gallery-app-0.0.67daily13.05.31.1ubuntu.unity.next/tests/unittests/resource/CMakeLists.txt 2013-05-31 10:43:02.000000000 +0000 +++ gallery-app-0.0.67daily13.06.04ubuntu.unity.next/tests/unittests/resource/CMakeLists.txt 2013-06-04 06:58:54.000000000 +0000 @@ -4,36 +4,23 @@ set(CTEST_TESTING_TIMEOUT 60) endif() -configure_file( - ${gallery_src_SOURCE_DIR}/config.h.in - ${CMAKE_CURRENT_BINARY_DIR}/config.h - @ONLY) - include_directories( ${CMAKE_BINARY_DIR} ${gallery_src_SOURCE_DIR} - ${GSTLIB_INCLUDE_DIRS} ) add_executable(resource tst_resource.cpp - ${gallery_src_SOURCE_DIR}/util/resource.cpp ) qt5_use_modules(resource Quick Test) + add_test(resource resource -xunitxml -o test_resource.xml) set_tests_properties(resource PROPERTIES TIMEOUT ${CTEST_TESTING_TIMEOUT} ENVIRONMENT "QT_QPA_PLATFORM=minimal" ) -if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") - set(GL_LIBRARIES ${GLESv2_LIBRARIES}) -else() - set(GL_LIBRARIES ${OPENGL_LIBRARIES}) -endif() - -target_link_libraries(resource - ${GL_LIBRARIES} - ${GSTLIB_LDFLAGS} +target_link_libraries(resource + gallery-util )