separadas en ficheros todas las clases que habia en custom_widgets.h/.cpp

eliminado c?digo que ya no se usaba en custom_widgets.h/.cpp
This commit is contained in:
Luis Ángel San Martín 2013-05-16 17:05:38 +02:00
parent af6c6c26b5
commit df286875ca
43 changed files with 1491 additions and 1765 deletions

View File

@ -6,7 +6,8 @@ TARGET =
DEPENDPATH += . \
release
INCLUDEPATH += .
INCLUDEPATH += ../common
INCLUDEPATH += ../common \
../custom_widgets
win32 {
INCLUDEPATH += ../dependencies/poppler/include
@ -89,6 +90,8 @@ SOURCES += comic.cpp \
../common/yacreader_flow_gl.cpp \
../common/onstart_flow_selection_dialog.cpp
include(../custom_widgets/custom_widgets.pri)
RESOURCES += images.qrc \
files.qrc
RC_FILE = icon.rc

View File

@ -1,7 +1,6 @@
#include "goto_flow.h"
#include "configuration.h"
#include "comic.h"
#include "custom_widgets.h"
#include <QVBoxLayout>
#include <QSize>
@ -11,6 +10,19 @@
#include <QMutex>
#include <QCoreApplication>
#include <QLineEdit>
#include <QPushButton>
#include <QPixmap>
#include <QThread>
#include <QSize>
#include <QIntValidator>
#include <QWaitCondition>
#include <QObject>
#include <QEvent>
#include <QLabel>
#include "yacreader_flow.h"
#include "goto_flow_toolbar.h"
#include "goto_flow_decorationbar.h"

View File

@ -1,22 +1,27 @@
#ifndef __GOTO_FLOW_H
#define __GOTO_FLOW_H
#include <QLineEdit>
#include <QPushButton>
#include <QPixmap>
#include <QThread>
#include <QSize>
#include <QIntValidator>
#include <QWaitCondition>
#include <QObject>
#include <QEvent>
#include <QLabel>
#include "custom_widgets.h"
#include "goto_flow_widget.h"
class Comic;
#include <QThread>
#include <QWaitCondition>
class QLineEdit;
class QPushButton;
class QPixmap;
class QThread;
class QSize;
class QIntValidator;
class QWaitCondition;
class QEvent;
class QLabel;
class Comic;
class SlideInitializer;
class PageLoader;
class YACReaderFlow;
class PictureFlow;
class GoToFlow : public GoToFlowWidget
{
@ -71,6 +76,7 @@ private:
//-----------------------------------------------------------------------------
//PageLoader
//-----------------------------------------------------------------------------
class PageLoader : public QThread
{
public:

View File

@ -10,6 +10,8 @@
#include "shortcuts_dialog.h"
#include "width_slider.h"
#include "qnaturalsorting.h"
#include "help_about_dialog.h"
#include "yacreader_tool_bar_stretch.h"
#include <ctime>
#include <algorithm>

View File

@ -6,7 +6,15 @@
#include <QGroupBox>
#include <QRadioButton>
#include <QTabWidget>
#include <QSlider>
#include <QLineEdit>
#include <QPushButton>
#include <QLabel>
#include <QColorDialog>
#include "yacreader_spin_slider_widget.h"
#include "yacreader_flow_config_widget.h"
#include "yacreader_gl_flow_config_widget.h"
OptionsDialog::OptionsDialog(QWidget * parent)
:YACReaderOptionsDialog(parent)

View File

@ -1,16 +1,18 @@
#ifndef __OPTIONS_DIALOG_H
#define __OPTIONS_DIALOG_H
#include <QDialog>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QSlider>
#include <QPushButton>
#include <QRadioButton>
#include <QColorDialog>
#include "yacreader_options_dialog.h"
class QDialog;
class QLabel;
class QLineEdit;
class QPushButton;
class QSlider;
class QPushButton;
class QRadioButton;
class QColorDialog;
class YACReaderSpinSliderWidget;
#include "custom_widgets.h"
class OptionsDialog : public YACReaderOptionsDialog
{

View File

@ -9,7 +9,8 @@ INCLUDEPATH += .
INCLUDEPATH += ../common \
./server \
./db \
../YACReader
../YACReader \
../custom_widgets
DEFINES += SERVER_RELEASE
@ -37,8 +38,6 @@ CONFIG += release
CONFIG -= flat
QT += sql network opengl
# Input
HEADERS += comic_flow.h \
create_library_dialog.h \
@ -73,8 +72,8 @@ HEADERS += comic_flow.h \
../common/yacreader_flow_gl.h \
../common/yacreader_global.h \
../common/onstart_flow_selection_dialog.h \
no_libraries_widget.h \
import_widget.h
no_libraries_widget.h \
import_widget.h
SOURCES += comic_flow.cpp \
create_library_dialog.cpp \
@ -109,11 +108,12 @@ SOURCES += comic_flow.cpp \
../common/qnaturalsorting.cpp \
../common/yacreader_flow_gl.cpp \
../common/onstart_flow_selection_dialog.cpp \
no_libraries_widget.cpp \
import_widget.cpp
no_libraries_widget.cpp \
import_widget.cpp \
include(./server/server.pri)
include(../custom_widgets/custom_widgets.pri)
RESOURCES += images.qrc files.qrc
RC_FILE = icon.rc

View File

@ -1,9 +1,13 @@
#include "comic_flow.h"
#include "qnaturalsorting.h"
#include "yacreader_global.h"
#include <algorithm>
#include <QMutex>
#include <QImageReader>
#include <algorithm>
#include <QTimer>
ComicFlow::ComicFlow(QWidget* parent,FlowType flowType)
:YACReaderFlow(parent,flowType)

View File

@ -1,7 +1,8 @@
#ifndef __COMICFLOW_H
#define __COMICFLOW_H
#include "custom_widgets.h"
#include "yacreader_flow.h"
#include <QtCore>
#include <QObject>
#include <QThread>

View File

@ -3,7 +3,6 @@
#include <QList>
#include <QVariant>
#include "comic_db.h"
//! [0]
class TableItem

View File

@ -6,6 +6,7 @@
#include "tablemodel.h"
#include "data_base_management.h"
#include "qnaturalsorting.h"
#include "comic_db.h"
//ci.number,ci.title,c.fileName,ci.numPages,c.id,c.parentId,c.path,ci.hash,ci.read
#define NUMBER 0

View File

@ -7,7 +7,7 @@
#include <QSqlQuery>
#include <QSqlDatabase>
#include "comic_db.h"
class ComicDB;
class TableItem;

View File

@ -3,7 +3,7 @@
class QString;
class LibraryItem;
class ComicDB;
#include "comic_db.h"
#include <QMap>
#include <QList>

View File

@ -14,6 +14,8 @@
#include <QHBoxLayout>
#include <QFileIconProvider>
#include <QMatrix>
#include <QSettings>
#include <QGLFormat>
#include <iterator>
#include <typeinfo>
@ -24,6 +26,26 @@
#include "no_libraries_widget.h"
#include "import_widget.h"
#include "yacreader_search_line_edit.h"
#include "comic_db.h"
#include "library_creator.h"
#include "package_manager.h"
#include "comic_flow_widget.h"
#include "create_library_dialog.h"
#include "rename_library_dialog.h"
#include "properties_dialog.h"
#include "export_library_dialog.h"
#include "import_library_dialog.h"
#include "export_comics_info_dialog.h"
#include "import_comics_info_dialog.h"
#include "add_library_dialog.h"
#include "options_dialog.h"
#include "help_about_dialog.h"
#include "server_config_dialog.h"
#include "tablemodel.h"
#include "yacreader_tool_bar_stretch.h"
//
LibraryWindow::LibraryWindow()
@ -181,7 +203,7 @@ void LibraryWindow::doLayout()
QVBoxLayout * searchLayout = new QVBoxLayout;
QHBoxLayout * filter = new QHBoxLayout;
filter->addWidget(foldersFilter = new YACReaderLineEdit());
filter->addWidget(foldersFilter = new YACReaderSearchLineEdit());
foldersFilter->setPlaceholderText(tr("Search folders and comics"));
previousFilter = "";
//filter->addWidget(clearFoldersFilter = new QPushButton(tr("Clear")));

View File

@ -2,38 +2,49 @@
#define __LIBRARYWINDOW_H
#include <QMainWindow>
#include <QTableView>
#include <QTreeView>
#include <QMap>
#include <QModelIndex>
#include <QDirModel>
#include <QAction>
#include <QToolBar>
#include <QComboBox>
#include <QThread>
#include <QFileInfoList>
#include <QStackedWidget>
#include <QFileInfo>
//TODO cambiar por class XXXXX
#include "create_library_dialog.h"
#include "add_library_dialog.h"
#include "library_creator.h"
//#include "comic_flow.h"
#include "comic_flow_widget.h"
#include "custom_widgets.h"
#include "rename_library_dialog.h"
#include "properties_dialog.h"
#include "options_dialog.h"
#include "export_comics_info_dialog.h"
#include "import_comics_info_dialog.h"
#include "export_library_dialog.h"
#include "import_library_dialog.h"
#include "package_manager.h"
#include "treemodel.h"
#include "tablemodel.h"
#include "treeitem.h"
#include "server_config_dialog.h"
#include "no_libraries_widget.h"
#include "import_widget.h"
class QTableView;
class QTreeView;
class QDirModel;
class QAction;
class QToolBar;
class QComboBox;
class QThread;
class QStackedWidget;
class YACReaderSearchLineEdit;
class CreateLibraryDialog;
class UpdateLibraryDialog;
class ExportLibraryDialog;
class ImportLibraryDialog;
class ExportComicsInfoDialog;
class ImportComicsInfoDialog;
class AddLibraryDialog;
class LibraryCreator;
class HelpAboutDialog;
class RenameLibraryDialog;
class PropertiesDialog;
class PackageManager;
class ComicFlowWidget;
class QCheckBox;
class QPushButton;
class TableModel;
class QSplitter;
class TreeItem;
class TreeModel;
class QItemSelectionModel;
class QString;
class QLabel;
class NoLibrariesWidget;
class OptionsDialog;
class ServerConfigDialog;
class QCloseEvent;
class ImportWidget;
class QSettings;
class LibraryItem;
#include "comic_db.h"
class LibraryWindow : public QMainWindow
{
@ -64,7 +75,7 @@ private:
QSize slideSizeW;
QSize slideSizeF;
//search filter
YACReaderLineEdit * foldersFilter;
YACReaderSearchLineEdit * foldersFilter;
TreeItem * index; //index al que hay que hacer scroll después de pulsar sobre un folder filtrado
int column;
QString previousFilter;
@ -81,7 +92,6 @@ private:
//QStringList paths;
QMap<QString,QString> libraries;
QLabel * fullScreenToolTip;
YACReaderIconProvider fip;
QStackedWidget * mainWidget;
NoLibrariesWidget * noLibrariesWidget;

View File

@ -1,6 +1,11 @@
#include "library_window.h"
#include <QApplication>
#include <QTranslator>
#include <QSettings>
#include <QLocale>
#include "yacreader_global.h"
#include "startup.h"
#define PICTUREFLOW_QT4 1

View File

@ -1,4 +1,9 @@
#include "options_dialog.h"
#include "yacreader_flow_gl.h"
#include "yacreader_flow_config_widget.h"
#include "yacreader_gl_flow_config_widget.h"
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QFileDialog>
@ -10,9 +15,6 @@
#include <QMessageBox>
#include <QCheckBox>
#include "custom_widgets.h"
#include "yacreader_flow_gl.h"
FlowType flowType = Strip;
OptionsDialog::OptionsDialog(QWidget * parent)

View File

@ -1,18 +1,9 @@
#ifndef __OPTIONS_DIALOG_H
#define __OPTIONS_DIALOG_H
#include <QDialog>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QSlider>
#include <QPushButton>
#include <QRadioButton>
#include <QCheckBox>
#include <QSettings>
#include "pictureflow.h"
#include "yacreader_options_dialog.h"
#include "custom_widgets.h"
#include "yacreader_global.h"
extern FlowType flowType;

View File

@ -1,4 +1,10 @@
#include "properties_dialog.h"
#include "data_base_management.h"
#include "library_creator.h"
#include "yacreader_field_edit.h"
#include "yacreader_field_plain_text_edit.h"
#include <QHBoxLayout>
#include <QApplication>
#include <QDesktopWidget>
@ -8,9 +14,6 @@
#include <QTabWidget>
#include <QIntValidator>
#include "data_base_management.h"
#include "library_creator.h"
PropertiesDialog::PropertiesDialog(QWidget * parent)
:QDialog(parent)
{

View File

@ -2,18 +2,20 @@
#define __PROPERTIES_DIALOG_H
#include <QDialog>
#include <QLabel>
#include <QPushButton>
#include <QScrollArea>
#include <QGroupBox>
#include <QDialogButtonBox>
#include <QGridLayout>
#include <QTabWidget>
#include <QCheckBox>
#include <QIntValidator>
class QGridLayout;
class QTabWidget;
class QGroupBox;
class QLabel;
class QScrollArea;
class QWidget;
class YACReaderFieldEdit;
class YACReaderFieldPlainTextEdit;
class QDialogButtonBox;
class QCheckBox;
#include "comic_db.h"
#include "custom_widgets.h"
class PropertiesDialog : public QDialog
{

File diff suppressed because it is too large Load Diff

View File

@ -1,406 +1,11 @@
#ifndef __CUSTOM_WIDGETS_H
#define __CUSTOM_WIDGETS_H
#include <QDialog>
#include <QHBoxLayout>
#include <QTabWidget>
#include <QTextBrowser>
#include <QDir>
#include <QFileIconProvider>
#include <QDirModel>
#include <QFileInfo>
#include <QItemDelegate>
#include <QStyleOptionViewItemV2>
#include <QStyleOptionViewItemV4>
#include <QVariant>
#include <QSortFilterProxyModel>
#include <QModelIndex>
#include <QRegExp>
#include <QHash>
#include <QLineEdit>
#include <QAction>
#include <QPlainTextEdit>
#include <QTableView>
#include <QLabel>
#include <QSpinBox>
#include <QSlider>
#include <QRadioButton>
class QDir;
#include "yacreader_global.h"
#include "pictureflow.h"
#include "yacreader_flow_gl.h"
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class QToolBarStretch : public QWidget
{
public:
QToolBarStretch(QWidget * parent=0):QWidget(parent)
{
QHBoxLayout * l= new QHBoxLayout();
l->addStretch();
setLayout(l);
}
};
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class HelpAboutDialog : public QDialog
{
Q_OBJECT
public:
HelpAboutDialog(QWidget * parent=0);
HelpAboutDialog(const QString & pathAbout,const QString & pathHelp,QWidget * parent =0);
public slots:
void loadAboutInformation(const QString & path);
void loadHelp(const QString & path);
private:
QTabWidget *tabWidget;
QTextBrowser *aboutText;
QTextBrowser *helpText;
QString fileToString(const QString & path);
};
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class YACReaderIconProvider : public QFileIconProvider
{
public:
YACReaderIconProvider();
virtual QIcon icon ( IconType type ) const;
virtual QIcon icon ( const QFileInfo & info ) const;
virtual QString type ( const QFileInfo & info ) const;
};
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class YACReaderFlow : public PictureFlow
{
Q_OBJECT
public:
YACReaderFlow(QWidget * parent,FlowType flowType = CoverFlowLike);
void mousePressEvent(QMouseEvent* event);
void mouseDoubleClickEvent(QMouseEvent* event);
signals:
void selected(unsigned int centerIndex);
};
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class YACReaderComicDirModel : public QDirModel
{
Q_OBJECT
public:
YACReaderComicDirModel( const QStringList & nameFilters, QDir::Filters filters, QDir::SortFlags sort, QObject * parent = 0 );
QString fileName ( const QModelIndex & index ) const;
QFileInfo fileInfo ( const QModelIndex & index ) const;
};
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class YACReaderComicViewDelegate : public QItemDelegate
{
Q_OBJECT
public:
YACReaderComicViewDelegate(QObject * parent = 0);
virtual void paint ( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const;
QRect textLayoutBounds(const QStyleOptionViewItemV2 &option) const;
};
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class ModelIndexCache
{
public:
struct CacheData{
bool visited;
bool acepted;
};
ModelIndexCache();
void setModelIndex(const QString & index, const CacheData & cd);
CacheData getCacheData(const QString & index) const;
void clear();
private:
QHash<QString, CacheData> cache;
};
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class YACReaderTreeSearch : public QSortFilterProxyModel
{
Q_OBJECT
public:
YACReaderTreeSearch(QObject * parent = 0);
protected:
virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & source_parent ) const;
bool itemMatchesExpression(const QModelIndex &index, const QRegExp &exp) const;
bool containsFiles(QString path,const QRegExp &exp) const;
public slots:
void reset();
void softReset();
private:
ModelIndexCache * cache;
};
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class YACReaderSortComics : public QSortFilterProxyModel
{
Q_OBJECT
public:
YACReaderSortComics(QObject * parent = 0);
protected:
bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
};
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
void delTree(QDir dir);
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class YACReaderFieldEdit : public QLineEdit
{
Q_OBJECT
public:
YACReaderFieldEdit(QWidget * parent = 0);
void clear();
void setDisabled(bool disabled);
protected:
void focusInEvent(QFocusEvent* e);
private:
QAction * restore;
};
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class YACReaderFieldPlainTextEdit : public QPlainTextEdit
{
Q_OBJECT
public:
YACReaderFieldPlainTextEdit(QWidget * parent = 0);
void clear();
void setDisabled(bool disabled);
protected:
void focusInEvent(QFocusEvent* e);
void focusOutEvent(QFocusEvent* e);
private:
QAction * restore;
};
//class YACReaderTableView : public QTableView
//{
// Q_OBJECT
//public:
// YACReaderTableView(QWidget *parent = 0)
// : QTableView(parent) {}
//
//protected:
// bool viewportEvent ( QEvent * event )
// {
// resizeColumnsToContents();
// return QTableView::viewportEvent(event);
// }
//};
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class YACReaderSpinSliderWidget : public QWidget
{
Q_OBJECT
private:
QLabel * label;
QSpinBox * spinBox;
QSlider * slider;
bool tracking;
public:
YACReaderSpinSliderWidget(QWidget * parent = 0,bool strechableSlider = false);
public slots:
void setRange(int lowValue, int topValue, int step=1);
void setValue(int value);
void setText(const QString & text);
int getValue();
QSize minimumSizeHint() const;
void setTracking(bool b);
void valueWillChange(int);
void valueWillChangeFromSpinBox(int);
void sliderRelease();
signals:
void valueChanged(int);
};
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class YACReaderFlowConfigWidget : public QWidget
{
Q_OBJECT
public:
QRadioButton *radio1;
QRadioButton *radio2;
QRadioButton *radio3;
YACReaderFlowConfigWidget(QWidget * parent = 0);
};
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class YACReaderGLFlowConfigWidget : public QWidget
{
Q_OBJECT
public:
YACReaderGLFlowConfigWidget(QWidget * parent = 0);
//GL.........................
QRadioButton *radioClassic;
QRadioButton *radioStripe;
QRadioButton *radioOver;
QRadioButton *radionModern;
QRadioButton *radioDown;
YACReaderSpinSliderWidget * xRotation;
YACReaderSpinSliderWidget * yPosition;
YACReaderSpinSliderWidget * coverDistance;
YACReaderSpinSliderWidget * centralDistance;
YACReaderSpinSliderWidget * zoomLevel;
YACReaderSpinSliderWidget * yCoverOffset;
YACReaderSpinSliderWidget * zCoverOffset;
YACReaderSpinSliderWidget * coverRotation;
YACReaderSpinSliderWidget * fadeOutDist;
YACReaderSpinSliderWidget * lightStrength;
YACReaderSpinSliderWidget * maxAngle;
QSlider * performanceSlider;
QCheckBox * vSyncCheck;
QPushButton * showAdvancedOptions;
QGroupBox *optionsGroupBox;
public slots:
void setValues(Preset preset);
void avancedOptionToogled(bool show);
};
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class YACReaderOptionsDialog : public QDialog
{
Q_OBJECT
protected:
YACReaderFlowConfigWidget * sw;
YACReaderGLFlowConfigWidget * gl;
QCheckBox * useGL;
QPushButton * accept;
QPushButton * cancel;
QSettings * settings;
QSettings * previousSettings;
public:
YACReaderOptionsDialog(QWidget * parent);
public slots:
virtual void restoreOptions(QSettings * settings);
virtual void saveOptions();
protected slots:
virtual void savePerformance(int value);
virtual void saveUseVSync(int b);
virtual void saveUseGL(int b);
virtual void saveXRotation(int value);
virtual void saveYPosition(int value);
virtual void saveCoverDistance(int value);
virtual void saveCentralDistance(int value);
virtual void saveZoomLevel(int value);
virtual void saveYCoverOffset(int value);
virtual void saveZCoverOffset(int value);
virtual void saveCoverRotation(int value);
virtual void saveFadeOutDist(int value);
virtual void saveLightStrength(int value);
virtual void saveMaxAngle(int value);
virtual void loadConfig();
virtual void setClassicConfig();
virtual void setStripeConfig();
virtual void setOverlappedStripeConfig();
virtual void setModernConfig();
virtual void setRouletteConfig();
virtual void setClassicConfigSW();
virtual void setStripeConfigSW();
virtual void setOverlappedStripeConfigSW();
virtual void saveFlowParameters();
signals:
void optionsChanged();
};
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
#include <QLineEdit>
class QToolButton;
class QLabel;
class YACReaderLineEdit : public QLineEdit
{
Q_OBJECT
public:
YACReaderLineEdit(QWidget *parent = 0);
protected:
void resizeEvent(QResizeEvent *);
private slots:
void updateCloseButton(const QString &text);
private:
QToolButton *clearButton;
QLabel * searchLabel;
};
#endif

View File

@ -0,0 +1,24 @@
INCLUDEPATH += $$PWD
DEPENDPATH += $$PWD
HEADERS += $$PWD/help_about_dialog.h \
$$PWD/yacreader_field_edit.h yacreader_search_line_edit.cpp \
$$PWD/yacreader_field_plain_text_edit.h \
$$PWD/yacreader_flow.h \
$$PWD/yacreader_flow_config_widget.h \
$$PWD/yacreader_gl_flow_config_widget.h \
$$PWD/yacreader_options_dialog.h \
$$PWD/yacreader_search_line_edit.h \
$$PWD/yacreader_spin_slider_widget.h \
$$PWD/yacreader_tool_bar_stretch.h \
SOURCES += $$PWD/help_about_dialog.cpp \
$$PWD/yacreader_field_edit.cpp yacreader_search_line_edit.cpp \
$$PWD/yacreader_field_plain_text_edit.cpp \
$$PWD/yacreader_flow.cpp \
$$PWD/yacreader_flow_config_widget.cpp \
$$PWD/yacreader_gl_flow_config_widget.cpp \
$$PWD/yacreader_options_dialog.cpp \
$$PWD/yacreader_search_line_edit.cpp \
$$PWD/yacreader_spin_slider_widget.cpp \
$$PWD/yacreader_tool_bar_stretch.cpp \

View File

@ -0,0 +1,66 @@
#include "help_about_dialog.h"
#include <QVBoxLayout>
#include <QTabWidget>
#include <QTextBrowser>
#include <QApplication>
#include <QFile>
#include <QTextStream>
#include <QTextCodec>
#include <QDesktopWidget>
HelpAboutDialog::HelpAboutDialog(QWidget * parent)
:QDialog(parent)
{
QVBoxLayout * layout = new QVBoxLayout();
tabWidget = new QTabWidget();
tabWidget->addTab(aboutText = new QTextBrowser(), tr("About"));
aboutText->setOpenExternalLinks(true);
aboutText->setFont(QFont("Comic Sans MS", 10)); //purisa
tabWidget->addTab(helpText = new QTextBrowser(), tr("Help"));
helpText->setOpenExternalLinks(true);
helpText->setFont(QFont("Comic Sans MS", 10));
//helpText->setDisabled(true);
//tabWidget->addTab(,"About Qt");
layout->addWidget(tabWidget);
layout->setContentsMargins(1,3,1,1);
setLayout(layout);
resize(500, QApplication::desktop()->availableGeometry().height()*0.83);
}
HelpAboutDialog::HelpAboutDialog(const QString & pathAbout,const QString & pathHelp,QWidget * parent)
:QDialog(parent)
{
loadAboutInformation(pathAbout);
loadHelp(pathHelp);
}
void HelpAboutDialog::loadAboutInformation(const QString & path)
{
aboutText->insertHtml(fileToString(path));
aboutText->moveCursor(QTextCursor::Start);
}
void HelpAboutDialog::loadHelp(const QString & path)
{
helpText->insertHtml(fileToString(path));
helpText->moveCursor(QTextCursor::Start);
}
QString HelpAboutDialog::fileToString(const QString & path)
{
QFile f(path);
f.open(QIODevice::ReadOnly);
QTextStream txtS(&f);
txtS.setCodec(QTextCodec::codecForName("UTF-8"));
QString content = txtS.readAll();
f.close();
return content;
}

View File

@ -0,0 +1,27 @@
#ifndef HELP_ABOUT_DIALOG_H
#define HELP_ABOUT_DIALOG_H
#include <QDialog>
class QTabWidget;
class QTextBrowser;
class HelpAboutDialog : public QDialog
{
Q_OBJECT
public:
HelpAboutDialog(QWidget * parent=0);
HelpAboutDialog(const QString & pathAbout,const QString & pathHelp,QWidget * parent =0);
public slots:
void loadAboutInformation(const QString & path);
void loadHelp(const QString & path);
private:
QTabWidget *tabWidget;
QTextBrowser *aboutText;
QTextBrowser *helpText;
QString fileToString(const QString & path);
};
#endif // HELP_ABOUT_DIALOG_H

View File

@ -0,0 +1,39 @@
#include "yacreader_field_edit.h"
#include <QAction>
#include <QFocusEvent>
YACReaderFieldEdit::YACReaderFieldEdit(QWidget * parent)
:QLineEdit(parent)
{
setPlaceholderText(tr("Click to overwrite"));
setModified(false);
restore = new QAction(tr("Restore to default"),this);
this->addAction(restore);
//this->setContextMenuPolicy(Qt::ActionsContextMenu);
}
void YACReaderFieldEdit::focusInEvent(QFocusEvent* e)
{
if (e->reason() == Qt::MouseFocusReason)
{
setModified(true);
setPlaceholderText("");
}
QLineEdit::focusInEvent(e);
}
void YACReaderFieldEdit::clear()
{
setPlaceholderText(tr("Click to overwrite"));
QLineEdit::clear();
QLineEdit::setModified(false);
}
void YACReaderFieldEdit::setDisabled(bool disabled)
{
if(disabled)
setPlaceholderText("");
QLineEdit::setDisabled(disabled);
}

View File

@ -0,0 +1,23 @@
#ifndef YACREADER_FIELD_EDIT_H
#define YACREADER_FIELD_EDIT_H
#include <QLineEdit>
class QAction;
class QFocusEvent;
class YACReaderFieldEdit : public QLineEdit
{
Q_OBJECT
public:
YACReaderFieldEdit(QWidget * parent = 0);
void clear();
void setDisabled(bool disabled);
protected:
void focusInEvent(QFocusEvent* e);
private:
QAction * restore;
};
#endif // YACREADER_FIELD_EDIT_H

View File

@ -0,0 +1,53 @@
#include "yacreader_field_plain_text_edit.h"
#include <QAction>
YACReaderFieldPlainTextEdit::YACReaderFieldPlainTextEdit(QWidget * parent)
:QPlainTextEdit(parent)
{
document()->setModified(false);
setPlainText(tr("Click to overwrite"));
restore = new QAction(tr("Restore to default"),this);
this->addAction(restore);
//this->setContextMenuPolicy(Qt::ActionsContextMenu);
}
void YACReaderFieldPlainTextEdit::focusInEvent(QFocusEvent* e)
{
if (e->reason() == Qt::MouseFocusReason || e->reason() == Qt::TabFocusReason)
{
document()->setModified(true);
if(toPlainText()==tr("Click to overwrite"))
setPlainText("");
}
QPlainTextEdit::focusInEvent(e);
}
void YACReaderFieldPlainTextEdit::focusOutEvent(QFocusEvent* e)
{
/*if (e->reason() == Qt::MouseFocusReason || e->reason() == Qt::TabFocusReason)
{
if(toPlainText().isEmpty())
{
setPlainText(tr("Click to overwrite"));
document()->setModified(false);
}
}
*/
QPlainTextEdit::focusOutEvent(e);
}
void YACReaderFieldPlainTextEdit::clear()
{
QPlainTextEdit::clear();
document()->setModified(false);
setPlainText(tr("Click to overwrite"));
}
void YACReaderFieldPlainTextEdit::setDisabled(bool disabled)
{
if(disabled)
setPlainText(tr("Click to overwrite"));
QPlainTextEdit::setDisabled(disabled);
}

View File

@ -0,0 +1,25 @@
#ifndef YACREADER_FIELD_PLAIN_TEXT_EDIT_H
#define YACREADER_FIELD_PLAIN_TEXT_EDIT_H
#include <QPlainTextEdit>
class QAction;
class QFocusEvent;
class YACReaderFieldPlainTextEdit : public QPlainTextEdit
{
Q_OBJECT
public:
YACReaderFieldPlainTextEdit(QWidget * parent = 0);
void clear();
void setDisabled(bool disabled);
protected:
void focusInEvent(QFocusEvent* e);
void focusOutEvent(QFocusEvent* e);
private:
QAction * restore;
};
#endif // YACREADER_FIELD_PLAIN_TEXT_EDIT_H

View File

@ -0,0 +1,23 @@
#include "yacreader_flow.h"
#include <QMouseEvent>
YACReaderFlow::YACReaderFlow(QWidget * parent,FlowType flowType) : PictureFlow(parent,flowType) {}
void YACReaderFlow::mousePressEvent(QMouseEvent* event)
{
if(event->x() > (width()+slideSize().width())/2)
showNext();
else
if(event->x() < (width()-slideSize().width())/2)
showPrevious();
//else (centered cover space)
}
void YACReaderFlow::mouseDoubleClickEvent(QMouseEvent* event)
{
if((event->x() > (width()-slideSize().width())/2)&&(event->x() < (width()+slideSize().width())/2))
emit selected(centerIndex());
}

View File

@ -0,0 +1,21 @@
#ifndef YACREADER_FLOW_H
#define YACREADER_FLOW_H
#include "pictureflow.h"
class QMouseEvent;
class YACReaderFlow : public PictureFlow
{
Q_OBJECT
public:
YACReaderFlow(QWidget * parent,FlowType flowType = CoverFlowLike);
void mousePressEvent(QMouseEvent* event);
void mouseDoubleClickEvent(QMouseEvent* event);
signals:
void selected(unsigned int centerIndex);
};
#endif // YACREADER_FLOW_H

View File

@ -0,0 +1,54 @@
#include "yacreader_flow_config_widget.h"
#include <QVBoxLayout>
#include <QGroupBox>
#include <QRadioButton>
#include <QLabel>
YACReaderFlowConfigWidget::YACReaderFlowConfigWidget(QWidget * parent )
:QWidget(parent)
{
QVBoxLayout * layout = new QVBoxLayout(this);
QGroupBox *groupBox = new QGroupBox(tr("How to show covers:"));
radio1 = new QRadioButton(tr("CoverFlow look"));
radio2 = new QRadioButton(tr("Stripe look"));
radio3 = new QRadioButton(tr("Overlapped Stripe look"));
QVBoxLayout *vbox = new QVBoxLayout;
QHBoxLayout * opt1 = new QHBoxLayout;
opt1->addWidget(radio1);
QLabel * lOpt1 = new QLabel();
lOpt1->setPixmap(QPixmap(":/images/flow1.png"));
opt1->addStretch();
opt1->addWidget(lOpt1);
vbox->addLayout(opt1);
QHBoxLayout * opt2 = new QHBoxLayout;
opt2->addWidget(radio2);
QLabel * lOpt2 = new QLabel();
lOpt2->setPixmap(QPixmap(":/images/flow2.png"));
opt2->addStretch();
opt2->addWidget(lOpt2);
vbox->addLayout(opt2);
QHBoxLayout * opt3 = new QHBoxLayout;
opt3->addWidget(radio3);
QLabel * lOpt3 = new QLabel();
lOpt3->setPixmap(QPixmap(":/images/flow3.png"));
opt3->addStretch();
opt3->addWidget(lOpt3);
vbox->addLayout(opt3);
//vbox->addStretch(1);
groupBox->setLayout(vbox);
layout->addWidget(groupBox);
layout->setContentsMargins(0,0,0,0);
setLayout(layout);
}

View File

@ -0,0 +1,19 @@
#ifndef YACREADER_FLOW_CONFIG_WIDGET_H
#define YACREADER_FLOW_CONFIG_WIDGET_H
#include <QWidget>
class QRadioButton;
class YACReaderFlowConfigWidget : public QWidget
{
Q_OBJECT
public:
QRadioButton *radio1;
QRadioButton *radio2;
QRadioButton *radio3;
YACReaderFlowConfigWidget(QWidget * parent = 0);
};
#endif // YACREADER_FLOW_CONFIG_WIDGET_H

View File

@ -0,0 +1,240 @@
#include "yacreader_gl_flow_config_widget.h"
#include "yacreader_spin_slider_widget.h"
#include "yacreader_flow_gl.h" //TODO
#include <QVBoxLayout>
#include <QGroupBox>
#include <QRadioButton>
#include <QLabel>
#include <QPushButton>
YACReaderGLFlowConfigWidget::YACReaderGLFlowConfigWidget(QWidget * parent /* = 0 */)
:QWidget(parent)
{
QVBoxLayout * layout = new QVBoxLayout(this);
//PRESETS------------------------------------------------------------------
QGroupBox *groupBox = new QGroupBox(tr("Presets:"));
radioClassic = new QRadioButton(tr("Classic look"));
connect(radioClassic,SIGNAL(toggled(bool)),this,SLOT(setClassicConfig()));
radioStripe = new QRadioButton(tr("Stripe look"));
connect(radioStripe,SIGNAL(toggled(bool)),this,SLOT(setStripeConfig()));
radioOver = new QRadioButton(tr("Overlapped Stripe look"));
connect(radioOver,SIGNAL(toggled(bool)),this,SLOT(setOverlappedStripeConfig()));
radionModern = new QRadioButton(tr("Modern look"));
connect(radionModern,SIGNAL(toggled(bool)),this,SLOT(setModernConfig()));
radioDown = new QRadioButton(tr("Roulette look"));
connect(radioDown,SIGNAL(toggled(bool)),this,SLOT(setRouletteConfig()));
QVBoxLayout *vbox = new QVBoxLayout;
QHBoxLayout * opt1 = new QHBoxLayout;
opt1->addWidget(radioClassic);
QLabel * lOpt1 = new QLabel();
lOpt1->setPixmap(QPixmap(":/images/flow1.png"));
opt1->addStretch();
opt1->addWidget(lOpt1);
vbox->addLayout(opt1);
QHBoxLayout * opt2 = new QHBoxLayout;
opt2->addWidget(radioStripe);
QLabel * lOpt2 = new QLabel();
lOpt2->setPixmap(QPixmap(":/images/flow2.png"));
opt2->addStretch();
opt2->addWidget(lOpt2);
vbox->addLayout(opt2);
QHBoxLayout * opt3 = new QHBoxLayout;
opt3->addWidget(radioOver);
QLabel * lOpt3 = new QLabel();
lOpt3->setPixmap(QPixmap(":/images/flow3.png"));
opt3->addStretch();
opt3->addWidget(lOpt3);
vbox->addLayout(opt3);
QHBoxLayout * opt4 = new QHBoxLayout;
opt4->addWidget(radionModern);
QLabel * lOpt4 = new QLabel();
lOpt4->setPixmap(QPixmap(":/images/flow4.png"));
opt4->addStretch();
opt4->addWidget(lOpt4);
vbox->addLayout(opt4);
QHBoxLayout * opt5 = new QHBoxLayout;
opt5->addWidget(radioDown);
QLabel * lOpt5 = new QLabel();
lOpt5->setPixmap(QPixmap(":/images/flow5.png"));
opt5->addStretch();
opt5->addWidget(lOpt5);
vbox->addLayout(opt5);
showAdvancedOptions = new QPushButton(tr("Show advanced settings"));
showAdvancedOptions->setCheckable(true);
connect(showAdvancedOptions,SIGNAL(toggled(bool)),this,SLOT(avancedOptionToogled(bool)));
vbox->addWidget(showAdvancedOptions,0,Qt::AlignRight);
groupBox->setLayout(vbox);
//OPTIONS------------------------------------------------------------------
optionsGroupBox = new QGroupBox(tr("Custom:"));
xRotation = new YACReaderSpinSliderWidget(this);
xRotation->setText(tr("View angle"));
xRotation->setRange(0,90);
//connect(xRotation,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
//connect(xRotation,SIGNAL(valueChanged(int)),this,SLOT(saveXRotation(int)));
yPosition = new YACReaderSpinSliderWidget(this);
yPosition->setText(tr("Position"));
yPosition->setRange(-100,100);
//connect(yPosition,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
//connect(yPosition,SIGNAL(valueChanged(int)),this,SLOT(saveYPosition(int)));
coverDistance = new YACReaderSpinSliderWidget(this);
coverDistance->setText(tr("Cover gap"));
coverDistance->setRange(0,150);
//connect(coverDistance,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
//connect(coverDistance,SIGNAL(valueChanged(int)),this,SLOT(saveCoverDistance(int)));
centralDistance = new YACReaderSpinSliderWidget(this);
centralDistance->setText(tr("Central gap"));
centralDistance->setRange(0,150);
//connect(centralDistance,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
//connect(centralDistance,SIGNAL(valueChanged(int)),this,SLOT(saveCentralDistance(int)));
zoomLevel = new YACReaderSpinSliderWidget(this);
zoomLevel->setText(tr("Zoom"));
zoomLevel->setRange(-20,0);
//connect(zoomLevel,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
//connect(zoomLevel,SIGNAL(valueChanged(int)),this,SLOT(saveZoomLevel(int)));
yCoverOffset = new YACReaderSpinSliderWidget(this);
yCoverOffset->setText(tr("Y offset"));
yCoverOffset->setRange(-50,50);
//connect(yCoverOffset,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
//connect(yCoverOffset,SIGNAL(valueChanged(int)),this,SLOT(saveYCoverOffset(int)));
zCoverOffset = new YACReaderSpinSliderWidget(this);
zCoverOffset->setText(tr("Z offset"));
zCoverOffset->setRange(-50,50);
//connect(zCoverOffset,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
//connect(zCoverOffset,SIGNAL(valueChanged(int)),this,SLOT(saveZCoverOffset(int)));
coverRotation = new YACReaderSpinSliderWidget(this);
coverRotation->setText(tr("Cover Angle"));
coverRotation->setRange(0,360);
//connect(coverRotation,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
//connect(coverRotation,SIGNAL(valueChanged(int)),this,SLOT(saveCoverRotation(int)));
fadeOutDist = new YACReaderSpinSliderWidget(this);
fadeOutDist->setText(tr("Visibility"));
fadeOutDist->setRange(0,10);
//connect(fadeOutDist,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
//connect(fadeOutDist,SIGNAL(valueChanged(int)),this,SLOT(saveFadeOutDist(int)));
lightStrength = new YACReaderSpinSliderWidget(this);
lightStrength->setText(tr("Light"));
lightStrength->setRange(0,10);
//connect(lightStrength,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
//connect(lightStrength,SIGNAL(valueChanged(int)),this,SLOT(saveLightStrength(int)));
maxAngle = new YACReaderSpinSliderWidget(this);
maxAngle->setText(tr("Max angle"));
maxAngle->setRange(0,90);
//connect(maxAngle,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
//connect(maxAngle,SIGNAL(valueChanged(int)),this,SLOT(saveMaxAngle(int)));
QVBoxLayout *optionsLayoutStretch = new QVBoxLayout;
optionsLayoutStretch->setContentsMargins(0,0,0,0);
QGridLayout *optionsLayout = new QGridLayout;
optionsLayout->addWidget(xRotation,0,0);
optionsLayout->addWidget(yPosition,0,1);
optionsLayout->addWidget(coverDistance,1,0);
optionsLayout->addWidget(centralDistance,1,1);
optionsLayout->addWidget(zoomLevel,2,0);
optionsLayout->addWidget(yCoverOffset,2,1);
optionsLayout->addWidget(zCoverOffset,3,0);
optionsLayout->addWidget(coverRotation,3,1);
optionsLayout->addWidget(fadeOutDist,4,0);
optionsLayout->addWidget(lightStrength,4,1);
optionsLayout->addWidget(maxAngle,5,0);
optionsLayoutStretch->addLayout(optionsLayout);
optionsLayoutStretch->addStretch();
optionsGroupBox->setLayout(optionsLayoutStretch);
QHBoxLayout * groupBoxesLayout = new QHBoxLayout;
groupBoxesLayout->addWidget(groupBox);
groupBoxesLayout->addWidget(optionsGroupBox);
optionsGroupBox->hide();
QHBoxLayout * performanceSliderLayout = new QHBoxLayout;
performanceSliderLayout->addWidget(new QLabel(tr("Low Performance")));
performanceSliderLayout->addWidget(performanceSlider = new QSlider(Qt::Horizontal));
performanceSliderLayout->addWidget(new QLabel(tr("High Performance")));
performanceSlider->setMinimum(0);
performanceSlider->setMaximum(3);
performanceSlider->setSingleStep(1);
performanceSlider->setPageStep(1);
performanceSlider->setTickInterval(1);
performanceSlider->setTickPosition(QSlider::TicksRight);
QHBoxLayout * vSyncLayout = new QHBoxLayout;
vSyncCheck = new QCheckBox(tr("Use VSync (improve the image quality in fullscreen mode, worse performance)"));
vSyncLayout->addStretch();
vSyncLayout->addWidget(vSyncCheck);
QVBoxLayout * performanceLayout = new QVBoxLayout;
performanceLayout->addLayout(performanceSliderLayout);
performanceLayout->addLayout(vSyncLayout);
QGroupBox *performanceGroupBox = new QGroupBox(tr("Performance:"));
//connect(performanceSlider, SIGNAL(valueChanged(int)),this,SLOT(savePerformance(int)));
//connect(performanceSlider, SIGNAL(valueChanged(int)),this,SLOT(optionsChanged()));
performanceGroupBox->setLayout(performanceLayout);
layout->addLayout(groupBoxesLayout);
layout->addWidget(performanceGroupBox);
layout->setContentsMargins(0,0,0,0);
setLayout(layout);
}
void YACReaderGLFlowConfigWidget::avancedOptionToogled(bool show)
{
if(show)
optionsGroupBox->show();
else
optionsGroupBox->hide();
}
void YACReaderGLFlowConfigWidget::setValues(Preset preset)
{
xRotation->setValue(preset.cfRX);
yPosition->setValue(preset.cfY*100);
coverDistance->setValue(preset.xDistance*100);
centralDistance->setValue(preset.centerDistance*100);
zoomLevel->setValue(preset.cfZ);
yCoverOffset->setValue(preset.yDistance*100);
zCoverOffset->setValue(preset.zDistance*100);
coverRotation->setValue(preset.rotation*-1);
fadeOutDist->setValue(preset.animationFadeOutDist);
lightStrength->setValue(preset.viewRotateLightStrenght);
maxAngle->setValue(preset.viewAngle);
}

View File

@ -0,0 +1,51 @@
#ifndef YACREADER_GL_FLOW_CONFIG_WIDGET_H
#define YACREADER_GL_FLOW_CONFIG_WIDGET_H
#include "yacreader_flow_gl.h" //TODO
#include <QWidget>
class QRadioButton;
class YACReaderSpinSliderWidget;
class QSlider;
class QCheckBox;
class QPushButton;
class QGroupBox;
class YACReaderGLFlowConfigWidget : public QWidget
{
Q_OBJECT
public:
YACReaderGLFlowConfigWidget(QWidget * parent = 0);
//GL.........................
QRadioButton *radioClassic;
QRadioButton *radioStripe;
QRadioButton *radioOver;
QRadioButton *radionModern;
QRadioButton *radioDown;
YACReaderSpinSliderWidget * xRotation;
YACReaderSpinSliderWidget * yPosition;
YACReaderSpinSliderWidget * coverDistance;
YACReaderSpinSliderWidget * centralDistance;
YACReaderSpinSliderWidget * zoomLevel;
YACReaderSpinSliderWidget * yCoverOffset;
YACReaderSpinSliderWidget * zCoverOffset;
YACReaderSpinSliderWidget * coverRotation;
YACReaderSpinSliderWidget * fadeOutDist;
YACReaderSpinSliderWidget * lightStrength;
YACReaderSpinSliderWidget * maxAngle;
QSlider * performanceSlider;
QCheckBox * vSyncCheck;
QPushButton * showAdvancedOptions;
QGroupBox *optionsGroupBox;
public slots:
void setValues(Preset preset);
void avancedOptionToogled(bool show);
};
#endif // YACREADER_GL_FLOW_CONFIG_WIDGET_H

View File

@ -0,0 +1,372 @@
#include "yacreader_options_dialog.h"
#include "yacreader_flow_config_widget.h"
#include "yacreader_gl_flow_config_widget.h"
#include "yacreader_spin_slider_widget.h"
#include "yacreader_global.h"
#include <QPushButton>
#include <QCheckBox>
#include <QRadioButton>
#include <QSlider>
#include <QSettings>
YACReaderOptionsDialog::YACReaderOptionsDialog(QWidget * parent)
:QDialog(parent)
{
sw = new YACReaderFlowConfigWidget(this);
gl = new YACReaderGLFlowConfigWidget(this);
accept = new QPushButton(tr("Save"));
cancel = new QPushButton(tr("Cancel"));
cancel->setDefault(true);
connect(accept,SIGNAL(clicked()),this,SLOT(saveOptions()));
connect(cancel,SIGNAL(clicked()),this,SLOT(restoreOptions()));
connect(cancel,SIGNAL(clicked()),this,SLOT(close()));
useGL = new QCheckBox(tr("Use hardware acceleration (restart needed)"));
connect(useGL,SIGNAL(stateChanged(int)),this,SLOT(saveUseGL(int)));
//sw CONNECTIONS
connect(sw->radio1,SIGNAL(toggled(bool)),this,SLOT(setClassicConfigSW()));
connect(sw->radio2,SIGNAL(toggled(bool)),this,SLOT(setStripeConfigSW()));
connect(sw->radio3,SIGNAL(togg+led(bool)),this,SLOT(setOverlappedStripeConfigSW()));
//gl CONNECTIONS
connect(gl->radioClassic,SIGNAL(toggled(bool)),this,SLOT(setClassicConfig()));
connect(gl->radioStripe,SIGNAL(toggled(bool)),this,SLOT(setStripeConfig()));
connect(gl->radioOver,SIGNAL(toggled(bool)),this,SLOT(setOverlappedStripeConfig()));
connect(gl->radionModern,SIGNAL(toggled(bool)),this,SLOT(setModernConfig()));
connect(gl->radioDown,SIGNAL(toggled(bool)),this,SLOT(setRouletteConfig()));
connect(gl->radioClassic,SIGNAL(toggled(bool)),this,SIGNAL(optionsChanged()));
connect(gl->radioStripe,SIGNAL(toggled(bool)),this,SIGNAL(optionsChanged()));
connect(gl->radioOver,SIGNAL(toggled(bool)),this,SIGNAL(optionsChanged()));
connect(gl->radionModern,SIGNAL(toggled(bool)),this,SIGNAL(optionsChanged()));
connect(gl->radioDown,SIGNAL(toggled(bool)),this,SIGNAL(optionsChanged()));
connect(gl->xRotation,SIGNAL(valueChanged(int)),this,SLOT(saveXRotation(int)));
connect(gl->xRotation,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(gl->yPosition,SIGNAL(valueChanged(int)),this,SLOT(saveYPosition(int)));
connect(gl->yPosition,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(gl->coverDistance,SIGNAL(valueChanged(int)),this,SLOT(saveCoverDistance(int)));
connect(gl->coverDistance,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(gl->centralDistance,SIGNAL(valueChanged(int)),this,SLOT(saveCentralDistance(int)));
connect(gl->centralDistance,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(gl->zoomLevel,SIGNAL(valueChanged(int)),this,SLOT(saveZoomLevel(int)));
connect(gl->zoomLevel,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(gl->yCoverOffset,SIGNAL(valueChanged(int)),this,SLOT(saveYCoverOffset(int)));
connect(gl->yCoverOffset,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(gl->zCoverOffset,SIGNAL(valueChanged(int)),this,SLOT(saveZCoverOffset(int)));
connect(gl->zCoverOffset,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(gl->coverRotation,SIGNAL(valueChanged(int)),this,SLOT(saveCoverRotation(int)));
connect(gl->coverRotation,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(gl->fadeOutDist,SIGNAL(valueChanged(int)),this,SLOT(saveFadeOutDist(int)));
connect(gl->fadeOutDist,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(gl->lightStrength,SIGNAL(valueChanged(int)),this,SLOT(saveLightStrength(int)));
connect(gl->lightStrength,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(gl->maxAngle,SIGNAL(valueChanged(int)),this,SLOT(saveMaxAngle(int)));
connect(gl->maxAngle,SIGNAL(valueChanged(int)),this,SIGNAL(optionsChanged()));
connect(gl->performanceSlider, SIGNAL(valueChanged(int)),this,SLOT(savePerformance(int)));
connect(gl->performanceSlider, SIGNAL(valueChanged(int)),this,SLOT(optionsChanged()));
connect(gl->vSyncCheck,SIGNAL(stateChanged(int)),this,SLOT(saveUseVSync(int)));
}
void YACReaderOptionsDialog::savePerformance(int value)
{
settings->setValue(PERFORMANCE,value);
}
void YACReaderOptionsDialog::saveUseVSync(int b)
{
settings->setValue(V_SYNC,b);
}
void YACReaderOptionsDialog::saveFlowParameters()
{
settings->setValue(X_ROTATION,gl->xRotation->getValue());
settings->setValue(Y_POSITION,gl->yPosition->getValue());
settings->setValue(COVER_DISTANCE,gl->coverDistance->getValue());
settings->setValue(CENTRAL_DISTANCE,gl->centralDistance->getValue());
settings->setValue(ZOOM_LEVEL,gl->zoomLevel->getValue());
settings->setValue(Y_COVER_OFFSET,gl->yCoverOffset->getValue());
settings->setValue(Z_COVER_OFFSET,gl->zCoverOffset->getValue());
settings->setValue(COVER_ROTATION,gl->coverRotation->getValue());
settings->setValue(FADE_OUT_DIST,gl->fadeOutDist->getValue());
settings->setValue(LIGHT_STRENGTH,gl->lightStrength->getValue());
settings->setValue(MAX_ANGLE,gl->maxAngle->getValue());
}
void YACReaderOptionsDialog::saveOptions()
{
emit(optionsChanged());
close();
}
void YACReaderOptionsDialog::saveUseGL(int b)
{
if(Qt::Checked == b)
{
sw->setVisible(false);
gl->setVisible(true);
}
else
{
gl->setVisible(false);
sw->setVisible(true);
}
resize(0,0);
settings->setValue(USE_OPEN_GL,b);
}
void YACReaderOptionsDialog::saveXRotation(int value)
{
settings->setValue(FLOW_TYPE_GL,Custom);
settings->setValue(X_ROTATION,value);
}
void YACReaderOptionsDialog::saveYPosition(int value)
{
settings->setValue(FLOW_TYPE_GL,Custom);
settings->setValue(Y_POSITION,value);
}
void YACReaderOptionsDialog::saveCoverDistance(int value)
{
settings->setValue(FLOW_TYPE_GL,Custom);
settings->setValue(COVER_DISTANCE,value);
}
void YACReaderOptionsDialog::saveCentralDistance(int value)
{
settings->setValue(FLOW_TYPE_GL,Custom);
settings->setValue(CENTRAL_DISTANCE,value);
}
void YACReaderOptionsDialog::saveZoomLevel(int value)
{
settings->setValue(FLOW_TYPE_GL,Custom);
settings->setValue(ZOOM_LEVEL,value);
}
void YACReaderOptionsDialog::saveYCoverOffset(int value)
{
settings->setValue(FLOW_TYPE_GL,Custom);
settings->setValue(Y_COVER_OFFSET,value);
}
void YACReaderOptionsDialog::saveZCoverOffset(int value)
{
settings->setValue(FLOW_TYPE_GL,Custom);
settings->setValue(Z_COVER_OFFSET,value);
}
void YACReaderOptionsDialog::saveCoverRotation(int value)
{
settings->setValue(FLOW_TYPE_GL,Custom);
settings->setValue(COVER_ROTATION,value);
}
void YACReaderOptionsDialog::saveFadeOutDist(int value)
{
settings->setValue(FLOW_TYPE_GL,Custom);
settings->setValue(FADE_OUT_DIST,value);
}
void YACReaderOptionsDialog::saveLightStrength(int value)
{
settings->setValue(FLOW_TYPE_GL,Custom);
settings->setValue(LIGHT_STRENGTH,value);
}
void YACReaderOptionsDialog::saveMaxAngle(int value)
{
settings->setValue(FLOW_TYPE_GL,Custom);
settings->setValue(MAX_ANGLE,value);
}
void YACReaderOptionsDialog::restoreOptions(QSettings * settings)
{
this->settings = settings;
//FLOW CONFIG
if(settings->contains(USE_OPEN_GL) && settings->value(USE_OPEN_GL).toInt() == Qt::Checked)
{
sw->setVisible(false);
gl->setVisible(true);
useGL->setChecked(true);
}
else
{
gl->setVisible(false);
sw->setVisible(true);
useGL->setChecked(false);
}
if(!settings->contains(FLOW_TYPE_GL))
{
setClassicConfig();
gl->radioClassic->setChecked(true);
gl->performanceSlider->setValue(1);
return;
}
if(settings->contains(V_SYNC) && settings->value(V_SYNC).toInt() == Qt::Checked)
gl->vSyncCheck->setChecked(true);
else
gl->vSyncCheck->setChecked(false);
gl->performanceSlider->setValue(settings->value(PERFORMANCE).toInt());
FlowType flowType;
switch(settings->value(FLOW_TYPE_GL).toInt())
{
case 0:
flowType = CoverFlowLike;
break;
case 1:
flowType = Strip;
break;
case 2:
flowType = StripOverlapped;
break;
case 3:
flowType = Modern;
break;
case 4:
flowType = Roulette;
break;
case 5:
flowType = Custom;
break;
}
if(flowType == Custom)
{
loadConfig();
return;
}
if(flowType == CoverFlowLike)
{
setClassicConfig();
gl->radioClassic->setChecked(true);
return;
}
if(flowType == Strip)
{
setStripeConfig();
gl->radioStripe->setChecked(true);
return;
}
if(flowType == StripOverlapped)
{
setOverlappedStripeConfig();
gl->radioOver->setChecked(true);
return;
}
if(flowType == Modern)
{
setModernConfig();
gl->radionModern->setChecked(true);
return;
}
if(flowType == Roulette)
{
setRouletteConfig();
gl->radioDown->setChecked(true);
return;
}
//END FLOW CONFIG
}
void YACReaderOptionsDialog::loadConfig()
{
gl->xRotation->setValue(settings->value(X_ROTATION).toInt());
gl->yPosition->setValue(settings->value(Y_POSITION).toInt());
gl->coverDistance->setValue(settings->value(COVER_DISTANCE).toInt());
gl->centralDistance->setValue(settings->value(CENTRAL_DISTANCE).toInt());
gl->zoomLevel->setValue(settings->value(ZOOM_LEVEL).toInt());
gl->yCoverOffset->setValue(settings->value(Y_COVER_OFFSET).toInt());
gl->zCoverOffset->setValue(settings->value(Z_COVER_OFFSET).toInt());
gl->coverRotation->setValue(settings->value(COVER_ROTATION).toInt());
gl->fadeOutDist->setValue(settings->value(FADE_OUT_DIST).toInt());
gl->lightStrength->setValue(settings->value(LIGHT_STRENGTH).toInt());
gl->maxAngle->setValue(settings->value(MAX_ANGLE).toInt());
}
void YACReaderOptionsDialog::setClassicConfigSW()
{
settings->setValue(FLOW_TYPE_SW,CoverFlowLike);
}
void YACReaderOptionsDialog::setStripeConfigSW()
{
settings->setValue(FLOW_TYPE_SW,Strip);
}
void YACReaderOptionsDialog::setOverlappedStripeConfigSW()
{
settings->setValue(FLOW_TYPE_SW,StripOverlapped);
}
void YACReaderOptionsDialog::setClassicConfig()
{
settings->setValue(FLOW_TYPE_GL,CoverFlowLike);
gl->setValues(presetYACReaderFlowClassicConfig);
saveFlowParameters();
}
void YACReaderOptionsDialog::setStripeConfig()
{
settings->setValue(FLOW_TYPE_GL,Strip);
gl->setValues(presetYACReaderFlowStripeConfig);
saveFlowParameters();
}
void YACReaderOptionsDialog::setOverlappedStripeConfig()
{
settings->setValue(FLOW_TYPE_GL,StripOverlapped);
gl->setValues(presetYACReaderFlowOverlappedStripeConfig);
saveFlowParameters();
}
void YACReaderOptionsDialog::setModernConfig()
{
settings->setValue(FLOW_TYPE_GL,Modern);
gl->setValues(defaultYACReaderFlowConfig);
saveFlowParameters();
}
void YACReaderOptionsDialog::setRouletteConfig()
{
settings->setValue(FLOW_TYPE_GL,Roulette);
gl->setValues(pressetYACReaderFlowDownConfig);
saveFlowParameters();
}

View File

@ -0,0 +1,61 @@
#ifndef YACREADER_OPTIONS_DIALOG_H
#define YACREADER_OPTIONS_DIALOG_H
#include <QDialog>
class YACReaderFlowConfigWidget;
class YACReaderGLFlowConfigWidget;
class QCheckBox;
class QPushButton;
class QSettings;
class YACReaderOptionsDialog : public QDialog
{
Q_OBJECT
protected:
YACReaderFlowConfigWidget * sw;
YACReaderGLFlowConfigWidget * gl;
QCheckBox * useGL;
QPushButton * accept;
QPushButton * cancel;
QSettings * settings;
QSettings * previousSettings;
public:
YACReaderOptionsDialog(QWidget * parent);
public slots:
virtual void restoreOptions(QSettings * settings);
virtual void saveOptions();
protected slots:
virtual void savePerformance(int value);
virtual void saveUseVSync(int b);
virtual void saveUseGL(int b);
virtual void saveXRotation(int value);
virtual void saveYPosition(int value);
virtual void saveCoverDistance(int value);
virtual void saveCentralDistance(int value);
virtual void saveZoomLevel(int value);
virtual void saveYCoverOffset(int value);
virtual void saveZCoverOffset(int value);
virtual void saveCoverRotation(int value);
virtual void saveFadeOutDist(int value);
virtual void saveLightStrength(int value);
virtual void saveMaxAngle(int value);
virtual void loadConfig();
virtual void setClassicConfig();
virtual void setStripeConfig();
virtual void setOverlappedStripeConfig();
virtual void setModernConfig();
virtual void setRouletteConfig();
virtual void setClassicConfigSW();
virtual void setStripeConfigSW();
virtual void setOverlappedStripeConfigSW();
virtual void saveFlowParameters();
signals:
void optionsChanged();
};
#endif // YACREADER_OPTIONS_DIALOG_H

View File

@ -0,0 +1,47 @@
#include "yacreader_search_line_edit.h"
#include <QToolButton>
#include <QStyle>
#include <QLabel>
YACReaderSearchLineEdit::YACReaderSearchLineEdit(QWidget *parent)
: QLineEdit(parent)
{
clearButton = new QToolButton(this);
searchLabel = new QLabel(this);
QPixmap pixmap(":/images/clearSearch.png");
QPixmap pixmapIcon(":/images/iconSearch.png");
searchLabel->setStyleSheet("QLabel { border: none; padding: 0px; }");
searchLabel->setPixmap(pixmapIcon);
clearButton->setIcon(QIcon(pixmap));
clearButton->setIconSize(pixmap.size());
clearButton->setCursor(Qt::ArrowCursor);
clearButton->setStyleSheet("QToolButton { border: none; padding: 0px; }");
clearButton->hide();
connect(clearButton, SIGNAL(clicked()), this, SLOT(clear()));
connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(updateCloseButton(const QString&)));
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
setStyleSheet(QString("QLineEdit { padding-left: %1px; padding-right: %2px; padding-bottom: 1px; margin-bottom: 1px;} ").arg(searchLabel->sizeHint().width() + frameWidth + 6).arg(clearButton->sizeHint().width() + frameWidth + 2));
QSize msz = minimumSizeHint();
setMinimumSize(qMax(msz.width(), clearButton->sizeHint().height() + frameWidth * 2 + 2),
qMax(msz.height(), clearButton->sizeHint().height() + frameWidth * 2 + 2));
}
void YACReaderSearchLineEdit::resizeEvent(QResizeEvent *)
{
QSize sz = clearButton->sizeHint();
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
clearButton->move(rect().right() - frameWidth - sz.width(),
(rect().bottom() + 1 - sz.height())/2);
QSize szl = searchLabel->sizeHint();
searchLabel->move(6,(rect().bottom() + 1 - szl.height())/2);
}
void YACReaderSearchLineEdit::updateCloseButton(const QString& text)
{
clearButton->setVisible(!text.isEmpty());
}

View File

@ -0,0 +1,29 @@
#ifndef YACREADER_SEARCH_LINE_EDIT_H
#define YACREADER_SEARCH_LINE_EDIT_H
#include <QLineEdit>
class QToolButton;
class QLabel;
class YACReaderSearchLineEdit : public QLineEdit
{
Q_OBJECT
public:
YACReaderSearchLineEdit(QWidget *parent = 0);
protected:
void resizeEvent(QResizeEvent *);
private slots:
void updateCloseButton(const QString &text);
private:
QToolButton *clearButton;
QLabel * searchLabel;
};
#endif // YACREADER_SEARCH_LINE_EDIT_H

View File

@ -0,0 +1,91 @@
#include "yacreader_spin_slider_widget.h"
#include <QHBoxLayout>
#include <QLabel>
#include <QSpinBox>
#include <QSlider>
YACReaderSpinSliderWidget::YACReaderSpinSliderWidget(QWidget * parent,bool strechableSlider)
:QWidget(parent),tracking(true)
{
QHBoxLayout * layout = new QHBoxLayout;
layout->addWidget(label = new QLabel(this),1);
if(!strechableSlider)
layout->addStretch();
spinBox = new QSpinBox(this);
layout->addWidget(spinBox);
slider = new QSlider(Qt::Horizontal,this);
layout->addWidget(slider);
if(strechableSlider)
{
layout->setStretchFactor(slider,0.85);
layout->setStretchFactor(spinBox,0);
layout->setStretchFactor(label,0.15);
}
connect(spinBox, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int)));
connect(slider, SIGNAL(valueChanged(int)), spinBox, SLOT(setValue(int)));
connect(slider, SIGNAL(valueChanged(int)), this, SLOT(valueWillChange(int)));
connect(spinBox, SIGNAL(valueChanged(int)), this, SLOT(valueWillChangeFromSpinBox(int)));
connect(slider, SIGNAL(sliderReleased()), this, SLOT(sliderRelease()));
setLayout(layout);
}
void YACReaderSpinSliderWidget::valueWillChange(int v)
{
if(tracking)
emit valueChanged(spinBox->value());
}
void YACReaderSpinSliderWidget::valueWillChangeFromSpinBox(int v)
{
if(!tracking && !slider->isSliderDown())
emit valueChanged(spinBox->value());
}
void YACReaderSpinSliderWidget::sliderRelease()
{
if(!tracking)
emit valueChanged(spinBox->value());
}
void YACReaderSpinSliderWidget::setRange(int lowValue, int topValue, int step)
{
spinBox->setMinimum(lowValue);
spinBox->setMaximum(topValue);
spinBox->setSingleStep(step);
slider->setMinimum(lowValue);
slider->setMaximum(topValue);
slider->setSingleStep(step);
}
void YACReaderSpinSliderWidget::setValue(int value)
{
disconnect(spinBox, SIGNAL(valueChanged(int)), this, SLOT(valueWillChange(int)));
spinBox->setValue(value);
connect(spinBox, SIGNAL(valueChanged(int)), this, SLOT(valueWillChange(int)));
}
void YACReaderSpinSliderWidget::setText(const QString & text)
{
label->setText(text);
}
int YACReaderSpinSliderWidget::getValue()
{
return spinBox->value();
}
QSize YACReaderSpinSliderWidget::minimumSizeHint() const
{
return QSize(270, 25);
}
void YACReaderSpinSliderWidget::setTracking(bool b)
{
tracking = b;
//slider->setTracking(b);
}

View File

@ -0,0 +1,35 @@
#ifndef YACREADER_SPIN_SLIDER_WIDGET_H
#define YACREADER_SPIN_SLIDER_WIDGET_H
#include <QWidget>
class QLabel;
class QSpinBox;
class QSlider;
class YACReaderSpinSliderWidget : public QWidget
{
Q_OBJECT
private:
QLabel * label;
QSpinBox * spinBox;
QSlider * slider;
bool tracking;
public:
YACReaderSpinSliderWidget(QWidget * parent = 0,bool strechableSlider = false);
public slots:
void setRange(int lowValue, int topValue, int step=1);
void setValue(int value);
void setText(const QString & text);
int getValue();
QSize minimumSizeHint() const;
void setTracking(bool b);
void valueWillChange(int);
void valueWillChangeFromSpinBox(int);
void sliderRelease();
signals:
void valueChanged(int);
};
#endif // YACREADER_SPIN_SLIDER_WIDGET_H

View File

@ -0,0 +1,19 @@
#ifndef YACREADER_TOOL_BAR_STRETCH_H
#define YACREADER_TOOL_BAR_STRETCH_H
#include <QWidget>
class QHBoxLayout;
class QToolBarStretch : public QWidget
{
public:
QToolBarStretch(QWidget * parent=0):QWidget(parent)
{
QHBoxLayout * l= new QHBoxLayout();
l->addStretch();
setLayout(l);
}
};
#endif // YACREADER_TOOL_BAR_STRETCH_H