mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
a?adido widget de presentaci?n cuando el usuario no tiene ninguna biblioteca
This commit is contained in:
parent
31bd2a3c1b
commit
add44dddfb
@ -35,6 +35,8 @@ void MainWindowViewer::setupUI()
|
|||||||
{
|
{
|
||||||
setWindowIcon(QIcon(":/images/icon.png"));
|
setWindowIcon(QIcon(":/images/icon.png"));
|
||||||
|
|
||||||
|
setUnifiedTitleAndToolBarOnMac(true);
|
||||||
|
|
||||||
viewer = new Viewer(this);
|
viewer = new Viewer(this);
|
||||||
connect(viewer,SIGNAL(reset()),this,SLOT(disableActions()));
|
connect(viewer,SIGNAL(reset()),this,SLOT(disableActions()));
|
||||||
|
|
||||||
|
@ -72,7 +72,8 @@ HEADERS += comic_flow.h \
|
|||||||
../common/qnaturalsorting.h \
|
../common/qnaturalsorting.h \
|
||||||
../common/yacreader_flow_gl.h \
|
../common/yacreader_flow_gl.h \
|
||||||
../common/yacreader_global.h \
|
../common/yacreader_global.h \
|
||||||
../common/onstart_flow_selection_dialog.h
|
../common/onstart_flow_selection_dialog.h \
|
||||||
|
no_libraries_widget.h
|
||||||
|
|
||||||
SOURCES += comic_flow.cpp \
|
SOURCES += comic_flow.cpp \
|
||||||
create_library_dialog.cpp \
|
create_library_dialog.cpp \
|
||||||
@ -106,7 +107,8 @@ SOURCES += comic_flow.cpp \
|
|||||||
../common/custom_widgets.cpp \
|
../common/custom_widgets.cpp \
|
||||||
../common/qnaturalsorting.cpp \
|
../common/qnaturalsorting.cpp \
|
||||||
../common/yacreader_flow_gl.cpp \
|
../common/yacreader_flow_gl.cpp \
|
||||||
../common/onstart_flow_selection_dialog.cpp
|
../common/onstart_flow_selection_dialog.cpp \
|
||||||
|
no_libraries_widget.cpp
|
||||||
|
|
||||||
include(./server/server.pri)
|
include(./server/server.pri)
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
<file>../images/folder.png</file>
|
<file>../images/folder.png</file>
|
||||||
<file>../images/help.png</file>
|
<file>../images/help.png</file>
|
||||||
<file>../images/icon.png</file>
|
<file>../images/icon.png</file>
|
||||||
|
<file>../images/iconLibrary.png</file>
|
||||||
<file>../images/new.png</file>
|
<file>../images/new.png</file>
|
||||||
<file>../images/openLibrary.png</file>
|
<file>../images/openLibrary.png</file>
|
||||||
<file>../images/removeLibrary.png</file>
|
<file>../images/removeLibrary.png</file>
|
||||||
@ -57,5 +58,7 @@
|
|||||||
<file>../images/comicTar.png</file>
|
<file>../images/comicTar.png</file>
|
||||||
<file>../images/comic7z.png</file>
|
<file>../images/comic7z.png</file>
|
||||||
<file>../images/serverConfigBackground.png</file>
|
<file>../images/serverConfigBackground.png</file>
|
||||||
|
<file>../images/noLibrariesIcon.png</file>
|
||||||
|
<file>../images/noLibrariesLine.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
@ -21,6 +21,7 @@
|
|||||||
#include "data_base_management.h"
|
#include "data_base_management.h"
|
||||||
#include "yacreader_global.h"
|
#include "yacreader_global.h"
|
||||||
#include "onstart_flow_selection_dialog.h"
|
#include "onstart_flow_selection_dialog.h"
|
||||||
|
#include "no_libraries_widget.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
@ -29,10 +30,23 @@ LibraryWindow::LibraryWindow()
|
|||||||
{
|
{
|
||||||
setupUI();
|
setupUI();
|
||||||
loadLibraries();
|
loadLibraries();
|
||||||
|
|
||||||
|
if(libraries.size()==0)
|
||||||
|
{
|
||||||
|
showNoLibrariesWidget();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hideNoLibrariesWidget();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::setupUI()
|
void LibraryWindow::setupUI()
|
||||||
{
|
{
|
||||||
|
setWindowIcon(QIcon(":/images/iconLibrary.png"));
|
||||||
|
|
||||||
|
setUnifiedTitleAndToolBarOnMac(true);
|
||||||
|
|
||||||
libraryCreator = new LibraryCreator();
|
libraryCreator = new LibraryCreator();
|
||||||
packageManager = new PackageManager();
|
packageManager = new PackageManager();
|
||||||
|
|
||||||
@ -195,7 +209,9 @@ void LibraryWindow::doLayout()
|
|||||||
sHorizontal->addWidget(sVertical);
|
sHorizontal->addWidget(sVertical);
|
||||||
sHorizontal->setStretchFactor(0,0);
|
sHorizontal->setStretchFactor(0,0);
|
||||||
sHorizontal->setStretchFactor(1,1);
|
sHorizontal->setStretchFactor(1,1);
|
||||||
setCentralWidget(sHorizontal);
|
mainWidget = new QStackedWidget(this);
|
||||||
|
mainWidget->addWidget(sHorizontal);
|
||||||
|
setCentralWidget(mainWidget);
|
||||||
//FINAL LAYOUT-------------------------------------------------------------
|
//FINAL LAYOUT-------------------------------------------------------------
|
||||||
|
|
||||||
fullScreenToolTip = new QLabel(comicFlow);
|
fullScreenToolTip = new QLabel(comicFlow);
|
||||||
@ -207,6 +223,12 @@ void LibraryWindow::doLayout()
|
|||||||
fullScreenToolTip->adjustSize();
|
fullScreenToolTip->adjustSize();
|
||||||
|
|
||||||
comicFlow->setFocus(Qt::OtherFocusReason);
|
comicFlow->setFocus(Qt::OtherFocusReason);
|
||||||
|
|
||||||
|
noLibrariesWidget = new NoLibrariesWidget();
|
||||||
|
mainWidget->addWidget(noLibrariesWidget);
|
||||||
|
|
||||||
|
connect(noLibrariesWidget,SIGNAL(createNewLibrary()),this,SLOT(createLibrary()));
|
||||||
|
connect(noLibrariesWidget,SIGNAL(addExistingLibrary()),this,SLOT(showAddLibrary()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::doDialogs()
|
void LibraryWindow::doDialogs()
|
||||||
@ -668,6 +690,7 @@ void LibraryWindow::loadLibrary(const QString & name)
|
|||||||
{
|
{
|
||||||
if(libraries.size()>0) //si hay bibliotecas...
|
if(libraries.size()>0) //si hay bibliotecas...
|
||||||
{
|
{
|
||||||
|
hideNoLibrariesWidget();
|
||||||
QString path=libraries.value(name)+"/.yacreaderlibrary";
|
QString path=libraries.value(name)+"/.yacreaderlibrary";
|
||||||
QDir d; //TODO change this by static methods (utils class?? with delTree for example)
|
QDir d; //TODO change this by static methods (utils class?? with delTree for example)
|
||||||
QString dbVersion;
|
QString dbVersion;
|
||||||
@ -768,6 +791,7 @@ void LibraryWindow::loadLibrary(const QString & name)
|
|||||||
else //en caso de que no exista ninguna biblioteca se desactivan los botones pertinentes
|
else //en caso de que no exista ninguna biblioteca se desactivan los botones pertinentes
|
||||||
{
|
{
|
||||||
disableAllActions();
|
disableAllActions();
|
||||||
|
showNoLibrariesWidget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1498,3 +1522,12 @@ void LibraryWindow::closeEvent ( QCloseEvent * event )
|
|||||||
{
|
{
|
||||||
settings->setValue(MAIN_WINDOW_GEOMETRY, saveGeometry());
|
settings->setValue(MAIN_WINDOW_GEOMETRY, saveGeometry());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LibraryWindow::showNoLibrariesWidget()
|
||||||
|
{
|
||||||
|
mainWidget->setCurrentIndex(1);
|
||||||
|
}
|
||||||
|
void LibraryWindow::hideNoLibrariesWidget()
|
||||||
|
{
|
||||||
|
mainWidget->setCurrentIndex(0);
|
||||||
|
}
|
@ -11,6 +11,7 @@
|
|||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QFileInfoList>
|
#include <QFileInfoList>
|
||||||
|
#include <QStackedWidget>
|
||||||
|
|
||||||
#include "create_library_dialog.h"
|
#include "create_library_dialog.h"
|
||||||
#include "add_library_dialog.h"
|
#include "add_library_dialog.h"
|
||||||
@ -30,6 +31,7 @@
|
|||||||
#include "tablemodel.h"
|
#include "tablemodel.h"
|
||||||
#include "treeitem.h"
|
#include "treeitem.h"
|
||||||
#include "server_config_dialog.h"
|
#include "server_config_dialog.h"
|
||||||
|
#include "no_libraries_widget.h"
|
||||||
|
|
||||||
class LibraryWindow : public QMainWindow
|
class LibraryWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
@ -79,6 +81,9 @@ private:
|
|||||||
QLabel * fullScreenToolTip;
|
QLabel * fullScreenToolTip;
|
||||||
YACReaderIconProvider fip;
|
YACReaderIconProvider fip;
|
||||||
|
|
||||||
|
QStackedWidget * mainWidget;
|
||||||
|
NoLibrariesWidget * noLibrariesWidget;
|
||||||
|
|
||||||
bool fetching;
|
bool fetching;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
@ -211,6 +216,8 @@ public:
|
|||||||
void showExportComicsInfo();
|
void showExportComicsInfo();
|
||||||
void showImportComicsInfo();
|
void showImportComicsInfo();
|
||||||
void asignNumbers();
|
void asignNumbers();
|
||||||
|
void showNoLibrariesWidget();
|
||||||
|
void hideNoLibrariesWidget();
|
||||||
|
|
||||||
//server interface
|
//server interface
|
||||||
QMap<QString,QString> getLibraries(){return libraries;};
|
QMap<QString,QString> getLibraries(){return libraries;};
|
||||||
|
57
YACReaderLibrary/no_libraries_widget.cpp
Normal file
57
YACReaderLibrary/no_libraries_widget.cpp
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
#include "no_libraries_widget.h"
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
|
NoLibrariesWidget::NoLibrariesWidget(QWidget *parent) :
|
||||||
|
QWidget(parent)
|
||||||
|
{
|
||||||
|
setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
|
||||||
|
|
||||||
|
setStyleSheet("{color:FFFFFF;}");
|
||||||
|
|
||||||
|
QPixmap icon(":/images/noLibrariesIcon.png");
|
||||||
|
QLabel * iconLabel = new QLabel();
|
||||||
|
iconLabel->setPixmap(icon);
|
||||||
|
|
||||||
|
QPixmap line(":/images/noLibrariesLine.png");
|
||||||
|
QLabel * lineLabel = new QLabel();
|
||||||
|
lineLabel->setPixmap(line);
|
||||||
|
|
||||||
|
QLabel * text = new QLabel(tr("<font color=\"#565959\">You don't have any library yet</font>"));
|
||||||
|
text->setStyleSheet("QLabel {font-size:25px;font-weight:bold;}");
|
||||||
|
|
||||||
|
QPushButton * createButton = new QPushButton(tr("create your first library"));
|
||||||
|
createButton->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
|
||||||
|
QPushButton * addButton = new QPushButton(tr("add an existing one"));
|
||||||
|
addButton->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
|
||||||
|
|
||||||
|
QVBoxLayout * layout = new QVBoxLayout(this);
|
||||||
|
QHBoxLayout * buttonLayout = new QHBoxLayout();
|
||||||
|
|
||||||
|
layout->setAlignment(Qt::AlignHCenter);
|
||||||
|
|
||||||
|
buttonLayout->addSpacing(100);
|
||||||
|
buttonLayout->addWidget(createButton);
|
||||||
|
layout->addSpacing(25);
|
||||||
|
buttonLayout->addWidget(addButton);
|
||||||
|
buttonLayout->addSpacing(100);
|
||||||
|
|
||||||
|
layout->addStretch();
|
||||||
|
layout->addWidget(iconLabel,0,Qt::AlignHCenter);
|
||||||
|
layout->addSpacing(10);
|
||||||
|
layout->addWidget(text,0,Qt::AlignHCenter);
|
||||||
|
layout->addSpacing(8);
|
||||||
|
layout->addWidget(lineLabel,0,Qt::AlignHCenter);
|
||||||
|
layout->addSpacing(12);
|
||||||
|
layout->addLayout(buttonLayout,0);
|
||||||
|
layout->addSpacing(150);
|
||||||
|
layout->addStretch();
|
||||||
|
|
||||||
|
connect(createButton,SIGNAL(clicked()),this,SIGNAL(createNewLibrary()));
|
||||||
|
connect(addButton,SIGNAL(clicked()),this,SIGNAL(addExistingLibrary()));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
19
YACReaderLibrary/no_libraries_widget.h
Normal file
19
YACReaderLibrary/no_libraries_widget.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#ifndef NO_LIBRARIES_WIDGET_H
|
||||||
|
#define NO_LIBRARIES_WIDGET_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
class NoLibrariesWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit NoLibrariesWidget(QWidget *parent = 0);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void createNewLibrary();
|
||||||
|
void addExistingLibrary();
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NO_LIBRARIES_WIDGET_H
|
@ -1,10 +1,10 @@
|
|||||||
|
|
||||||
echo Setting up a Qt environment...
|
echo Setting up a Qt environment...
|
||||||
|
|
||||||
set QTDIR=D:\Desarrollo\Qt\4.8.3
|
set QTDIR=D:\Desarrollo\Qt\4.8.4
|
||||||
echo -- QTDIR set to D:\Desarrollo\Qt\4.8.3
|
echo -- QTDIR set to D:\Desarrollo\Qt\4.8.4
|
||||||
set PATH=D:\Desarrollo\Qt\4.8.3\bin;%PATH%
|
set PATH=D:\Desarrollo\Qt\4.8.4\bin;%PATH%
|
||||||
echo -- Added D:\Desarrollo\Qt\4.8.3\bin to PATH
|
echo -- Added D:\Desarrollo\Qt\4.8.4\bin to PATH
|
||||||
set QMAKESPEC=win32-msvc2010
|
set QMAKESPEC=win32-msvc2010
|
||||||
echo -- QMAKESPEC set to "win32-msvc2010"
|
echo -- QMAKESPEC set to "win32-msvc2010"
|
||||||
|
|
||||||
|
BIN
images/noLibrariesIcon.png
Normal file
BIN
images/noLibrariesIcon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
BIN
images/noLibrariesLine.png
Normal file
BIN
images/noLibrariesLine.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 238 B |
Loading…
x
Reference in New Issue
Block a user