mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
a?adida la opci?n de compilaci?n que permite alternar entre el layout cl?sico de
YACReaderLibrary y el nuevo corregido bug en el evento paint de YACReaderTableView mejorado el redimensionamiento de pictureflow
This commit is contained in:
parent
8b6a600122
commit
2be9ffe8c2
@ -24,6 +24,14 @@ ComicFlowWidgetSW::ComicFlowWidgetSW(QWidget * parent)
|
|||||||
Pal.setColor(QPalette::Background, Qt::black);
|
Pal.setColor(QPalette::Background, Qt::black);
|
||||||
setAutoFillBackground(true);
|
setAutoFillBackground(true);
|
||||||
setPalette(Pal);
|
setPalette(Pal);
|
||||||
|
|
||||||
|
//config
|
||||||
|
QMatrix m;
|
||||||
|
m.rotate(-90);
|
||||||
|
m.scale(-1,1);
|
||||||
|
QImage image(":/images/setRead.png");
|
||||||
|
QImage imageTransformed = image.transformed(m,Qt::SmoothTransformation);
|
||||||
|
setMarkImage(imageTransformed);
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize ComicFlowWidgetSW::minimumSizeHint() const
|
QSize ComicFlowWidgetSW::minimumSizeHint() const
|
||||||
|
@ -69,6 +69,8 @@ protected:
|
|||||||
void mouseDoubleClickEvent(QMouseEvent* event);
|
void mouseDoubleClickEvent(QMouseEvent* event);
|
||||||
QSize minimumSizeHint() const;
|
QSize minimumSizeHint() const;
|
||||||
QSize sizeHint() const;
|
QSize sizeHint() const;
|
||||||
|
QSize slideSizeW;
|
||||||
|
QSize slideSizeF;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ComicFlowWidgetGL : public ComicFlowWidget
|
class ComicFlowWidgetGL : public ComicFlowWidget
|
||||||
|
@ -82,9 +82,10 @@ void LibraryWindow::setupUI()
|
|||||||
|
|
||||||
createActions();
|
createActions();
|
||||||
doModels();
|
doModels();
|
||||||
|
|
||||||
doLayout();
|
doLayout();
|
||||||
doDialogs();
|
|
||||||
createToolBars();
|
createToolBars();
|
||||||
|
doDialogs();
|
||||||
createMenus();
|
createMenus();
|
||||||
createConnections();
|
createConnections();
|
||||||
|
|
||||||
@ -107,14 +108,27 @@ void LibraryWindow::setupUI()
|
|||||||
socialDialog->setHidden(true);*/
|
socialDialog->setHidden(true);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#define NEW_LAYOUT
|
||||||
|
|
||||||
void LibraryWindow::doLayout()
|
void LibraryWindow::doLayout()
|
||||||
{
|
{
|
||||||
|
//LAYOUT ELEMENTS------------------------------------------------------------
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
sVertical = new QSplitter(Qt::Vertical); //spliter derecha
|
sVertical = new QSplitter(Qt::Vertical); //spliter derecha
|
||||||
QSplitter * sHorizontal = new QSplitter(Qt::Horizontal); //spliter principal
|
QSplitter * sHorizontal = new QSplitter(Qt::Horizontal); //spliter principal
|
||||||
sHorizontal->setStyleSheet("QSplitter::handle:vertical {height:4px;}");
|
sHorizontal->setStyleSheet("QSplitter::handle:vertical {height:4px;}");
|
||||||
//TODO: flowType is a global variable
|
|
||||||
//CONFIG COMIC_FLOW--------------------------------------------------------
|
|
||||||
|
|
||||||
|
//TOOLBARS-------------------------------------------------------------------
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
editInfoToolBar = new QToolBar();
|
||||||
|
#ifdef NEW_LAYOUT
|
||||||
|
libraryToolBar = new QToolBar();
|
||||||
|
#else
|
||||||
|
libraryToolBar = addToolBar(tr("Library"));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//FLOW-----------------------------------------------------------------------
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
if(QGLFormat::hasOpenGL() && !settings->contains(USE_OPEN_GL))
|
if(QGLFormat::hasOpenGL() && !settings->contains(USE_OPEN_GL))
|
||||||
{
|
{
|
||||||
OnStartFlowSelectionDialog * flowSelDialog = new OnStartFlowSelectionDialog();
|
OnStartFlowSelectionDialog * flowSelDialog = new OnStartFlowSelectionDialog();
|
||||||
@ -133,50 +147,34 @@ void LibraryWindow::doLayout()
|
|||||||
else
|
else
|
||||||
comicFlow = new ComicFlowWidgetSW(0);
|
comicFlow = new ComicFlowWidgetSW(0);
|
||||||
|
|
||||||
//comicFlow->setFlowType(flowType);
|
|
||||||
comicFlow->updateConfig(settings);
|
comicFlow->updateConfig(settings);
|
||||||
comicFlow->setFocusPolicy(Qt::StrongFocus);
|
comicFlow->setFocusPolicy(Qt::StrongFocus);
|
||||||
comicFlow->setShowMarks(true);
|
comicFlow->setShowMarks(true);
|
||||||
QMatrix m;
|
|
||||||
m.rotate(-90);
|
|
||||||
m.scale(-1,1);
|
|
||||||
QImage image(":/images/setRead.png");
|
|
||||||
QImage imageTransformed = image.transformed(m,Qt::SmoothTransformation);
|
|
||||||
comicFlow->setMarkImage(imageTransformed); //not used in flowGL...
|
|
||||||
int heightDesktopResolution = QApplication::desktop()->screenGeometry().height();
|
|
||||||
int height,width;
|
|
||||||
height = heightDesktopResolution*0.39;
|
|
||||||
width = height*0.65;
|
|
||||||
slideSizeW = QSize(width,height);
|
|
||||||
height = heightDesktopResolution*0.55;
|
|
||||||
width = height*0.70;
|
|
||||||
slideSizeF = QSize(width,height);
|
|
||||||
comicFlow->setSlideSize(slideSizeW);
|
|
||||||
setFocusProxy(comicFlow);
|
setFocusProxy(comicFlow);
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//CONFIG TREE/TABLE VIEWS--------------------------------------------------
|
fullScreenToolTip = new QLabel(comicFlow);
|
||||||
comicView = new YACReaderTableView;
|
fullScreenToolTip->setText(tr("<font color='white'> press 'F' to close fullscreen mode </font>"));
|
||||||
|
fullScreenToolTip->setPalette(QPalette(QColor(0,0,0)));
|
||||||
|
fullScreenToolTip->setFont(QFont("courier new",15,234));
|
||||||
|
fullScreenToolTip->setAutoFillBackground(true);
|
||||||
|
fullScreenToolTip->hide();
|
||||||
|
fullScreenToolTip->adjustSize();
|
||||||
|
|
||||||
|
comicFlow->setFocus(Qt::OtherFocusReason);
|
||||||
|
|
||||||
|
comicFlow->addAction(toggleFullScreenAction);
|
||||||
|
comicFlow->addAction(openComicAction);
|
||||||
|
|
||||||
|
//SIDEBAR-----------------------------------------------------------------------
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
foldersView = new QTreeView;
|
foldersView = new QTreeView;
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//CONFIG FOLDERS/COMICS-------------------------------------------------------
|
|
||||||
/*sVertical->setStretchFactor(0,1);
|
|
||||||
sVertical->setStretchFactor(1,0);
|
|
||||||
*/
|
|
||||||
//views
|
|
||||||
//foldersView->setAnimated(true);
|
|
||||||
foldersView->setContextMenuPolicy(Qt::ActionsContextMenu);
|
foldersView->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||||
foldersView->setContextMenuPolicy(Qt::ActionsContextMenu);
|
foldersView->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||||
foldersView->header()->hide();
|
foldersView->header()->hide();
|
||||||
foldersView->setUniformRowHeights(true);
|
foldersView->setUniformRowHeights(true);
|
||||||
foldersView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
foldersView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
|
|
||||||
|
sideBar = new QWidget;
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//CONFIG NAVEGACIÓN/BÚSQUEDA-----------------------------------------------
|
|
||||||
left = new QWidget;
|
|
||||||
QVBoxLayout * l = new QVBoxLayout;
|
QVBoxLayout * l = new QVBoxLayout;
|
||||||
selectedLibrary = new QComboBox;
|
selectedLibrary = new QComboBox;
|
||||||
l->setContentsMargins(sHorizontal->handleWidth(),0,0,0);
|
l->setContentsMargins(sHorizontal->handleWidth(),0,0,0);
|
||||||
@ -201,19 +199,12 @@ void LibraryWindow::doLayout()
|
|||||||
filter->addWidget(foldersFilter = new YACReaderSearchLineEdit());
|
filter->addWidget(foldersFilter = new YACReaderSearchLineEdit());
|
||||||
foldersFilter->setPlaceholderText(tr("Search folders and comics"));
|
foldersFilter->setPlaceholderText(tr("Search folders and comics"));
|
||||||
previousFilter = "";
|
previousFilter = "";
|
||||||
//filter->addWidget(clearFoldersFilter = new QPushButton(tr("Clear")));
|
|
||||||
|
|
||||||
//searchLayout->addWidget(new QLabel(tr("Search folders/comics"),this));
|
|
||||||
|
|
||||||
searchLayout->addLayout(filter);
|
searchLayout->addLayout(filter);
|
||||||
//includeComicsCheckBox = new QCheckBox(tr("Include files (slower)"),this);
|
|
||||||
//includeComicsCheckBox->setChecked(true);
|
|
||||||
//searchLayout->addWidget(includeComicsCheckBox);
|
|
||||||
|
|
||||||
l->addLayout(searchLayout);
|
l->addLayout(searchLayout);
|
||||||
l->setSpacing(1);
|
l->setSpacing(1);
|
||||||
left->setLayout(l);
|
sideBar->setLayout(l);
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//FINAL LAYOUT-------------------------------------------------------------
|
//FINAL LAYOUT-------------------------------------------------------------
|
||||||
sVertical->addWidget(comicFlow);
|
sVertical->addWidget(comicFlow);
|
||||||
@ -221,15 +212,31 @@ void LibraryWindow::doLayout()
|
|||||||
QVBoxLayout * comicsLayout = new QVBoxLayout;
|
QVBoxLayout * comicsLayout = new QVBoxLayout;
|
||||||
comicsLayout->setSpacing(0);
|
comicsLayout->setSpacing(0);
|
||||||
comicsLayout->setContentsMargins(0,0,0,0);
|
comicsLayout->setContentsMargins(0,0,0,0);
|
||||||
comicsLayout->addWidget(editInfoToolBar = new QToolBar(comics));
|
comicsLayout->addWidget(editInfoToolBar);
|
||||||
|
|
||||||
editInfoToolBar->setStyleSheet("QToolBar {border: none;}");
|
editInfoToolBar->setStyleSheet("QToolBar {border: none;}");
|
||||||
|
|
||||||
|
comicView = new YACReaderTableView;
|
||||||
comicsLayout->addWidget(comicView);
|
comicsLayout->addWidget(comicView);
|
||||||
comics->setLayout(comicsLayout);
|
comics->setLayout(comicsLayout);
|
||||||
sVertical->addWidget(comics);
|
sVertical->addWidget(comics);
|
||||||
sHorizontal->addWidget(left);
|
sHorizontal->addWidget(sideBar);
|
||||||
|
#ifdef NEW_LAYOUT
|
||||||
|
QVBoxLayout * rightLayout = new QVBoxLayout;
|
||||||
|
rightLayout->addWidget(libraryToolBar);
|
||||||
|
rightLayout->addWidget(sVertical);
|
||||||
|
|
||||||
|
rightLayout->setMargin(0);
|
||||||
|
rightLayout->setSpacing(0);
|
||||||
|
|
||||||
|
QWidget * rightWidget = new QWidget();
|
||||||
|
rightWidget->setLayout(rightLayout);
|
||||||
|
|
||||||
|
sHorizontal->addWidget(rightWidget);
|
||||||
|
#else
|
||||||
sHorizontal->addWidget(sVertical);
|
sHorizontal->addWidget(sVertical);
|
||||||
|
#endif
|
||||||
|
|
||||||
sHorizontal->setStretchFactor(0,0);
|
sHorizontal->setStretchFactor(0,0);
|
||||||
sHorizontal->setStretchFactor(1,1);
|
sHorizontal->setStretchFactor(1,1);
|
||||||
mainWidget = new QStackedWidget(this);
|
mainWidget = new QStackedWidget(this);
|
||||||
@ -237,16 +244,9 @@ void LibraryWindow::doLayout()
|
|||||||
setCentralWidget(mainWidget);
|
setCentralWidget(mainWidget);
|
||||||
//FINAL LAYOUT-------------------------------------------------------------
|
//FINAL LAYOUT-------------------------------------------------------------
|
||||||
|
|
||||||
fullScreenToolTip = new QLabel(comicFlow);
|
|
||||||
fullScreenToolTip->setText(tr("<font color='white'> press 'F' to close fullscreen mode </font>"));
|
|
||||||
fullScreenToolTip->setPalette(QPalette(QColor(0,0,0)));
|
|
||||||
fullScreenToolTip->setFont(QFont("courier new",15,234));
|
|
||||||
fullScreenToolTip->setAutoFillBackground(true);
|
|
||||||
fullScreenToolTip->hide();
|
|
||||||
fullScreenToolTip->adjustSize();
|
|
||||||
|
|
||||||
comicFlow->setFocus(Qt::OtherFocusReason);
|
|
||||||
|
|
||||||
|
//OTHER----------------------------------------------------------------------
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
noLibrariesWidget = new NoLibrariesWidget();
|
noLibrariesWidget = new NoLibrariesWidget();
|
||||||
mainWidget->addWidget(noLibrariesWidget);
|
mainWidget->addWidget(noLibrariesWidget);
|
||||||
|
|
||||||
@ -527,8 +527,6 @@ void LibraryWindow::enableLibraryActions()
|
|||||||
|
|
||||||
void LibraryWindow::createToolBars()
|
void LibraryWindow::createToolBars()
|
||||||
{
|
{
|
||||||
libraryToolBar = addToolBar(tr("Library"));
|
|
||||||
|
|
||||||
libraryToolBar->setIconSize(QSize(32,32)); //TODO make icon size dynamic
|
libraryToolBar->setIconSize(QSize(32,32)); //TODO make icon size dynamic
|
||||||
|
|
||||||
libraryToolBar->addAction(createLibraryAction);
|
libraryToolBar->addAction(createLibraryAction);
|
||||||
@ -566,9 +564,6 @@ void LibraryWindow::createToolBars()
|
|||||||
|
|
||||||
libraryToolBar->setMovable(false);
|
libraryToolBar->setMovable(false);
|
||||||
|
|
||||||
comicFlow->addAction(toggleFullScreenAction);
|
|
||||||
comicFlow->addAction(openComicAction);
|
|
||||||
|
|
||||||
editInfoToolBar->setIconSize(QSize(18,18));
|
editInfoToolBar->setIconSize(QSize(18,18));
|
||||||
editInfoToolBar->addAction(openComicAction);
|
editInfoToolBar->addAction(openComicAction);
|
||||||
editInfoToolBar->addSeparator();
|
editInfoToolBar->addSeparator();
|
||||||
@ -1233,10 +1228,10 @@ void LibraryWindow::toFullScreen()
|
|||||||
fromMaximized = this->isMaximized();
|
fromMaximized = this->isMaximized();
|
||||||
|
|
||||||
comicFlow->hide();
|
comicFlow->hide();
|
||||||
comicFlow->setSlideSize(slideSizeF);
|
//comicFlow->setSlideSize(slideSizeF);
|
||||||
comicFlow->setCenterIndex(comicFlow->centerIndex());
|
comicFlow->setCenterIndex(comicFlow->centerIndex());
|
||||||
comics->hide();
|
comics->hide();
|
||||||
left->hide();
|
sideBar->hide();
|
||||||
libraryToolBar->hide();
|
libraryToolBar->hide();
|
||||||
|
|
||||||
showFullScreen();
|
showFullScreen();
|
||||||
@ -1253,11 +1248,11 @@ void LibraryWindow::toNormal()
|
|||||||
{
|
{
|
||||||
fullScreenToolTip->hide();
|
fullScreenToolTip->hide();
|
||||||
comicFlow->hide();
|
comicFlow->hide();
|
||||||
comicFlow->setSlideSize(slideSizeW);
|
//comicFlow->setSlideSize(slideSizeW);
|
||||||
comicFlow->setCenterIndex(comicFlow->centerIndex());
|
comicFlow->setCenterIndex(comicFlow->centerIndex());
|
||||||
comicFlow->render();
|
comicFlow->render();
|
||||||
comics->show();
|
comics->show();
|
||||||
left->show();
|
sideBar->show();
|
||||||
|
|
||||||
libraryToolBar->show();
|
libraryToolBar->show();
|
||||||
comicFlow->show();
|
comicFlow->show();
|
||||||
|
@ -51,7 +51,7 @@ class LibraryWindow : public QMainWindow
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
QWidget * left;
|
QWidget * sideBar;
|
||||||
QSplitter * sVertical;
|
QSplitter * sVertical;
|
||||||
CreateLibraryDialog * createLibraryDialog;
|
CreateLibraryDialog * createLibraryDialog;
|
||||||
UpdateLibraryDialog * updateLibraryDialog;
|
UpdateLibraryDialog * updateLibraryDialog;
|
||||||
|
@ -1251,8 +1251,15 @@ void PictureFlow::paintEvent(QPaintEvent* event)
|
|||||||
|
|
||||||
void PictureFlow::resizeEvent(QResizeEvent* event)
|
void PictureFlow::resizeEvent(QResizeEvent* event)
|
||||||
{
|
{
|
||||||
triggerRender();
|
int heightWidget = event->size().height();
|
||||||
QWidget::resizeEvent(event);
|
int height,width;
|
||||||
|
height = heightWidget*0.55;
|
||||||
|
width = height*0.65;
|
||||||
|
setSlideSize(QSize(width,height));
|
||||||
|
|
||||||
|
render();
|
||||||
|
d->animator->start(centerIndex());
|
||||||
|
QWidget::resizeEvent(event);
|
||||||
}
|
}
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
void PictureFlow::updateAnimation() //bucle principal
|
void PictureFlow::updateAnimation() //bucle principal
|
||||||
|
@ -54,4 +54,6 @@ void YACReaderTableView::resizeEvent(QResizeEvent * event)
|
|||||||
event->size();
|
event->size();
|
||||||
|
|
||||||
deletingProgress->move((event->size().width()-deletingProgress->width())/2 ,1);
|
deletingProgress->move((event->size().width()-deletingProgress->width())/2 ,1);
|
||||||
|
|
||||||
|
QTableView::resizeEvent(event);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user