diff --git a/YACReaderLibrary/YACReaderLibrary.pro b/YACReaderLibrary/YACReaderLibrary.pro index 81f8d6b2..8732dc46 100644 --- a/YACReaderLibrary/YACReaderLibrary.pro +++ b/YACReaderLibrary/YACReaderLibrary.pro @@ -1,296 +1,302 @@ -###################################################################### -# Automatically generated by qmake (2.01a) dom 12. oct 20:47:48 2008 -###################################################################### - -TEMPLATE = app -TARGET = YACReaderLibrary -DEPENDPATH += . -INCLUDEPATH += . -INCLUDEPATH += ../common \ - ./server \ - ./db \ - ../custom_widgets \ - ./comic_vine \ - ./comic_vine/model - -DEFINES += SERVER_RELEASE NOMINMAX YACREADER_LIBRARY - -win32 { - -LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 - -isEqual(QT_MAJOR_VERSION, 5) { -LIBS += -lpoppler-qt5 -INCLUDEPATH += ../dependencies/poppler/include/qt5 -} -else { -LIBS += -lpoppler-qt4 -INCLUDEPATH += ../dependencies/poppler/include/qt4 -} - -#QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL -#QMAKE_LFLAGS_RELEASE += /LTCG -CONFIG -= embed_manifest_exe -} - -unix:!macx{ - -isEqual(QT_MAJOR_VERSION, 5) { -INCLUDEPATH += /usr/include/poppler/qt5 -LIBS += -L/usr/lib -lpoppler-qt5 -} -else { -INCLUDEPATH += /usr/include/poppler/qt4 -LIBS += -L/usr/lib -lpoppler-qt4 -} -LIBS += -lGLU -} - -macx{ -#INCLUDEPATH += "/Volumes/Mac OS X Lion/usr/X11/include" -#isEqual(QT_MAJOR_VERSION, 5) { -#INCLUDEPATH += /usr/local/include/poppler/qt5 -#LIBS += -L/usr/local/lib -lpoppler-qt5 -#} -#else { -#INCLUDEPATH += /usr/local/include/poppler/qt4 -#LIBS += -L/usr/local/lib -lpoppler-qt4 -#} -#QT += macextras - -LIBS += -framework Foundation -framework ApplicationServices -framework AppKit - -OBJECTIVE_SOURCES += $$PWD/../common/pdf_comic.mm -HEADERS += $$PWD/../common/pdf_comic.h -CONFIG += objective_c -QT += macextras gui-private -} - -unix{ -QMAKE_CXXFLAGS += -std=c++11 -} - -#CONFIG += release -CONFIG -= flat -QT += sql network opengl script - -# Input -HEADERS += comic_flow.h \ - create_library_dialog.h \ - library_creator.h \ - library_window.h \ - add_library_dialog.h \ - rename_library_dialog.h \ - properties_dialog.h \ - options_dialog.h \ - export_library_dialog.h \ - import_library_dialog.h \ - package_manager.h \ - bundle_creator.h \ - export_comics_info_dialog.h \ - import_comics_info_dialog.h \ - server_config_dialog.h \ - comic_flow_widget.h \ - db_helper.h \ - ./db/data_base_management.h \ - ./db/folder_item.h \ - ./db/folder_model.h \ - ./db/comic_model.h \ - ./db/comic_item.h \ - ../common/comic_db.h \ - ../common/folder.h \ - ../common/library_item.h \ - ../common/comic.h \ - ../common/bookmarks.h \ - ../common/pictureflow.h \ - ../common/custom_widgets.h \ - ../common/qnaturalsorting.h \ - ../common/yacreader_flow_gl.h \ - ../common/yacreader_global.h \ - ../common/onstart_flow_selection_dialog.h \ - no_libraries_widget.h \ - import_widget.h \ - yacreader_local_server.h \ - yacreader_main_toolbar.h \ - comics_remover.h \ - ../common/http_worker.h \ - yacreader_libraries.h \ - ../common/exit_check.h \ - comics_view.h \ - classic_comics_view.h \ - empty_folder_widget.h \ - no_search_results_widget.h \ - comic_files_manager.h \ - db/reading_list_model.h \ - db/reading_list_item.h \ - yacreader_folders_view.h \ - yacreader_reading_lists_view.h \ - add_label_dialog.h \ - yacreader_history_controller.h \ - yacreader_navigation_controller.h \ - empty_label_widget.h - - -SOURCES += comic_flow.cpp \ - create_library_dialog.cpp \ - library_creator.cpp \ - library_window.cpp \ - main.cpp \ - add_library_dialog.cpp \ - rename_library_dialog.cpp \ - properties_dialog.cpp \ - options_dialog.cpp \ - export_library_dialog.cpp \ - import_library_dialog.cpp \ - package_manager.cpp \ - bundle_creator.cpp \ - export_comics_info_dialog.cpp \ - import_comics_info_dialog.cpp \ - server_config_dialog.cpp \ - comic_flow_widget.cpp \ - db_helper.cpp \ - ./db/data_base_management.cpp \ - ./db/folder_item.cpp \ - ./db/folder_model.cpp \ - ./db/comic_model.cpp \ - ./db/comic_item.cpp \ - ../common/comic_db.cpp \ - ../common/folder.cpp \ - ../common/library_item.cpp \ - ../common/comic.cpp \ - ../common/bookmarks.cpp \ - ../common/pictureflow.cpp \ - ../common/custom_widgets.cpp \ - ../common/qnaturalsorting.cpp \ - ../common/yacreader_flow_gl.cpp \ - ../common/onstart_flow_selection_dialog.cpp \ - no_libraries_widget.cpp \ - import_widget.cpp \ - yacreader_local_server.cpp \ - yacreader_main_toolbar.cpp \ - comics_remover.cpp \ - ../common/http_worker.cpp \ - ../common/yacreader_global.cpp \ - yacreader_libraries.cpp \ - ../common/exit_check.cpp \ - comics_view.cpp \ - classic_comics_view.cpp \ - empty_folder_widget.cpp \ - no_search_results_widget.cpp \ - comic_files_manager.cpp \ - db/reading_list_model.cpp \ - db/reading_list_item.cpp \ - yacreader_folders_view.cpp \ - yacreader_reading_lists_view.cpp \ - add_label_dialog.cpp \ - yacreader_history_controller.cpp \ - yacreader_navigation_controller.cpp \ - empty_label_widget.cpp - - -include(./server/server.pri) -include(../custom_widgets/custom_widgets_yacreaderlibrary.pri) -include(../compressed_archive/wrapper.pri) -include(./comic_vine/comic_vine.pri) -include(../QsLog/QsLog.pri) -include(../shortcuts_management/shortcuts_management.pri) - -RESOURCES += images.qrc files.qrc -win32:RESOURCES += images_win.qrc -unix:!macx:RESOURCES += images_win.qrc -macx:RESOURCES += images_osx.qrc - -RC_FILE = icon.rc - -macx { - ICON = YACReaderLibrary.icns -} - -TRANSLATIONS = yacreaderlibrary_es.ts \ - yacreaderlibrary_ru.ts \ - yacreaderlibrary_pt.ts \ - yacreaderlibrary_fr.ts \ - yacreaderlibrary_nl.ts \ - yacreaderlibrary_tr.ts \ - yacreaderlibrary_de.ts \ - yacreaderlibrary_source.ts - -isEqual(QT_MAJOR_VERSION, 5) { - Release:DESTDIR = ../release5 - Debug:DESTDIR = ../debug5 - -#QML/GridView -QT += quick qml - -HEADERS += grid_comics_view.h \ - comics_view_transition.h - -SOURCES += grid_comics_view.cpp \ - comics_view_transition.cpp - -RESOURCES += qml.qrc -win32:RESOURCES += qml_win.qrc -unix:!macx:RESOURCES += qml_win.qrc -macx:RESOURCES += qml_osx.qrc - -} else { - Release:DESTDIR = ../release - Debug:DESTDIR = ../debug -} - -win32 { -!exists(../compressed_archive/lib7zip){ - error(You\'ll need 7zip source code to compile YACReader. \ - Please check the compressed_archive folder for further instructions.) -} -} - -unix { -exists (../compressed_archive/libp7zip) { - message(Found p7zip source code...) - system(patch -d ../compressed_archive -N -p0 -i libp7zip.patch) -} else { - error(You\'ll need 7zip source code to compile YACReader. \ - Please check the compressed_archive folder for further instructions.) -} -} - -unix:!macx { -#set install prefix if it's empty -isEmpty(PREFIX) { - PREFIX = /usr -} - -BINDIR = $$PREFIX/bin -LIBDIR = $$PREFIX/lib -DATADIR = $$PREFIX/share - -DEFINES += "LIBDIR=\\\"$$LIBDIR\\\"" "DATADIR=\\\"$$DATADIR\\\"" "BINDIR=\\\"$$BINDIR\\\"" - -#MAKE INSTALL -INSTALLS += bin icon desktop server translation manpage - -bin.path = $$BINDIR -isEmpty(DESTDIR) { - bin.files = YACReaderLibrary -} else { - bin.files = $$DESTDIR/YACReaderLibrary -} - -server.path = $$DATADIR/yacreader -server.files = ../release/server - -icon.path = $$DATADIR/yacreader -icon.files = ../images/iconLibrary.png ../images/db.png ../images/coversPackage.png - -desktop.path = $$DATADIR/applications -desktop.extra = desktop-file-edit --set-icon=$$DATADIR/yacreader/iconLibrary.png $$PWD/../YACReaderLibrary.desktop -desktop.files = ../YACReaderLibrary.desktop -#TODO: icons should be located at /usr/share/icons and have the same basename as their application - -translation.path = $$DATADIR/yacreader/languages -translation.files = ../release/languages/yacreaderlibrary_* - -manpage.path = $$DATADIR/man/man1 -manpage.files = ../YACReaderLibrary.1 -} +###################################################################### +# Automatically generated by qmake (2.01a) dom 12. oct 20:47:48 2008 +###################################################################### + +TEMPLATE = app +TARGET = YACReaderLibrary +DEPENDPATH += . +INCLUDEPATH += . +INCLUDEPATH += ../common \ + ./server \ + ./db \ + ../custom_widgets \ + ./comic_vine \ + ./comic_vine/model + +DEFINES += SERVER_RELEASE NOMINMAX YACREADER_LIBRARY + +win32 { + +LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 + +isEqual(QT_MAJOR_VERSION, 5) { +LIBS += -lpoppler-qt5 +INCLUDEPATH += ../dependencies/poppler/include/qt5 +} +else { +LIBS += -lpoppler-qt4 +INCLUDEPATH += ../dependencies/poppler/include/qt4 +} + +#QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL +#QMAKE_LFLAGS_RELEASE += /LTCG +CONFIG -= embed_manifest_exe +} + +unix:!macx{ + +isEqual(QT_MAJOR_VERSION, 5) { +INCLUDEPATH += /usr/include/poppler/qt5 +LIBS += -L/usr/lib -lpoppler-qt5 +} +else { +INCLUDEPATH += /usr/include/poppler/qt4 +LIBS += -L/usr/lib -lpoppler-qt4 +} +LIBS += -lGLU +} + +macx{ +#INCLUDEPATH += "/Volumes/Mac OS X Lion/usr/X11/include" +#isEqual(QT_MAJOR_VERSION, 5) { +#INCLUDEPATH += /usr/local/include/poppler/qt5 +#LIBS += -L/usr/local/lib -lpoppler-qt5 +#} +#else { +#INCLUDEPATH += /usr/local/include/poppler/qt4 +#LIBS += -L/usr/local/lib -lpoppler-qt4 +#} +#QT += macextras + +LIBS += -framework Foundation -framework ApplicationServices -framework AppKit + +OBJECTIVE_SOURCES += $$PWD/../common/pdf_comic.mm +HEADERS += $$PWD/../common/pdf_comic.h +CONFIG += objective_c +QT += macextras gui-private +} + +unix{ +QMAKE_CXXFLAGS += -std=c++11 +} + +#CONFIG += release +CONFIG -= flat +QT += sql network opengl script + +# Input +HEADERS += comic_flow.h \ + create_library_dialog.h \ + library_creator.h \ + library_window.h \ + add_library_dialog.h \ + rename_library_dialog.h \ + properties_dialog.h \ + options_dialog.h \ + export_library_dialog.h \ + import_library_dialog.h \ + package_manager.h \ + bundle_creator.h \ + export_comics_info_dialog.h \ + import_comics_info_dialog.h \ + server_config_dialog.h \ + comic_flow_widget.h \ + db_helper.h \ + ./db/data_base_management.h \ + ./db/folder_item.h \ + ./db/folder_model.h \ + ./db/comic_model.h \ + ./db/comic_item.h \ + ../common/comic_db.h \ + ../common/folder.h \ + ../common/library_item.h \ + ../common/comic.h \ + ../common/bookmarks.h \ + ../common/pictureflow.h \ + ../common/custom_widgets.h \ + ../common/qnaturalsorting.h \ + ../common/yacreader_flow_gl.h \ + ../common/yacreader_global.h \ + ../common/onstart_flow_selection_dialog.h \ + no_libraries_widget.h \ + import_widget.h \ + yacreader_local_server.h \ + yacreader_main_toolbar.h \ + comics_remover.h \ + ../common/http_worker.h \ + yacreader_libraries.h \ + ../common/exit_check.h \ + comics_view.h \ + classic_comics_view.h \ + empty_folder_widget.h \ + no_search_results_widget.h \ + comic_files_manager.h \ + db/reading_list_model.h \ + db/reading_list_item.h \ + yacreader_folders_view.h \ + yacreader_reading_lists_view.h \ + add_label_dialog.h \ + yacreader_history_controller.h \ + yacreader_navigation_controller.h \ + empty_label_widget.h \ + empty_container_info.h \ + empty_special_list.h \ + empty_reading_list_widget.h + + +SOURCES += comic_flow.cpp \ + create_library_dialog.cpp \ + library_creator.cpp \ + library_window.cpp \ + main.cpp \ + add_library_dialog.cpp \ + rename_library_dialog.cpp \ + properties_dialog.cpp \ + options_dialog.cpp \ + export_library_dialog.cpp \ + import_library_dialog.cpp \ + package_manager.cpp \ + bundle_creator.cpp \ + export_comics_info_dialog.cpp \ + import_comics_info_dialog.cpp \ + server_config_dialog.cpp \ + comic_flow_widget.cpp \ + db_helper.cpp \ + ./db/data_base_management.cpp \ + ./db/folder_item.cpp \ + ./db/folder_model.cpp \ + ./db/comic_model.cpp \ + ./db/comic_item.cpp \ + ../common/comic_db.cpp \ + ../common/folder.cpp \ + ../common/library_item.cpp \ + ../common/comic.cpp \ + ../common/bookmarks.cpp \ + ../common/pictureflow.cpp \ + ../common/custom_widgets.cpp \ + ../common/qnaturalsorting.cpp \ + ../common/yacreader_flow_gl.cpp \ + ../common/onstart_flow_selection_dialog.cpp \ + no_libraries_widget.cpp \ + import_widget.cpp \ + yacreader_local_server.cpp \ + yacreader_main_toolbar.cpp \ + comics_remover.cpp \ + ../common/http_worker.cpp \ + ../common/yacreader_global.cpp \ + yacreader_libraries.cpp \ + ../common/exit_check.cpp \ + comics_view.cpp \ + classic_comics_view.cpp \ + empty_folder_widget.cpp \ + no_search_results_widget.cpp \ + comic_files_manager.cpp \ + db/reading_list_model.cpp \ + db/reading_list_item.cpp \ + yacreader_folders_view.cpp \ + yacreader_reading_lists_view.cpp \ + add_label_dialog.cpp \ + yacreader_history_controller.cpp \ + yacreader_navigation_controller.cpp \ + empty_label_widget.cpp \ + empty_container_info.cpp \ + empty_special_list.cpp \ + empty_reading_list_widget.cpp + + +include(./server/server.pri) +include(../custom_widgets/custom_widgets_yacreaderlibrary.pri) +include(../compressed_archive/wrapper.pri) +include(./comic_vine/comic_vine.pri) +include(../QsLog/QsLog.pri) +include(../shortcuts_management/shortcuts_management.pri) + +RESOURCES += images.qrc files.qrc +win32:RESOURCES += images_win.qrc +unix:!macx:RESOURCES += images_win.qrc +macx:RESOURCES += images_osx.qrc + +RC_FILE = icon.rc + +macx { + ICON = YACReaderLibrary.icns +} + +TRANSLATIONS = yacreaderlibrary_es.ts \ + yacreaderlibrary_ru.ts \ + yacreaderlibrary_pt.ts \ + yacreaderlibrary_fr.ts \ + yacreaderlibrary_nl.ts \ + yacreaderlibrary_tr.ts \ + yacreaderlibrary_de.ts \ + yacreaderlibrary_source.ts + +isEqual(QT_MAJOR_VERSION, 5) { + Release:DESTDIR = ../release5 + Debug:DESTDIR = ../debug5 + +#QML/GridView +QT += quick qml + +HEADERS += grid_comics_view.h \ + comics_view_transition.h + +SOURCES += grid_comics_view.cpp \ + comics_view_transition.cpp + +RESOURCES += qml.qrc +win32:RESOURCES += qml_win.qrc +unix:!macx:RESOURCES += qml_win.qrc +macx:RESOURCES += qml_osx.qrc + +} else { + Release:DESTDIR = ../release + Debug:DESTDIR = ../debug +} + +win32 { +!exists(../compressed_archive/lib7zip){ + error(You\'ll need 7zip source code to compile YACReader. \ + Please check the compressed_archive folder for further instructions.) +} +} + +unix { +exists (../compressed_archive/libp7zip) { + message(Found p7zip source code...) + system(patch -d ../compressed_archive -N -p0 -i libp7zip.patch) +} else { + error(You\'ll need 7zip source code to compile YACReader. \ + Please check the compressed_archive folder for further instructions.) +} +} + +unix:!macx { +#set install prefix if it's empty +isEmpty(PREFIX) { + PREFIX = /usr +} + +BINDIR = $$PREFIX/bin +LIBDIR = $$PREFIX/lib +DATADIR = $$PREFIX/share + +DEFINES += "LIBDIR=\\\"$$LIBDIR\\\"" "DATADIR=\\\"$$DATADIR\\\"" "BINDIR=\\\"$$BINDIR\\\"" + +#MAKE INSTALL +INSTALLS += bin icon desktop server translation manpage + +bin.path = $$BINDIR +isEmpty(DESTDIR) { + bin.files = YACReaderLibrary +} else { + bin.files = $$DESTDIR/YACReaderLibrary +} + +server.path = $$DATADIR/yacreader +server.files = ../release/server + +icon.path = $$DATADIR/yacreader +icon.files = ../images/iconLibrary.png ../images/db.png ../images/coversPackage.png + +desktop.path = $$DATADIR/applications +desktop.extra = desktop-file-edit --set-icon=$$DATADIR/yacreader/iconLibrary.png $$PWD/../YACReaderLibrary.desktop +desktop.files = ../YACReaderLibrary.desktop +#TODO: icons should be located at /usr/share/icons and have the same basename as their application + +translation.path = $$DATADIR/yacreader/languages +translation.files = ../release/languages/yacreaderlibrary_* + +manpage.path = $$DATADIR/man/man1 +manpage.files = ../YACReaderLibrary.1 +} diff --git a/YACReaderLibrary/db/reading_list_item.cpp b/YACReaderLibrary/db/reading_list_item.cpp index a0904fcc..6baa4ba8 100644 --- a/YACReaderLibrary/db/reading_list_item.cpp +++ b/YACReaderLibrary/db/reading_list_item.cpp @@ -38,6 +38,15 @@ QIcon SpecialListItem::getIcon() const } } +ReadingListModel::TypeSpecialList SpecialListItem::getType() const +{ + if(itemData.count()>1) + { + int id = itemData.at(1).toInt(); + return (ReadingListModel::TypeSpecialList)id; + } +} + //------------------------------------------------------ LabelItem::LabelItem(const QList &data) diff --git a/YACReaderLibrary/db/reading_list_item.h b/YACReaderLibrary/db/reading_list_item.h index 5d82bc27..41c3aaaa 100644 --- a/YACReaderLibrary/db/reading_list_item.h +++ b/YACReaderLibrary/db/reading_list_item.h @@ -5,6 +5,7 @@ #include #include "yacreader_global.h" +#include "reading_list_model.h" //TODO add propper constructors, using QList is not safe class ListItem @@ -25,6 +26,7 @@ class SpecialListItem : public ListItem public: SpecialListItem(const QList &data); QIcon getIcon() const; + ReadingListModel::TypeSpecialList getType() const; }; //------------------------------------------------------ diff --git a/YACReaderLibrary/db/reading_list_model.cpp b/YACReaderLibrary/db/reading_list_model.cpp index 18dd4b16..288d4cf0 100644 --- a/YACReaderLibrary/db/reading_list_model.cpp +++ b/YACReaderLibrary/db/reading_list_model.cpp @@ -82,6 +82,12 @@ QVariant ReadingListModel::data(const QModelIndex &index, int role) const if (role == ReadingListModel::IDRole) return item->getId(); + if (role == ReadingListModel::SpecialListTypeRole && typeid(*item) == typeid(SpecialListItem)) + { + SpecialListItem * specialListItem = static_cast(item); + return QVariant(specialListItem->getType()); + } + if(typeid(*item) == typeid(ReadingListSeparatorItem)) return QVariant(); diff --git a/YACReaderLibrary/db/reading_list_model.h b/YACReaderLibrary/db/reading_list_model.h index efe01296..40048a2f 100644 --- a/YACReaderLibrary/db/reading_list_model.h +++ b/YACReaderLibrary/db/reading_list_model.h @@ -53,7 +53,8 @@ public: enum Roles { TypeListsRole = Qt::UserRole + 1, IDRole, - LabelColorRole + LabelColorRole, + SpecialListTypeRole }; enum TypeList { @@ -63,6 +64,11 @@ public: Separator }; + enum TypeSpecialList { + Reading, + Favorites + }; + signals: private: diff --git a/YACReaderLibrary/empty_container_info.cpp b/YACReaderLibrary/empty_container_info.cpp new file mode 100644 index 00000000..2c5b74d0 --- /dev/null +++ b/YACReaderLibrary/empty_container_info.cpp @@ -0,0 +1,47 @@ +#include "empty_container_info.h" + +EmptyContainerInfo::EmptyContainerInfo(QWidget *parent) : + QWidget(parent), iconLabel(new QLabel()), titleLabel(new QLabel()) +{ +#ifdef Q_OS_MAC + backgroundColor = "#FFFFFF"; + titleLabel->setStyleSheet("QLabel {color:#888888; font-size:24px;font-family:Arial;font-weight:bold;}"); +#else + backgroundColor = "#2A2A2A"; + titleLabel->setStyleSheet("QLabel {color:#CCCCCC; font-size:24px;font-family:Arial;font-weight:bold;}"); +#endif + + iconLabel->setAlignment(Qt::AlignCenter); + titleLabel->setAlignment(Qt::AlignCenter); +} + +void EmptyContainerInfo::setPixmap(const QPixmap &pixmap) +{ + iconLabel->setPixmap(pixmap); +} + +void EmptyContainerInfo::setText(const QString &text) +{ + titleLabel->setText(text); +} + +QVBoxLayout * EmptyContainerInfo::setUpDefaultLayout(bool addStretch) +{ + QVBoxLayout * layout = new QVBoxLayout; + + layout->addSpacing(100); + layout->addWidget(iconLabel); + layout->addSpacing(30); + layout->addWidget(titleLabel); + if(addStretch) + layout->addStretch(); + + setLayout(layout); + return layout; +} + +void EmptyContainerInfo::paintEvent(QPaintEvent *) +{ + QPainter painter (this); + painter.fillRect(0,0,width(),height(),QColor(backgroundColor)); +} diff --git a/YACReaderLibrary/empty_container_info.h b/YACReaderLibrary/empty_container_info.h new file mode 100644 index 00000000..8fd81747 --- /dev/null +++ b/YACReaderLibrary/empty_container_info.h @@ -0,0 +1,26 @@ +#ifndef EMPTY_CONTAINER_INFO_H +#define EMPTY_CONTAINER_INFO_H + +#include + +class EmptyContainerInfo : public QWidget +{ + Q_OBJECT +public: + explicit EmptyContainerInfo(QWidget *parent = 0); + void setPixmap(const QPixmap & pixmap); + void setText(const QString & text); + QVBoxLayout *setUpDefaultLayout(bool addStretch); +signals: + +public slots: + +protected: + void paintEvent(QPaintEvent *); + + QLabel * iconLabel; + QLabel * titleLabel; + QString backgroundColor; +}; + +#endif // EMPTY_CONTAINER_INFO_H diff --git a/YACReaderLibrary/empty_folder_widget.cpp b/YACReaderLibrary/empty_folder_widget.cpp index 053a584a..ba73b6ff 100644 --- a/YACReaderLibrary/empty_folder_widget.cpp +++ b/YACReaderLibrary/empty_folder_widget.cpp @@ -17,28 +17,12 @@ void testListView(QListView * l) } EmptyFolderWidget::EmptyFolderWidget(QWidget *parent) : - QWidget(parent),subfoldersModel(new QStringListModel()) + EmptyContainerInfo(parent),subfoldersModel(new QStringListModel()) { -#ifdef Q_OS_MAC - backgroundColor = "#FFFFFF"; -#else - backgroundColor = "#2A2A2A"; -#endif + QVBoxLayout * layout = setUpDefaultLayout(false); - QVBoxLayout * layout = new QVBoxLayout; - - iconLabel = new QLabel(); iconLabel->setPixmap(QPixmap(":/images/empty_folder.png")); - iconLabel->setAlignment(Qt::AlignCenter); - - titleLabel = new QLabel(tr("Subfolders in this folder")); - titleLabel->setAlignment(Qt::AlignCenter); - -#ifdef Q_OS_MAC - titleLabel->setStyleSheet("QLabel {color:#888888; font-size:24px;font-family:Arial;font-weight:bold;}"); -#else - titleLabel->setStyleSheet("QLabel {color:#CCCCCC; font-size:24px;font-family:Arial;font-weight:bold;}"); -#endif + titleLabel->setText(tr("Subfolders in this folder")); foldersView = new QListView(); foldersView->setMinimumWidth(282); @@ -83,10 +67,6 @@ EmptyFolderWidget::EmptyFolderWidget(QWidget *parent) : foldersView->setSizePolicy(QSizePolicy ::Expanding , QSizePolicy ::Expanding ); testListView(foldersView); - layout->addSpacing(100); - layout->addWidget(iconLabel); - layout->addSpacing(30); - layout->addWidget(titleLabel); layout->addSpacing(12); layout->addWidget(foldersView,1,Qt::AlignHCenter); layout->addStretch(); @@ -98,7 +78,6 @@ EmptyFolderWidget::EmptyFolderWidget(QWidget *parent) : setStyleSheet(QString("QWidget {background:%1}").arg(backgroundColor)); setSizePolicy(QSizePolicy ::Expanding , QSizePolicy ::Expanding ); - setLayout(layout); setAcceptDrops(true); @@ -126,12 +105,6 @@ void EmptyFolderWidget::onItemClicked(const QModelIndex &mi) emit subfolderSelected(parent,mi.row()); } -void EmptyFolderWidget::paintEvent(QPaintEvent *) -{ - QPainter painter (this); - painter.fillRect(0,0,width(),height(),QColor(backgroundColor)); -} - //TODO remove repeated code in drag & drop support.... void EmptyFolderWidget::dragEnterEvent(QDragEnterEvent *event) { diff --git a/YACReaderLibrary/empty_folder_widget.h b/YACReaderLibrary/empty_folder_widget.h index fc9b1835..98cb4d01 100644 --- a/YACReaderLibrary/empty_folder_widget.h +++ b/YACReaderLibrary/empty_folder_widget.h @@ -1,14 +1,12 @@ #ifndef EMPTY_FOLDER_WIDGET_H #define EMPTY_FOLDER_WIDGET_H -#include -#include +#include "empty_container_info.h" +#include -class QLabel; -class QListView; -class QStringListModel; -class EmptyFolderWidget : public QWidget + +class EmptyFolderWidget : public EmptyContainerInfo { Q_OBJECT public: @@ -25,12 +23,9 @@ public slots: void onItemClicked(const QModelIndex & mi); protected: - QLabel * iconLabel; - QLabel * titleLabel; QListView * foldersView; QModelIndex parent; QStringListModel * subfoldersModel; - void paintEvent(QPaintEvent *); QString backgroundColor; //Drop to import diff --git a/YACReaderLibrary/empty_label_widget.cpp b/YACReaderLibrary/empty_label_widget.cpp index d530dad8..eac010d7 100644 --- a/YACReaderLibrary/empty_label_widget.cpp +++ b/YACReaderLibrary/empty_label_widget.cpp @@ -1,37 +1,14 @@ #include "empty_label_widget.h" EmptyLabelWidget::EmptyLabelWidget(QWidget *parent) : - QWidget(parent) + EmptyContainerInfo(parent) { -#ifdef Q_OS_MAC - backgroundColor = "#FFFFFF"; -#else - backgroundColor = "#2A2A2A"; -#endif + setUpDefaultLayout(true); - QVBoxLayout * layout = new QVBoxLayout; - - iconLabel = new QLabel(); iconLabel->setPixmap(QPixmap(":/images/empty_label.png")); - iconLabel->setAlignment(Qt::AlignCenter); //titleLabel->setText(tr("This label doesn't contain comics yet") + QString("

%1

").arg(tr("Drag and drop folders and comics here"))); - titleLabel = new QLabel(("This label doesn't contain comics yet")); - titleLabel->setAlignment(Qt::AlignCenter); - -#ifdef Q_OS_MAC - titleLabel->setStyleSheet("QLabel {color:#888888; font-size:24px;font-family:Arial;font-weight:bold;}"); -#else - titleLabel->setStyleSheet("QLabel {color:#CCCCCC; font-size:24px;font-family:Arial;font-weight:bold;}"); -#endif - - layout->addSpacing(100); - layout->addWidget(iconLabel); - layout->addSpacing(30); - layout->addWidget(titleLabel); - layout->addStretch(); - - setLayout(layout); + titleLabel->setText(tr("This label doesn't contain comics yet")); } void EmptyLabelWidget::setColor(YACReader::LabelColors color) @@ -42,9 +19,3 @@ void EmptyLabelWidget::setColor(YACReader::LabelColors color) YACReader::colorize(img,destColor); iconLabel->setPixmap(QPixmap::fromImage(img)); } - -void EmptyLabelWidget::paintEvent(QPaintEvent * event) -{ - QPainter painter (this); - painter.fillRect(0,0,width(),height(),QColor(backgroundColor)); -} diff --git a/YACReaderLibrary/empty_label_widget.h b/YACReaderLibrary/empty_label_widget.h index ac76f722..0e877da6 100644 --- a/YACReaderLibrary/empty_label_widget.h +++ b/YACReaderLibrary/empty_label_widget.h @@ -2,25 +2,21 @@ #define EMPTY_LABEL_WIDGET_H #include +#include "empty_container_info.h" #include "yacreader_global.h" -class EmptyLabelWidget : public QWidget +class EmptyLabelWidget : public EmptyContainerInfo { Q_OBJECT public: explicit EmptyLabelWidget(QWidget *parent = 0); void setColor(YACReader::LabelColors color); - void paintEvent(QPaintEvent *event); signals: public slots: protected: - QLabel * iconLabel; - QLabel * titleLabel; - QString backgroundColor; - }; #endif // EMPTY_LABEL_WIDGET_H diff --git a/YACReaderLibrary/empty_reading_list_widget.cpp b/YACReaderLibrary/empty_reading_list_widget.cpp new file mode 100644 index 00000000..f325dc37 --- /dev/null +++ b/YACReaderLibrary/empty_reading_list_widget.cpp @@ -0,0 +1,9 @@ +#include "empty_reading_list_widget.h" + +EmptyReadingListWidget::EmptyReadingListWidget(QWidget *parent) + :EmptyContainerInfo(parent) +{ + setUpDefaultLayout(true); + setPixmap(QPixmap(":/images/empty_reading_list")); + setText(tr("This reading list doesn't cotain comics yet")); +} diff --git a/YACReaderLibrary/empty_reading_list_widget.h b/YACReaderLibrary/empty_reading_list_widget.h new file mode 100644 index 00000000..566b8cfb --- /dev/null +++ b/YACReaderLibrary/empty_reading_list_widget.h @@ -0,0 +1,13 @@ +#ifndef EMPTY_READING_LIST_WIDGET_H +#define EMPTY_READING_LIST_WIDGET_H + +#include +#include "empty_container_info.h" + +class EmptyReadingListWidget : public EmptyContainerInfo +{ +public: + EmptyReadingListWidget(QWidget * parent = 0); +}; + +#endif // EMPTY_READING_LIST_WIDGET_H diff --git a/YACReaderLibrary/empty_special_list.cpp b/YACReaderLibrary/empty_special_list.cpp new file mode 100644 index 00000000..c4ec384d --- /dev/null +++ b/YACReaderLibrary/empty_special_list.cpp @@ -0,0 +1,7 @@ +#include "empty_special_list.h" + +EmptySpecialListWidget::EmptySpecialListWidget(QWidget *parent) + :EmptyContainerInfo(parent) +{ + setUpDefaultLayout(true); +} diff --git a/YACReaderLibrary/empty_special_list.h b/YACReaderLibrary/empty_special_list.h new file mode 100644 index 00000000..f9d4b117 --- /dev/null +++ b/YACReaderLibrary/empty_special_list.h @@ -0,0 +1,13 @@ +#ifndef EMPTY_SPECIAL_LIST_H +#define EMPTY_SPECIAL_LIST_H + +#include +#include "empty_container_info.h" + +class EmptySpecialListWidget : public EmptyContainerInfo +{ +public: + EmptySpecialListWidget(QWidget * parent = 0); +}; + +#endif // EMPTY_SPECIAL_LIST_H diff --git a/YACReaderLibrary/images.qrc b/YACReaderLibrary/images.qrc index a6e4be01..0086639e 100644 --- a/YACReaderLibrary/images.qrc +++ b/YACReaderLibrary/images.qrc @@ -1,5 +1,5 @@ - + ../images/folder.png ../images/folder_finished.png ../images/icon.png @@ -12,7 +12,7 @@ ../images/notCover.png ../images/edit.png ../images/editIcon.png - ../images/flow1.png + ../images/flow1.png ../images/flow2.png ../images/flow3.png ../images/flow4.png @@ -21,13 +21,13 @@ ../images/importLibraryIcon.png ../images/exportLibrary.png ../images/exportLibraryIcon.png - ../images/importLibraryIcon.png + ../images/importLibraryIcon.png ../images/open.png ../images/coversPackage.png ../images/setRead.png ../images/setUnread.png - + ../images/showMarks.png ../images/editComic.png ../images/selectAll.png @@ -59,26 +59,11 @@ ../images/trash.png ../images/setReadButton.png ../images/openInYACReader.png - - ../images/main_toolbar/divider.png + + ../images/main_toolbar/divider.png ../images/collapsed_branch_osx.png ../images/expanded_branch_osx.png - ../images/folder_macosx.png + ../images/folder_macosx.png ../images/libraryIconSelected.png ../images/libraryOptions.png ../images/branch-open.png @@ -90,28 +75,30 @@ ../images/getInfo.png ../images/comic_vine/radioChecked.png ../images/comic_vine/radioUnchecked.png - ../images/comic_vine/radioUnchecked.png - ../images/comic_vine/rowDown.png - ../images/comic_vine/rowUp.png - ../images/comic_vine/previousPage.png - ../images/comic_vine/nextPage.png - ../images/comic_vine/downArrow.png - ../images/comic_vine/upArrow.png + ../images/comic_vine/radioUnchecked.png + ../images/comic_vine/rowDown.png + ../images/comic_vine/rowUp.png + ../images/comic_vine/previousPage.png + ../images/comic_vine/nextPage.png + ../images/comic_vine/downArrow.png + ../images/comic_vine/upArrow.png ../images/find_folder.png - ../images/clear_shortcut.png - ../images/accept_shortcut.png + ../images/clear_shortcut.png + ../images/accept_shortcut.png ../images/f_overlayed.png ../images/f_overlayed_retina.png - ../images/shortcuts_group_comics.png - ../images/shortcuts_group_folders.png - ../images/shortcuts_group_general.png - ../images/shortcuts_group_libraries.png - ../images/shortcuts_group_mglass.png - ../images/shortcuts_group_page.png - ../images/shortcuts_group_reading.png - ../images/shortcuts_group_visualization.png - ../images/searching_icon.png - ../images/empty_label.png + ../images/shortcuts_group_comics.png + ../images/shortcuts_group_folders.png + ../images/shortcuts_group_general.png + ../images/shortcuts_group_libraries.png + ../images/shortcuts_group_mglass.png + ../images/shortcuts_group_page.png + ../images/shortcuts_group_reading.png + ../images/shortcuts_group_visualization.png + ../images/searching_icon.png + ../images/empty_label.png + ../images/empty_current_readings.png + ../images/empty_favorites.png - + \ No newline at end of file diff --git a/YACReaderLibrary/images_osx.qrc b/YACReaderLibrary/images_osx.qrc index 65aed99b..2244f4ca 100644 --- a/YACReaderLibrary/images_osx.qrc +++ b/YACReaderLibrary/images_osx.qrc @@ -1,51 +1,48 @@ - - ../images/folder_finished_macosx.png - ../images/main_toolbar/back_osx.png - ../images/main_toolbar/back_osx@2x.png - ../images/main_toolbar/forward_osx.png - ../images/main_toolbar/forward_osx@2x.png - ../images/main_toolbar/settings_osx.png - ../images/main_toolbar/settings_osx@2x.png - ../images/main_toolbar/server_osx.png - ../images/main_toolbar/server_osx@2x.png - ../images/main_toolbar/help_osx.png - ../images/main_toolbar/help_osx@2x.png - ../images/main_toolbar/flow_osx.png - ../images/main_toolbar/flow_osx@2x.png - ../images/main_toolbar/grid_osx.png - ../images/main_toolbar/grid_osx@2x.png - - ../images/libraryIcon_osx.png - ../images/setRoot_osx.png - ../images/expand_osx.png - ../images/colapse_osx.png - ../images/newLibraryIcon_osx.png - ../images/openLibraryIcon_osx.png - ../images/flow_to_grid.gif - ../images/grid_to_flow.gif - ../images/empty_folder_osx.png - ../images/empty_search_osx.png - ../images/iconSearch.png - ../images/clearSearch.png - - - ../images/lists/default_0_osx.png - ../images/lists/default_1_osx.png - ../images/lists/label_blue_osx.png - ../images/lists/label_cyan_osx.png - ../images/lists/label_dark_osx.png - ../images/lists/label_green_osx.png - ../images/lists/label_light_osx.png - ../images/lists/label_orange_osx.png - ../images/lists/label_pink_osx.png - ../images/lists/label_purple_osx.png - ../images/lists/label_red_osx.png - ../images/lists/label_violet_osx.png - ../images/lists/label_white_osx.png - ../images/lists/label_yellow_osx.png - ../images/lists/list_osx.png - - - - + + ../images/folder_finished_macosx.png + ../images/main_toolbar/back_osx.png + ../images/main_toolbar/back_osx@2x.png + ../images/main_toolbar/forward_osx.png + ../images/main_toolbar/forward_osx@2x.png + ../images/main_toolbar/settings_osx.png + ../images/main_toolbar/settings_osx@2x.png + ../images/main_toolbar/server_osx.png + ../images/main_toolbar/server_osx@2x.png + ../images/main_toolbar/help_osx.png + ../images/main_toolbar/help_osx@2x.png + ../images/main_toolbar/flow_osx.png + ../images/main_toolbar/flow_osx@2x.png + ../images/main_toolbar/grid_osx.png + ../images/main_toolbar/grid_osx@2x.png + ../images/libraryIcon_osx.png + ../images/setRoot_osx.png + ../images/expand_osx.png + ../images/colapse_osx.png + ../images/newLibraryIcon_osx.png + ../images/openLibraryIcon_osx.png + ../images/flow_to_grid.gif + ../images/grid_to_flow.gif + ../images/empty_folder_osx.png + ../images/empty_search_osx.png + ../images/iconSearch.png + ../images/clearSearch.png + + ../images/lists/default_0_osx.png + ../images/lists/default_1_osx.png + ../images/lists/label_blue_osx.png + ../images/lists/label_cyan_osx.png + ../images/lists/label_dark_osx.png + ../images/lists/label_green_osx.png + ../images/lists/label_light_osx.png + ../images/lists/label_orange_osx.png + ../images/lists/label_pink_osx.png + ../images/lists/label_purple_osx.png + ../images/lists/label_red_osx.png + ../images/lists/label_violet_osx.png + ../images/lists/label_white_osx.png + ../images/lists/label_yellow_osx.png + ../images/lists/list_osx.png + ../images/empty_reading_list_osx.png + + \ No newline at end of file diff --git a/YACReaderLibrary/images_win.qrc b/YACReaderLibrary/images_win.qrc index f0f62517..66c4015d 100644 --- a/YACReaderLibrary/images_win.qrc +++ b/YACReaderLibrary/images_win.qrc @@ -27,21 +27,21 @@ ../images/addLabelIcon.png ../images/renameListIcon.png - ../images/lists/default_0.png - ../images/lists/default_1.png - ../images/lists/label_blue.png - ../images/lists/label_cyan.png - ../images/lists/label_dark.png - ../images/lists/label_green.png - ../images/lists/label_light.png - ../images/lists/label_orange.png - ../images/lists/label_pink.png - ../images/lists/label_purple.png - ../images/lists/label_red.png - ../images/lists/label_violet.png - ../images/lists/label_white.png - ../images/lists/label_yellow.png - ../images/lists/list.png - + ../images/lists/default_0.png + ../images/lists/default_1.png + ../images/lists/label_blue.png + ../images/lists/label_cyan.png + ../images/lists/label_dark.png + ../images/lists/label_green.png + ../images/lists/label_light.png + ../images/lists/label_orange.png + ../images/lists/label_pink.png + ../images/lists/label_purple.png + ../images/lists/label_red.png + ../images/lists/label_violet.png + ../images/lists/label_white.png + ../images/lists/label_yellow.png + ../images/lists/list.png + ../images/empty_reading_list.png - + \ No newline at end of file diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index 7843c4b6..c85cf2dd 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -66,6 +66,8 @@ #include "comics_view_transition.h" #include "empty_folder_widget.h" #include "empty_label_widget.h" +#include "empty_special_list.h" +#include "empty_reading_list_widget.h" #include "edit_shortcuts_dialog.h" #include "shortcuts_manager.h" @@ -242,7 +244,10 @@ void LibraryWindow::doLayout() comicsViewStack->addWidget(comicsViewTransition = new ComicsViewTransition()); comicsViewStack->addWidget(emptyFolderWidget = new EmptyFolderWidget()); comicsViewStack->addWidget(emptyLabelWidget = new EmptyLabelWidget()); + comicsViewStack->addWidget(emptySpecialList = new EmptySpecialListWidget()); + comicsViewStack->addWidget(emptyReadingList = new EmptyReadingListWidget()); comicsViewStack->addWidget(noSearchResultsWidget = new NoSearchResultsWidget()); + comicsViewStack->addWidget(comicsView); comicsViewStack->setCurrentWidget(comicsView); @@ -2167,6 +2172,16 @@ void LibraryWindow::showEmptyLabelView() comicsViewStack->setCurrentWidget(emptyLabelWidget); } +void LibraryWindow::showEmptySpecialList() +{ + comicsViewStack->setCurrentWidget(emptySpecialList); +} + +void LibraryWindow::showEmptyReadingListWidget() +{ + comicsViewStack->setCurrentWidget(emptyReadingList); +} + void LibraryWindow::showNoSearchResultsView() { comicsViewStack->setCurrentWidget(noSearchResultsWidget); diff --git a/YACReaderLibrary/library_window.h b/YACReaderLibrary/library_window.h index 8602d517..fc087386 100644 --- a/YACReaderLibrary/library_window.h +++ b/YACReaderLibrary/library_window.h @@ -69,6 +69,8 @@ class ReadingListModelProxy; class YACReaderReadingListsView; class YACReaderHistoryController; class EmptyLabelWidget; +class EmptySpecialListWidget; +class EmptyReadingListWidget; #include "comic_db.h" @@ -123,6 +125,8 @@ private: ComicsViewTransition * comicsViewTransition; EmptyFolderWidget * emptyFolderWidget; EmptyLabelWidget * emptyLabelWidget; + EmptySpecialListWidget * emptySpecialList; + EmptyReadingListWidget * emptyReadingList; NoSearchResultsWidget * noSearchResultsWidget; YACReaderFoldersView * foldersView; @@ -361,6 +365,8 @@ public slots: void showComicsView(); void showEmptyFolderView(); void showEmptyLabelView(); + void showEmptySpecialList(); + void showEmptyReadingListWidget(); void showNoSearchResultsView(); void toggleComicsView(); void checkSearchNumResults(int numResults); diff --git a/YACReaderLibrary/yacreader_navigation_controller.cpp b/YACReaderLibrary/yacreader_navigation_controller.cpp index b2be7085..b1a70876 100644 --- a/YACReaderLibrary/yacreader_navigation_controller.cpp +++ b/YACReaderLibrary/yacreader_navigation_controller.cpp @@ -15,6 +15,7 @@ #include "yacreader_search_line_edit.h" #include "yacreader_global.h" #include "empty_label_widget.h" +#include "empty_special_list.h" #include "QsLog.h" @@ -98,7 +99,21 @@ void YACReaderNavigationController::loadListInfo(const QModelIndex &modelIndex) void YACReaderNavigationController::loadSpecialListInfo(const QModelIndex &modelIndex) { + ReadingListModel::TypeSpecialList type = (ReadingListModel::TypeSpecialList)modelIndex.data(ReadingListModel::SpecialListTypeRole).toInt(); + switch(type) + { + case ReadingListModel::Favorites: + libraryWindow->emptySpecialList->setPixmap(QPixmap(":/images/empty_favorites.png")); + libraryWindow->emptySpecialList->setText(tr("No favorites")); + break; + case ReadingListModel::Reading: + libraryWindow->emptySpecialList->setPixmap(QPixmap(":/images/empty_current_readings.png")); + libraryWindow->emptySpecialList->setText(tr("You are not reading anything yet, come on!!")); + break; + } + libraryWindow->showEmptySpecialList(); + libraryWindow->disableComicsActions(true); } void YACReaderNavigationController::loadLabelInfo(const QModelIndex &modelIndex) @@ -126,7 +141,8 @@ void YACReaderNavigationController::loadLabelInfo(const QModelIndex &modelIndex) void YACReaderNavigationController::loadReadingListInfo(const QModelIndex &modelIndex) { - + libraryWindow->showEmptyReadingListWidget(); + libraryWindow->disableComicsActions(true); } void YACReaderNavigationController::selectedList(const QModelIndex &mi) diff --git a/images/empty_current_readings.png b/images/empty_current_readings.png new file mode 100644 index 00000000..776fb0c3 Binary files /dev/null and b/images/empty_current_readings.png differ diff --git a/images/empty_favorites.png b/images/empty_favorites.png new file mode 100644 index 00000000..c0fce602 Binary files /dev/null and b/images/empty_favorites.png differ diff --git a/images/empty_reading_list.png b/images/empty_reading_list.png new file mode 100644 index 00000000..36669888 Binary files /dev/null and b/images/empty_reading_list.png differ diff --git a/images/empty_reading_list_osx.png b/images/empty_reading_list_osx.png new file mode 100644 index 00000000..59667e1f Binary files /dev/null and b/images/empty_reading_list_osx.png differ