mirror of
https://github.com/YACReader/yacreader
synced 2025-07-21 22:44:56 -04:00
fixed spaces/tabs mix
This commit is contained in:
@ -17,7 +17,7 @@ class ComicFlow : public YACReaderFlow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ComicFlow(QWidget* parent = 0,FlowType flowType = CoverFlowLike);
|
||||
ComicFlow(QWidget* parent = 0,FlowType flowType = CoverFlowLike);
|
||||
virtual ~ComicFlow();
|
||||
|
||||
void setImagePaths(const QStringList& paths);
|
||||
|
@ -30,7 +30,7 @@ ComicFlowWidgetSW::ComicFlowWidgetSW(QWidget * parent)
|
||||
m.rotate(-90);
|
||||
m.scale(-1,1);
|
||||
QImage image(":/images/setRead.png");
|
||||
QImage imageTransformed = image.transformed(m,Qt::SmoothTransformation);
|
||||
QImage imageTransformed = image.transformed(m,Qt::SmoothTransformation);
|
||||
setMarkImage(imageTransformed);
|
||||
}
|
||||
|
||||
|
@ -8,16 +8,16 @@
|
||||
|
||||
class ComicsRemover : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ComicsRemover(QModelIndexList & indexList, QList<QString> & paths, QObject *parent = 0);
|
||||
|
||||
explicit ComicsRemover(QModelIndexList & indexList, QList<QString> & paths, QObject *parent = 0);
|
||||
|
||||
signals:
|
||||
void remove(int);
|
||||
void finished();
|
||||
|
||||
private:
|
||||
void run();
|
||||
void run();
|
||||
|
||||
private:
|
||||
QModelIndexList indexList;
|
||||
|
@ -77,7 +77,7 @@ QSqlDatabase DataBaseManagement::createDatabase(QString dest)
|
||||
DataBaseManagement::createTables(db);
|
||||
|
||||
QSqlQuery query("INSERT INTO folder (parentId, name, path) "
|
||||
"VALUES (1,'root', '/')",db);
|
||||
"VALUES (1,'root', '/')",db);
|
||||
}
|
||||
//query.finish();
|
||||
//db.close();
|
||||
@ -196,7 +196,7 @@ bool DataBaseManagement::createTables(QSqlDatabase & database)
|
||||
//queryDBInfo.finish();
|
||||
|
||||
QSqlQuery query("INSERT INTO db_info (version) "
|
||||
"VALUES ('"VERSION"')",database);
|
||||
"VALUES ('"VERSION"')",database);
|
||||
//query.finish();
|
||||
}
|
||||
|
||||
@ -568,7 +568,7 @@ bool DataBaseManagement::updateToCurrentVersion(const QString & fullPath)
|
||||
//new 7.0 fields
|
||||
QStringList columnDefs;
|
||||
columnDefs << "hasBeenOpened BOOLEAN DEFAULT 0"
|
||||
<< "rating INTEGER DEFAULT 0"
|
||||
<< "rating INTEGER DEFAULT 0"
|
||||
<< "currentPage INTEGER DEFAULT 1"
|
||||
<< "bookmark1 INTEGER DEFAULT -1"
|
||||
<< "bookmark2 INTEGER DEFAULT -1"
|
||||
|
@ -7,7 +7,7 @@
|
||||
TableItem::TableItem(const QList<QVariant> &data)
|
||||
|
||||
{
|
||||
itemData = data;
|
||||
itemData = data;
|
||||
}
|
||||
//! [0]
|
||||
|
||||
@ -22,14 +22,14 @@ TableItem::~TableItem()
|
||||
//! [5]
|
||||
int TableItem::columnCount() const
|
||||
{
|
||||
return itemData.count();
|
||||
return itemData.count();
|
||||
}
|
||||
//! [5]
|
||||
|
||||
//! [6]
|
||||
QVariant TableItem::data(int column) const
|
||||
{
|
||||
return itemData.value(column);
|
||||
return itemData.value(column);
|
||||
}
|
||||
//! [6]
|
||||
|
||||
@ -42,6 +42,6 @@ void TableItem::setData(int column,const QVariant & value)
|
||||
int TableItem::row() const
|
||||
{
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
//! [8]
|
||||
|
@ -16,23 +16,23 @@ class TableItem;
|
||||
//! [0]
|
||||
class TableModel : public QAbstractItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TableModel(QObject *parent = 0);
|
||||
TableModel( QSqlQuery &sqlquery, QObject *parent = 0);
|
||||
~TableModel();
|
||||
TableModel( QSqlQuery &sqlquery, QObject *parent = 0);
|
||||
~TableModel();
|
||||
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation,
|
||||
int role = Qt::DisplayRole) const;
|
||||
QModelIndex index(int row, int column,
|
||||
const QModelIndex &parent = QModelIndex()) const;
|
||||
QModelIndex parent(const QModelIndex &index) const;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation,
|
||||
int role = Qt::DisplayRole) const;
|
||||
QModelIndex index(int row, int column,
|
||||
const QModelIndex &parent = QModelIndex()) const;
|
||||
QModelIndex parent(const QModelIndex &index) const;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
void setupModelData(unsigned long long int parentFolder,const QString & databasePath);
|
||||
|
||||
//M<>todos de conveniencia
|
||||
@ -61,9 +61,9 @@ public slots:
|
||||
void updateRating(int rating, QModelIndex mi);
|
||||
|
||||
private:
|
||||
void setupModelData( QSqlQuery &sqlquery);
|
||||
void setupModelData( QSqlQuery &sqlquery);
|
||||
ComicDB _getComic(const QModelIndex & mi);
|
||||
QList<TableItem *> _data;
|
||||
QList<TableItem *> _data;
|
||||
|
||||
QString _databasePath;
|
||||
|
||||
|
@ -39,9 +39,9 @@
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
treeitem.cpp
|
||||
treeitem.cpp
|
||||
|
||||
A container for items of data supplied by the simple tree model.
|
||||
A container for items of data supplied by the simple tree model.
|
||||
*/
|
||||
|
||||
#include <QStringList>
|
||||
@ -52,15 +52,15 @@
|
||||
//! [0]
|
||||
TreeItem::TreeItem(const QList<QVariant> &data, TreeItem *parent)
|
||||
{
|
||||
parentItem = parent;
|
||||
itemData = data;
|
||||
parentItem = parent;
|
||||
itemData = data;
|
||||
}
|
||||
//! [0]
|
||||
|
||||
//! [1]
|
||||
TreeItem::~TreeItem()
|
||||
{
|
||||
qDeleteAll(childItems);
|
||||
qDeleteAll(childItems);
|
||||
}
|
||||
//! [1]
|
||||
|
||||
@ -91,52 +91,52 @@ void TreeItem::appendChild(TreeItem *item)
|
||||
|
||||
}
|
||||
|
||||
//childItems.append(item);
|
||||
//childItems.append(item);
|
||||
}
|
||||
//! [2]
|
||||
|
||||
//! [3]
|
||||
TreeItem *TreeItem::child(int row)
|
||||
{
|
||||
return childItems.value(row);
|
||||
return childItems.value(row);
|
||||
}
|
||||
//! [3]
|
||||
|
||||
//! [4]
|
||||
int TreeItem::childCount() const
|
||||
{
|
||||
return childItems.count();
|
||||
return childItems.count();
|
||||
}
|
||||
//! [4]
|
||||
|
||||
//! [5]
|
||||
int TreeItem::columnCount() const
|
||||
{
|
||||
return itemData.count();
|
||||
return itemData.count();
|
||||
}
|
||||
//! [5]
|
||||
|
||||
//! [6]
|
||||
QVariant TreeItem::data(int column) const
|
||||
{
|
||||
return itemData.value(column);
|
||||
return itemData.value(column);
|
||||
}
|
||||
//! [6]
|
||||
|
||||
//! [7]
|
||||
TreeItem *TreeItem::parent()
|
||||
{
|
||||
return parentItem;
|
||||
return parentItem;
|
||||
}
|
||||
//! [7]
|
||||
|
||||
//! [8]
|
||||
int TreeItem::row() const
|
||||
{
|
||||
if (parentItem)
|
||||
return parentItem->childItems.indexOf(const_cast<TreeItem*>(this));
|
||||
if (parentItem)
|
||||
return parentItem->childItems.indexOf(const_cast<TreeItem*>(this));
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
//! [8]
|
||||
|
||||
|
@ -49,28 +49,28 @@
|
||||
class TreeItem
|
||||
{
|
||||
public:
|
||||
TreeItem(const QList<QVariant> &data, TreeItem *parent = 0);
|
||||
~TreeItem();
|
||||
TreeItem(const QList<QVariant> &data, TreeItem *parent = 0);
|
||||
~TreeItem();
|
||||
|
||||
void appendChild(TreeItem *child);
|
||||
void appendChild(TreeItem *child);
|
||||
|
||||
TreeItem *child(int row);
|
||||
int childCount() const;
|
||||
int columnCount() const;
|
||||
QVariant data(int column) const;
|
||||
TreeItem *child(int row);
|
||||
int childCount() const;
|
||||
int columnCount() const;
|
||||
QVariant data(int column) const;
|
||||
QList<QVariant> getData() const;
|
||||
int row() const;
|
||||
TreeItem *parent();
|
||||
int row() const;
|
||||
TreeItem *parent();
|
||||
TreeItem *parentItem;
|
||||
unsigned long long int id;
|
||||
QList<QString> comicNames;
|
||||
TreeItem * originalItem;
|
||||
private:
|
||||
QList<TreeItem*> childItems;
|
||||
QList<QVariant> itemData;
|
||||
QList<TreeItem*> childItems;
|
||||
QList<QVariant> itemData;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
//! [0]
|
||||
|
@ -39,10 +39,10 @@
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
treemodel.cpp
|
||||
treemodel.cpp
|
||||
|
||||
Provides a simple tree model to show how to create and use hierarchical
|
||||
models.
|
||||
Provides a simple tree model to show how to create and use hierarchical
|
||||
models.
|
||||
*/
|
||||
|
||||
#include <QtGui>
|
||||
@ -59,7 +59,7 @@
|
||||
#define ROOT 1
|
||||
|
||||
TreeModel::TreeModel(QObject *parent)
|
||||
: QAbstractItemModel(parent),rootItem(0),rootBeforeFilter(0),filterEnabled(false),includeComics(false)
|
||||
: QAbstractItemModel(parent),rootItem(0),rootBeforeFilter(0),filterEnabled(false),includeComics(false)
|
||||
{
|
||||
connect(this,SIGNAL(beforeReset()),this,SIGNAL(modelAboutToBeReset()));
|
||||
connect(this,SIGNAL(reset()),this,SIGNAL(modelReset()));
|
||||
@ -67,15 +67,15 @@ TreeModel::TreeModel(QObject *parent)
|
||||
|
||||
//! [0]
|
||||
TreeModel::TreeModel( QSqlQuery &sqlquery, QObject *parent)
|
||||
: QAbstractItemModel(parent),rootItem(0),rootBeforeFilter(0),filterEnabled(false),includeComics(false)
|
||||
: QAbstractItemModel(parent),rootItem(0),rootBeforeFilter(0),filterEnabled(false),includeComics(false)
|
||||
{
|
||||
//lo m<>s probable es que el nodo ra<72>z no necesite tener informaci<63>n
|
||||
QList<QVariant> rootData;
|
||||
rootData << "root"; //id 0, padre 0, title "root" (el id, y el id del padre van a ir en la clase TreeItem)
|
||||
rootItem = new TreeItem(rootData);
|
||||
QList<QVariant> rootData;
|
||||
rootData << "root"; //id 0, padre 0, title "root" (el id, y el id del padre van a ir en la clase TreeItem)
|
||||
rootItem = new TreeItem(rootData);
|
||||
rootItem->id = ROOT;
|
||||
rootItem->parentItem = 0;
|
||||
setupModelData(sqlquery, rootItem);
|
||||
setupModelData(sqlquery, rootItem);
|
||||
//sqlquery.finish();
|
||||
}
|
||||
//! [0]
|
||||
@ -91,91 +91,91 @@ TreeModel::~TreeModel()
|
||||
//! [2]
|
||||
int TreeModel::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
if (parent.isValid())
|
||||
return static_cast<TreeItem*>(parent.internalPointer())->columnCount();
|
||||
else
|
||||
return rootItem->columnCount();
|
||||
if (parent.isValid())
|
||||
return static_cast<TreeItem*>(parent.internalPointer())->columnCount();
|
||||
else
|
||||
return rootItem->columnCount();
|
||||
}
|
||||
//! [2]
|
||||
|
||||
//! [3]
|
||||
QVariant TreeModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
if (role == Qt::DecorationRole)
|
||||
#ifdef Q_OS_MAC
|
||||
return QVariant(QFileIconProvider().icon(QFileIconProvider::Folder));
|
||||
return QVariant(QFileIconProvider().icon(QFileIconProvider::Folder));
|
||||
#else
|
||||
return QVariant(QIcon(":/images/folder.png"));
|
||||
#endif
|
||||
|
||||
if (role != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
if (role != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
|
||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
||||
|
||||
return item->data(index.column());
|
||||
return item->data(index.column());
|
||||
}
|
||||
//! [3]
|
||||
|
||||
//! [4]
|
||||
Qt::ItemFlags TreeModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return 0;
|
||||
if (!index.isValid())
|
||||
return 0;
|
||||
|
||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||
}
|
||||
//! [4]
|
||||
|
||||
//! [5]
|
||||
QVariant TreeModel::headerData(int section, Qt::Orientation orientation,
|
||||
int role) const
|
||||
int role) const
|
||||
{
|
||||
if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
|
||||
return rootItem->data(section);
|
||||
if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
|
||||
return rootItem->data(section);
|
||||
|
||||
return QVariant();
|
||||
return QVariant();
|
||||
}
|
||||
//! [5]
|
||||
|
||||
//! [6]
|
||||
QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent)
|
||||
const
|
||||
const
|
||||
{
|
||||
if (!hasIndex(row, column, parent))
|
||||
return QModelIndex();
|
||||
if (!hasIndex(row, column, parent))
|
||||
return QModelIndex();
|
||||
|
||||
TreeItem *parentItem;
|
||||
TreeItem *parentItem;
|
||||
|
||||
if (!parent.isValid())
|
||||
parentItem = rootItem;
|
||||
else
|
||||
parentItem = static_cast<TreeItem*>(parent.internalPointer());
|
||||
if (!parent.isValid())
|
||||
parentItem = rootItem;
|
||||
else
|
||||
parentItem = static_cast<TreeItem*>(parent.internalPointer());
|
||||
|
||||
TreeItem *childItem = parentItem->child(row);
|
||||
if (childItem)
|
||||
return createIndex(row, column, childItem);
|
||||
else
|
||||
return QModelIndex();
|
||||
TreeItem *childItem = parentItem->child(row);
|
||||
if (childItem)
|
||||
return createIndex(row, column, childItem);
|
||||
else
|
||||
return QModelIndex();
|
||||
}
|
||||
//! [6]
|
||||
|
||||
//! [7]
|
||||
QModelIndex TreeModel::parent(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QModelIndex();
|
||||
if (!index.isValid())
|
||||
return QModelIndex();
|
||||
|
||||
TreeItem *childItem = static_cast<TreeItem*>(index.internalPointer());
|
||||
TreeItem *parentItem = childItem->parent();
|
||||
TreeItem *childItem = static_cast<TreeItem*>(index.internalPointer());
|
||||
TreeItem *parentItem = childItem->parent();
|
||||
|
||||
if (parentItem == rootItem)
|
||||
return QModelIndex();
|
||||
if (parentItem == rootItem)
|
||||
return QModelIndex();
|
||||
|
||||
return createIndex(parentItem->row(), 0, parentItem);
|
||||
return createIndex(parentItem->row(), 0, parentItem);
|
||||
}
|
||||
//! [7]
|
||||
|
||||
@ -192,16 +192,16 @@ QModelIndex TreeModel::indexFromItem(TreeItem * item,int column)
|
||||
//! [8]
|
||||
int TreeModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
TreeItem *parentItem;
|
||||
if (parent.column() > 0)
|
||||
return 0;
|
||||
TreeItem *parentItem;
|
||||
if (parent.column() > 0)
|
||||
return 0;
|
||||
|
||||
if (!parent.isValid())
|
||||
parentItem = rootItem;
|
||||
else
|
||||
parentItem = static_cast<TreeItem*>(parent.internalPointer());
|
||||
if (!parent.isValid())
|
||||
parentItem = rootItem;
|
||||
else
|
||||
parentItem = static_cast<TreeItem*>(parent.internalPointer());
|
||||
|
||||
return parentItem->childCount();
|
||||
return parentItem->childCount();
|
||||
}
|
||||
//! [8]
|
||||
|
||||
|
@ -52,26 +52,26 @@ class TreeItem;
|
||||
//! [0]
|
||||
class TreeModel : public QAbstractItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TreeModel(QObject *parent = 0);
|
||||
TreeModel( QSqlQuery &sqlquery, QObject *parent = 0);
|
||||
~TreeModel();
|
||||
TreeModel( QSqlQuery &sqlquery, QObject *parent = 0);
|
||||
~TreeModel();
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation,
|
||||
int role = Qt::DisplayRole) const;
|
||||
QModelIndex index(int row, int column,
|
||||
const QModelIndex &parent = QModelIndex()) const;
|
||||
QModelIndex parent(const QModelIndex &index) const;
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation,
|
||||
int role = Qt::DisplayRole) const;
|
||||
QModelIndex index(int row, int column,
|
||||
const QModelIndex &parent = QModelIndex()) const;
|
||||
QModelIndex parent(const QModelIndex &index) const;
|
||||
QModelIndex indexFromItem(TreeItem * item, int column);
|
||||
/*QModelIndex _indexFromItem(TreeItem * item, int column);
|
||||
int column;*/
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
void setupModelData(QString path);
|
||||
QString getDatabase();
|
||||
|
||||
@ -82,11 +82,11 @@ public:
|
||||
void resetFilter();
|
||||
bool isFilterEnabled(){return filterEnabled;};
|
||||
private:
|
||||
void setupModelData( QSqlQuery &sqlquery, TreeItem *parent);
|
||||
void setupModelData( QSqlQuery &sqlquery, TreeItem *parent);
|
||||
void setupFilteredModelData( QSqlQuery &sqlquery, TreeItem *parent);
|
||||
void setupFilteredModelData();
|
||||
|
||||
TreeItem *rootItem; //el <20>rbol
|
||||
TreeItem *rootItem; //el <20>rbol
|
||||
QMap<unsigned long long int, TreeItem *> items; //relaci<63>n entre folders
|
||||
|
||||
TreeItem *rootBeforeFilter;
|
||||
|
@ -1,12 +1,12 @@
|
||||
<RCC>
|
||||
<qresource>
|
||||
<file>../files/about.html</file>
|
||||
<file>../files/helpYACReaderLibrary.html</file>
|
||||
</qresource>
|
||||
<qresource>
|
||||
<file>../files/about.html</file>
|
||||
<file>../files/helpYACReaderLibrary.html</file>
|
||||
</qresource>
|
||||
|
||||
<qresource lang="es_ES">
|
||||
<file alias="/files/about.html">../files/about_es_ES.html</file>
|
||||
<file alias="/files/helpYACReaderLibrary.html">../files/helpYACReaderLibrary_es_ES.html</file>
|
||||
</qresource>
|
||||
<qresource lang="es_ES">
|
||||
<file alias="/files/about.html">../files/about_es_ES.html</file>
|
||||
<file alias="/files/helpYACReaderLibrary.html">../files/helpYACReaderLibrary_es_ES.html</file>
|
||||
</qresource>
|
||||
|
||||
</RCC>
|
||||
|
@ -1,25 +1,25 @@
|
||||
<RCC>
|
||||
<qresource prefix="/" >
|
||||
<file>../images/folder.png</file>
|
||||
<file>../images/icon.png</file>
|
||||
<file>../images/icon.png</file>
|
||||
<file>../images/iconLibrary.png</file>
|
||||
<file>../images/new.png</file>
|
||||
<file>../images/openLibrary.png</file>
|
||||
<file>../images/removeLibraryIcon.png</file>
|
||||
<file>../images/updateLibraryIcon.png</file>
|
||||
<file>../images/removeLibraryIcon.png</file>
|
||||
<file>../images/updateLibraryIcon.png</file>
|
||||
<file>../images/comicFolder.png</file>
|
||||
<file>../images/notCover.png</file>
|
||||
<file>../images/edit.png</file>
|
||||
<file>../images/editIcon.png</file>
|
||||
<file>../images/editIcon.png</file>
|
||||
<file>../images/flow1.png</file>
|
||||
<file>../images/flow2.png</file>
|
||||
<file>../images/flow3.png</file>
|
||||
<file>../images/flow4.png</file>
|
||||
<file>../images/flow5.png</file>
|
||||
<file>../images/flow4.png</file>
|
||||
<file>../images/flow5.png</file>
|
||||
<file>../images/importLibrary.png</file>
|
||||
<file>../images/importLibraryIcon.png</file>
|
||||
<file>../images/importLibraryIcon.png</file>
|
||||
<file>../images/exportLibrary.png</file>
|
||||
<file>../images/exportLibraryIcon.png</file>
|
||||
<file>../images/exportLibraryIcon.png</file>
|
||||
<file>../images/open.png</file>
|
||||
<file>../images/coversPackage.png</file>
|
||||
<file>../images/setRead.png</file>
|
||||
@ -32,27 +32,27 @@
|
||||
<file>../images/hideComicFlow.png</file>
|
||||
<file>../images/exportComicsInfo.png</file>
|
||||
<file>../images/importComicsInfo.png</file>
|
||||
<file>../images/exportComicsInfoIcon.png</file>
|
||||
<file>../images/exportComicsInfoIcon.png</file>
|
||||
<file>../images/importComicsInfoIcon.png</file>
|
||||
<file>../images/db.png</file>
|
||||
<file>../images/asignNumber.png</file>
|
||||
<file>../images/defaultCover.png</file>
|
||||
<file>../images/iphoneConfig.png</file>
|
||||
<file>../images/onStartFlowSelection.png</file>
|
||||
<file>../images/onStartFlowSelection_es.png</file>
|
||||
<file>../images/useNewFlowButton.png</file>
|
||||
<file>../images/useOldFlowButton.png</file>
|
||||
<file>../images/serverConfigBackground.png</file>
|
||||
<file>../images/noLibrariesIcon.png</file>
|
||||
<file>../images/noLibrariesLine.png</file>
|
||||
<file>../images/importingIcon.png</file>
|
||||
<file>../images/updatingIcon.png</file>
|
||||
<file>../images/importTopCoversDecoration.png</file>
|
||||
<file>../images/importBottomCoversDecoration.png</file>
|
||||
<file>../images/glowLine.png</file>
|
||||
<file>../images/clearSearch.png</file>
|
||||
<file>../images/iconSearch.png</file>
|
||||
<file>../images/readRibbon.png</file>
|
||||
<file>../images/defaultCover.png</file>
|
||||
<file>../images/iphoneConfig.png</file>
|
||||
<file>../images/onStartFlowSelection.png</file>
|
||||
<file>../images/onStartFlowSelection_es.png</file>
|
||||
<file>../images/useNewFlowButton.png</file>
|
||||
<file>../images/useOldFlowButton.png</file>
|
||||
<file>../images/serverConfigBackground.png</file>
|
||||
<file>../images/noLibrariesIcon.png</file>
|
||||
<file>../images/noLibrariesLine.png</file>
|
||||
<file>../images/importingIcon.png</file>
|
||||
<file>../images/updatingIcon.png</file>
|
||||
<file>../images/importTopCoversDecoration.png</file>
|
||||
<file>../images/importBottomCoversDecoration.png</file>
|
||||
<file>../images/glowLine.png</file>
|
||||
<file>../images/clearSearch.png</file>
|
||||
<file>../images/iconSearch.png</file>
|
||||
<file>../images/readRibbon.png</file>
|
||||
<file>../images/readingRibbon.png</file>
|
||||
<file>../images/shownCovers.png</file>
|
||||
<file>../images/hiddenCovers.png</file>
|
||||
@ -60,21 +60,21 @@
|
||||
<file>../images/setReadButton.png</file>
|
||||
<file>../images/openInYACReader.png</file>
|
||||
<!--<file>../images/deleting_progress/imgTopLeft.png</file>
|
||||
<file>../images/deleting_progress/imgTopMiddle.png</file>
|
||||
<file>../images/deleting_progress/imgTopRight.png</file>
|
||||
<file>../images/deleting_progress/imgLeftMiddle.png</file>
|
||||
<file>../images/deleting_progress/imgRightMiddle.png</file>
|
||||
<file>../images/deleting_progress/imgBottomLeft.png</file>
|
||||
<file>../images/deleting_progress/imgBottomMiddle.png</file>
|
||||
<file>../images/deleting_progress/imgBottomRight.png</file>
|
||||
<file>../images/deleting_progress/icon.png</file>
|
||||
<file>../images/social_dialog/close.png</file>
|
||||
<file>../images/social_dialog/facebook.png</file>
|
||||
<file>../images/social_dialog/google+.png</file>
|
||||
<file>../images/social_dialog/icon.png</file>
|
||||
<file>../images/social_dialog/shadow.png</file>
|
||||
<file>../images/social_dialog/twitter.png</file>
|
||||
<file>../images/social_dialog/separator.png</file>-->
|
||||
<file>../images/deleting_progress/imgTopMiddle.png</file>
|
||||
<file>../images/deleting_progress/imgTopRight.png</file>
|
||||
<file>../images/deleting_progress/imgLeftMiddle.png</file>
|
||||
<file>../images/deleting_progress/imgRightMiddle.png</file>
|
||||
<file>../images/deleting_progress/imgBottomLeft.png</file>
|
||||
<file>../images/deleting_progress/imgBottomMiddle.png</file>
|
||||
<file>../images/deleting_progress/imgBottomRight.png</file>
|
||||
<file>../images/deleting_progress/icon.png</file>
|
||||
<file>../images/social_dialog/close.png</file>
|
||||
<file>../images/social_dialog/facebook.png</file>
|
||||
<file>../images/social_dialog/google+.png</file>
|
||||
<file>../images/social_dialog/icon.png</file>
|
||||
<file>../images/social_dialog/shadow.png</file>
|
||||
<file>../images/social_dialog/twitter.png</file>
|
||||
<file>../images/social_dialog/separator.png</file>-->
|
||||
<file>../images/main_toolbar/divider.png</file>
|
||||
<file>../images/collapsed_branch_osx.png</file>
|
||||
<file>../images/expanded_branch_osx.png</file>
|
||||
@ -87,12 +87,12 @@
|
||||
<file>../images/collapsed_branch_selected.png</file>
|
||||
<file>../images/previousCoverPage.png</file>
|
||||
<file>../images/nextCoverPage.png</file>
|
||||
<file>../images/rating0.png</file>
|
||||
<file>../images/rating1.png</file>
|
||||
<file>../images/rating2.png</file>
|
||||
<file>../images/rating3.png</file>
|
||||
<file>../images/rating4.png</file>
|
||||
<file>../images/rating5.png</file>
|
||||
<file>../images/rating0.png</file>
|
||||
<file>../images/rating1.png</file>
|
||||
<file>../images/rating2.png</file>
|
||||
<file>../images/rating3.png</file>
|
||||
<file>../images/rating4.png</file>
|
||||
<file>../images/rating5.png</file>
|
||||
<!--<file>../images/busy_background.png</file>-->
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -4,12 +4,12 @@
|
||||
<file>../images/main_toolbar/back_disabled.png</file>
|
||||
<file>../images/main_toolbar/forward.png</file>
|
||||
<file>../images/main_toolbar/forward_disabled.png</file>
|
||||
<file>../images/main_toolbar/settings.png</file>
|
||||
<file>../images/main_toolbar/settings.png</file>
|
||||
<file>../images/main_toolbar/server.png</file>
|
||||
<file>../images/main_toolbar/help.png</file>
|
||||
<file>../images/main_toolbar/fullscreen.png</file>
|
||||
|
||||
<file>../images/libraryIcon.png</file>
|
||||
|
||||
<file>../images/libraryIcon.png</file>
|
||||
<file>../images/setRoot.png</file>
|
||||
<file>../images/expand.png</file>
|
||||
<file>../images/colapse.png</file>
|
||||
|
@ -113,7 +113,7 @@ void ImportLibraryDialog::findPath()
|
||||
{
|
||||
path->setText(s);
|
||||
if(!destPath->text().isEmpty() && !nameEdit->text().isEmpty())
|
||||
accept->setEnabled(true);
|
||||
accept->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,18 +125,18 @@ void ImportLibraryDialog::findDestination()
|
||||
{
|
||||
destPath->setText(s);
|
||||
if(!path->text().isEmpty() && !nameEdit->text().isEmpty())
|
||||
accept->setEnabled(true);
|
||||
accept->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void ImportLibraryDialog::nameEntered()
|
||||
{
|
||||
if(!nameEdit->text().isEmpty())
|
||||
{
|
||||
if(!nameEdit->text().isEmpty())
|
||||
{
|
||||
if(!path->text().isEmpty() && !destPath->text().isEmpty())
|
||||
accept->setEnabled(true);
|
||||
}
|
||||
else
|
||||
accept->setEnabled(true);
|
||||
}
|
||||
else
|
||||
accept->setEnabled(false);
|
||||
}
|
||||
|
||||
@ -152,5 +152,5 @@ void ImportLibraryDialog::close()
|
||||
|
||||
void ImportLibraryDialog::closeEvent ( QCloseEvent * e )
|
||||
{
|
||||
close();
|
||||
close();
|
||||
}
|
||||
|
@ -89,14 +89,14 @@ YACReaderActivityIndicatorWidget::YACReaderActivityIndicatorWidget(QWidget * par
|
||||
|
||||
|
||||
ImportWidget::ImportWidget(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
QWidget(parent)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
|
||||
|
||||
QPalette p(palette());
|
||||
p.setColor(QPalette::Background, QColor(250,250,250));
|
||||
setAutoFillBackground(true);
|
||||
setPalette(p);
|
||||
p.setColor(QPalette::Background, QColor(250,250,250));
|
||||
setAutoFillBackground(true);
|
||||
setPalette(p);
|
||||
|
||||
QPixmap icon(":/images/importingIcon.png");
|
||||
iconLabel = new QLabel();
|
||||
|
@ -13,12 +13,12 @@ class QResizeEvent;
|
||||
|
||||
class ImportWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ImportWidget(QWidget *parent = 0);
|
||||
|
||||
explicit ImportWidget(QWidget *parent = 0);
|
||||
|
||||
signals:
|
||||
void stop();
|
||||
void stop();
|
||||
public slots:
|
||||
void newComic(const QString & path, const QString & coverPath);
|
||||
void newCover(const QPixmap & image);
|
||||
@ -46,7 +46,7 @@ private:
|
||||
QToolButton * hideButton;
|
||||
|
||||
void resizeEvent(QResizeEvent * event);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // IMPORT_WIDGET_H
|
||||
|
@ -148,14 +148,14 @@ void LibraryCreator::create(QDir dir)
|
||||
QFileInfo fileInfo = list.at(i);
|
||||
QString fileName = fileInfo.fileName();
|
||||
#ifdef Q_OS_MAC
|
||||
QStringList src = _source.split("/");
|
||||
QStringList src = _source.split("/");
|
||||
QString filePath = fileInfo.absoluteFilePath();
|
||||
QStringList fp = filePath.split("/");
|
||||
for(int i = 0; i< src.count();i++)
|
||||
{
|
||||
fp.removeFirst();
|
||||
}
|
||||
QString relativePath = "/" + fp.join("/");
|
||||
QStringList fp = filePath.split("/");
|
||||
for(int i = 0; i< src.count();i++)
|
||||
{
|
||||
fp.removeFirst();
|
||||
}
|
||||
QString relativePath = "/" + fp.join("/");
|
||||
#else
|
||||
QString relativePath = QDir::cleanPath(fileInfo.absoluteFilePath()).remove(_source);
|
||||
#endif
|
||||
|
@ -24,8 +24,8 @@
|
||||
public:
|
||||
LibraryCreator();
|
||||
void createLibrary(const QString & source, const QString & target);
|
||||
void updateLibrary(const QString & source, const QString & target);
|
||||
void stop();
|
||||
void updateLibrary(const QString & source, const QString & target);
|
||||
void stop();
|
||||
private:
|
||||
void processLibrary(const QString & source, const QString & target);
|
||||
enum Mode {CREATOR,UPDATER};
|
||||
@ -39,19 +39,19 @@
|
||||
//recursive method
|
||||
void create(QDir currentDirectory);
|
||||
void update(QDir currentDirectory);
|
||||
void run();
|
||||
void run();
|
||||
qulonglong insertFolders();//devuelve el id del <20>ltimo folder a<>adido (<28>ltimo en la ruta)
|
||||
bool checkCover(const QString & hash);
|
||||
void insertComic(const QString & relativePath,const QFileInfo & fileInfo);
|
||||
//qulonglong insertFolder(qulonglong parentId,const Folder & folder);
|
||||
//qulonglong insertComic(const Comic & comic);
|
||||
bool stopRunning;
|
||||
bool stopRunning;
|
||||
//LibraryCreator est<73> en modo creaci<63>n si creation == true;
|
||||
bool creation;
|
||||
signals:
|
||||
void finished();
|
||||
void coverExtracted(QString);
|
||||
void folderUpdated(QString);
|
||||
void coverExtracted(QString);
|
||||
void folderUpdated(QString);
|
||||
void comicAdded(QString,QString);
|
||||
void updated();
|
||||
void created();
|
||||
|
@ -43,7 +43,7 @@ int main( int argc, char ** argv )
|
||||
#endif
|
||||
|
||||
if(YACReaderLocalServer::isRunning()) //s<>lo se permite una instancia de YACReaderLibrary
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
YACReaderLocalServer * localServer = new YACReaderLocalServer();
|
||||
|
||||
|
@ -6,14 +6,14 @@
|
||||
#include <QPushButton>
|
||||
|
||||
NoLibrariesWidget::NoLibrariesWidget(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
QWidget(parent)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
|
||||
|
||||
QPalette p(palette());
|
||||
p.setColor(QPalette::Background, QColor(250,250,250));
|
||||
setAutoFillBackground(true);
|
||||
setPalette(p);
|
||||
p.setColor(QPalette::Background, QColor(250,250,250));
|
||||
setAutoFillBackground(true);
|
||||
setPalette(p);
|
||||
|
||||
QPixmap icon(":/images/noLibrariesIcon.png");
|
||||
QLabel * iconLabel = new QLabel();
|
||||
|
@ -5,15 +5,15 @@
|
||||
|
||||
class NoLibrariesWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit NoLibrariesWidget(QWidget *parent = 0);
|
||||
|
||||
explicit NoLibrariesWidget(QWidget *parent = 0);
|
||||
|
||||
signals:
|
||||
void createNewLibrary();
|
||||
void createNewLibrary();
|
||||
void addExistingLibrary();
|
||||
public slots:
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // NO_LIBRARIES_WIDGET_H
|
||||
|
@ -42,7 +42,7 @@ OptionsDialog::OptionsDialog(QWidget * parent)
|
||||
|
||||
setLayout(layout);
|
||||
//restoreOptions(settings); //load options
|
||||
//resize(200,0);
|
||||
//resize(200,0);
|
||||
setModal (true);
|
||||
setWindowTitle(tr("Options"));
|
||||
|
||||
|
@ -10,7 +10,7 @@ public:
|
||||
PackageManager();
|
||||
void createPackage(const QString & libraryPath,const QString & dest);
|
||||
void extractPackage(const QString & packagePath,const QString & destDir);
|
||||
public slots:
|
||||
public slots:
|
||||
void cancel();
|
||||
private:
|
||||
bool creating;
|
||||
|
@ -22,8 +22,8 @@ PropertiesDialog::PropertiesDialog(QWidget * parent)
|
||||
{
|
||||
|
||||
createCoverBox();
|
||||
createGeneralInfoBox();
|
||||
createAuthorsBox();
|
||||
createGeneralInfoBox();
|
||||
createAuthorsBox();
|
||||
createPublishingBox();
|
||||
createButtonBox();
|
||||
createPlotBox();
|
||||
@ -123,10 +123,10 @@ void PropertiesDialog::createCoverBox()
|
||||
QFrame * createLine()
|
||||
{
|
||||
QFrame * line = new QFrame();
|
||||
line->setObjectName(QString::fromUtf8("line"));
|
||||
//line->setGeometry(QRect(320, 150, 118, 3));
|
||||
line->setFrameShape(QFrame::HLine);
|
||||
line->setFrameShadow(QFrame::Sunken);
|
||||
line->setObjectName(QString::fromUtf8("line"));
|
||||
//line->setGeometry(QRect(320, 150, 118, 3));
|
||||
line->setFrameShape(QFrame::HLine);
|
||||
line->setFrameShadow(QFrame::Sunken);
|
||||
|
||||
return line;
|
||||
}
|
||||
@ -137,7 +137,7 @@ void PropertiesDialog::createGeneralInfoBox()
|
||||
|
||||
QFormLayout *generalInfoLayout = new QFormLayout;
|
||||
|
||||
generalInfoLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||
generalInfoLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||
//generalInfoLayout->setRowWrapPolicy(QFormLayout::WrapAllRows);
|
||||
generalInfoLayout->addRow(tr("Title:"), title = new YACReaderFieldEdit());
|
||||
|
||||
@ -236,7 +236,7 @@ void PropertiesDialog::createPublishingBox()
|
||||
|
||||
QFormLayout *publishingLayout = new QFormLayout;
|
||||
|
||||
publishingLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||
publishingLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||
|
||||
QHBoxLayout * date = new QHBoxLayout;
|
||||
date->addWidget(new QLabel(tr("Day:")));
|
||||
@ -268,7 +268,7 @@ void PropertiesDialog::createPlotBox()
|
||||
plotBox = new QWidget;
|
||||
|
||||
QFormLayout *plotLayout = new QFormLayout;
|
||||
plotLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||
plotLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||
|
||||
plotLayout->setRowWrapPolicy(QFormLayout::WrapAllRows);
|
||||
plotLayout->addRow(tr("Synopsis:"), synopsis = new YACReaderFieldPlainTextEdit());
|
||||
@ -281,83 +281,83 @@ void PropertiesDialog::createPlotBox()
|
||||
|
||||
void PropertiesDialog::createButtonBox()
|
||||
{
|
||||
buttonBox = new QDialogButtonBox;
|
||||
buttonBox = new QDialogButtonBox;
|
||||
|
||||
closeButton = buttonBox->addButton(QDialogButtonBox::Close);
|
||||
closeButton = buttonBox->addButton(QDialogButtonBox::Close);
|
||||
saveButton = buttonBox->addButton(QDialogButtonBox::Save);
|
||||
//rotateWidgetsButton = buttonBox->addButton(tr("Rotate &Widgets"),QDialogButtonBox::ActionRole);
|
||||
//rotateWidgetsButton = buttonBox->addButton(tr("Rotate &Widgets"),QDialogButtonBox::ActionRole);
|
||||
|
||||
//connect(rotateWidgetsButton, SIGNAL(clicked()), this, SLOT(rotateWidgets()));
|
||||
connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
|
||||
connect(saveButton, SIGNAL(clicked()), this, SLOT(save()));
|
||||
//connect(rotateWidgetsButton, SIGNAL(clicked()), this, SLOT(rotateWidgets()));
|
||||
connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
|
||||
connect(saveButton, SIGNAL(clicked()), this, SLOT(save()));
|
||||
}
|
||||
|
||||
QImage blurred(const QImage& image, const QRect& rect, int radius, bool alphaOnly = false)
|
||||
{
|
||||
int tab[] = { 14, 10, 8, 6, 5, 5, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2 };
|
||||
int alpha = (radius < 1) ? 16 : (radius > 17) ? 1 : tab[radius-1];
|
||||
int tab[] = { 14, 10, 8, 6, 5, 5, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2 };
|
||||
int alpha = (radius < 1) ? 16 : (radius > 17) ? 1 : tab[radius-1];
|
||||
|
||||
QImage result = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
|
||||
int r1 = rect.top();
|
||||
int r2 = rect.bottom();
|
||||
int c1 = rect.left();
|
||||
int c2 = rect.right();
|
||||
QImage result = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
|
||||
int r1 = rect.top();
|
||||
int r2 = rect.bottom();
|
||||
int c1 = rect.left();
|
||||
int c2 = rect.right();
|
||||
|
||||
int bpl = result.bytesPerLine();
|
||||
int rgba[4];
|
||||
unsigned char* p;
|
||||
int bpl = result.bytesPerLine();
|
||||
int rgba[4];
|
||||
unsigned char* p;
|
||||
|
||||
int i1 = 0;
|
||||
int i2 = 3;
|
||||
int i1 = 0;
|
||||
int i2 = 3;
|
||||
|
||||
if (alphaOnly)
|
||||
i1 = i2 = (QSysInfo::ByteOrder == QSysInfo::BigEndian ? 0 : 3);
|
||||
if (alphaOnly)
|
||||
i1 = i2 = (QSysInfo::ByteOrder == QSysInfo::BigEndian ? 0 : 3);
|
||||
|
||||
for (int col = c1; col <= c2; col++) {
|
||||
p = result.scanLine(r1) + col * 4;
|
||||
for (int i = i1; i <= i2; i++)
|
||||
rgba[i] = p[i] << 4;
|
||||
for (int col = c1; col <= c2; col++) {
|
||||
p = result.scanLine(r1) + col * 4;
|
||||
for (int i = i1; i <= i2; i++)
|
||||
rgba[i] = p[i] << 4;
|
||||
|
||||
p += bpl;
|
||||
for (int j = r1; j < r2; j++, p += bpl)
|
||||
for (int i = i1; i <= i2; i++)
|
||||
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
|
||||
}
|
||||
p += bpl;
|
||||
for (int j = r1; j < r2; j++, p += bpl)
|
||||
for (int i = i1; i <= i2; i++)
|
||||
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
|
||||
}
|
||||
|
||||
for (int row = r1; row <= r2; row++) {
|
||||
p = result.scanLine(row) + c1 * 4;
|
||||
for (int i = i1; i <= i2; i++)
|
||||
rgba[i] = p[i] << 4;
|
||||
for (int row = r1; row <= r2; row++) {
|
||||
p = result.scanLine(row) + c1 * 4;
|
||||
for (int i = i1; i <= i2; i++)
|
||||
rgba[i] = p[i] << 4;
|
||||
|
||||
p += 4;
|
||||
for (int j = c1; j < c2; j++, p += 4)
|
||||
for (int i = i1; i <= i2; i++)
|
||||
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
|
||||
}
|
||||
p += 4;
|
||||
for (int j = c1; j < c2; j++, p += 4)
|
||||
for (int i = i1; i <= i2; i++)
|
||||
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
|
||||
}
|
||||
|
||||
for (int col = c1; col <= c2; col++) {
|
||||
p = result.scanLine(r2) + col * 4;
|
||||
for (int i = i1; i <= i2; i++)
|
||||
rgba[i] = p[i] << 4;
|
||||
for (int col = c1; col <= c2; col++) {
|
||||
p = result.scanLine(r2) + col * 4;
|
||||
for (int i = i1; i <= i2; i++)
|
||||
rgba[i] = p[i] << 4;
|
||||
|
||||
p -= bpl;
|
||||
for (int j = r1; j < r2; j++, p -= bpl)
|
||||
for (int i = i1; i <= i2; i++)
|
||||
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
|
||||
}
|
||||
p -= bpl;
|
||||
for (int j = r1; j < r2; j++, p -= bpl)
|
||||
for (int i = i1; i <= i2; i++)
|
||||
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
|
||||
}
|
||||
|
||||
for (int row = r1; row <= r2; row++) {
|
||||
p = result.scanLine(row) + c2 * 4;
|
||||
for (int i = i1; i <= i2; i++)
|
||||
rgba[i] = p[i] << 4;
|
||||
for (int row = r1; row <= r2; row++) {
|
||||
p = result.scanLine(row) + c2 * 4;
|
||||
for (int i = i1; i <= i2; i++)
|
||||
rgba[i] = p[i] << 4;
|
||||
|
||||
p -= 4;
|
||||
for (int j = c1; j < c2; j++, p -= 4)
|
||||
for (int i = i1; i <= i2; i++)
|
||||
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
|
||||
}
|
||||
p -= 4;
|
||||
for (int j = c1; j < c2; j++, p -= 4)
|
||||
for (int i = i1; i <= i2; i++)
|
||||
p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
|
||||
}
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
void PropertiesDialog::setComics(QList<ComicDB> comics)
|
||||
|
@ -6,15 +6,15 @@
|
||||
#include "httprequesthandler.h"
|
||||
|
||||
class ErrorController : public HttpRequestHandler {
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(ErrorController);
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(ErrorController);
|
||||
public:
|
||||
|
||||
/** Constructor */
|
||||
ErrorController(int errorCode);
|
||||
/** Constructor */
|
||||
ErrorController(int errorCode);
|
||||
|
||||
/** Generates the response */
|
||||
void service(HttpRequest& request, HttpResponse& response);
|
||||
/** Generates the response */
|
||||
void service(HttpRequest& request, HttpResponse& response);
|
||||
private:
|
||||
int error;
|
||||
};
|
||||
|
@ -16,15 +16,15 @@
|
||||
<p>
|
||||
Example code for proper response generation:
|
||||
<code><pre>
|
||||
response.setStatus(200,"OK"); // optional, because this is the default
|
||||
response.writeBody("Hello");
|
||||
response.writeBody("World!",true);
|
||||
response.setStatus(200,"OK"); // optional, because this is the default
|
||||
response.writeBody("Hello");
|
||||
response.writeBody("World!",true);
|
||||
</pre></code>
|
||||
<p>
|
||||
Example how to return an error:
|
||||
<code><pre>
|
||||
response.setStatus(500,"server error");
|
||||
response.write("The request cannot be processed because the servers is broken",true);
|
||||
response.setStatus(500,"server error");
|
||||
response.write("The request cannot be processed because the servers is broken",true);
|
||||
</pre></code>
|
||||
<p>
|
||||
For performance reason, writing a single or few large packets is better than writing
|
||||
@ -34,101 +34,101 @@
|
||||
*/
|
||||
|
||||
class HttpResponse {
|
||||
Q_DISABLE_COPY(HttpResponse)
|
||||
Q_DISABLE_COPY(HttpResponse)
|
||||
public:
|
||||
|
||||
/**
|
||||
Constructor.
|
||||
@param socket used to write the response
|
||||
*/
|
||||
HttpResponse(QTcpSocket* socket);
|
||||
/**
|
||||
Constructor.
|
||||
@param socket used to write the response
|
||||
*/
|
||||
HttpResponse(QTcpSocket* socket);
|
||||
|
||||
/**
|
||||
Set a HTTP response header
|
||||
@param name name of the header
|
||||
@param value value of the header
|
||||
*/
|
||||
void setHeader(QByteArray name, QByteArray value);
|
||||
/**
|
||||
Set a HTTP response header
|
||||
@param name name of the header
|
||||
@param value value of the header
|
||||
*/
|
||||
void setHeader(QByteArray name, QByteArray value);
|
||||
|
||||
/**
|
||||
Set a HTTP response header
|
||||
@param name name of the header
|
||||
@param value value of the header
|
||||
*/
|
||||
void setHeader(QByteArray name, int value);
|
||||
/**
|
||||
Set a HTTP response header
|
||||
@param name name of the header
|
||||
@param value value of the header
|
||||
*/
|
||||
void setHeader(QByteArray name, int value);
|
||||
|
||||
/** Get the map of HTTP response headers */
|
||||
QMap<QByteArray,QByteArray>& getHeaders();
|
||||
/** Get the map of HTTP response headers */
|
||||
QMap<QByteArray,QByteArray>& getHeaders();
|
||||
|
||||
/** Get the map of cookies */
|
||||
QMap<QByteArray,HttpCookie>& getCookies();
|
||||
/** Get the map of cookies */
|
||||
QMap<QByteArray,HttpCookie>& getCookies();
|
||||
|
||||
/**
|
||||
Set status code and description. The default is 200,OK.
|
||||
*/
|
||||
void setStatus(int statusCode, QByteArray description=QByteArray());
|
||||
/**
|
||||
Set status code and description. The default is 200,OK.
|
||||
*/
|
||||
void setStatus(int statusCode, QByteArray description=QByteArray());
|
||||
|
||||
/**
|
||||
Write body data to the socket.
|
||||
<p>
|
||||
The HTTP status line and headers are sent automatically before the first
|
||||
byte of the body gets sent.
|
||||
<p>
|
||||
If the response contains only a single chunk (indicated by lastPart=true),
|
||||
the response is transferred in traditional mode with a Content-Length
|
||||
header, which is automatically added if not already set before.
|
||||
<p>
|
||||
Otherwise, each part is transferred in chunked mode.
|
||||
@param data Data bytes of the body
|
||||
@param lastPart Indicator, if this is the last part of the response.
|
||||
*/
|
||||
void write(QByteArray data, bool lastPart=false);
|
||||
/**
|
||||
Write body data to the socket.
|
||||
<p>
|
||||
The HTTP status line and headers are sent automatically before the first
|
||||
byte of the body gets sent.
|
||||
<p>
|
||||
If the response contains only a single chunk (indicated by lastPart=true),
|
||||
the response is transferred in traditional mode with a Content-Length
|
||||
header, which is automatically added if not already set before.
|
||||
<p>
|
||||
Otherwise, each part is transferred in chunked mode.
|
||||
@param data Data bytes of the body
|
||||
@param lastPart Indicator, if this is the last part of the response.
|
||||
*/
|
||||
void write(QByteArray data, bool lastPart=false);
|
||||
void writeText(QString text, bool lastPart=false);
|
||||
|
||||
/**
|
||||
Indicates wheter the body has been sent completely. Used by the connection
|
||||
handler to terminate the body automatically when necessary.
|
||||
*/
|
||||
bool hasSentLastPart() const;
|
||||
/**
|
||||
Indicates wheter the body has been sent completely. Used by the connection
|
||||
handler to terminate the body automatically when necessary.
|
||||
*/
|
||||
bool hasSentLastPart() const;
|
||||
|
||||
/**
|
||||
Set a cookie. Cookies are sent together with the headers when the first
|
||||
call to write() occurs.
|
||||
*/
|
||||
void setCookie(const HttpCookie& cookie);
|
||||
/**
|
||||
Set a cookie. Cookies are sent together with the headers when the first
|
||||
call to write() occurs.
|
||||
*/
|
||||
void setCookie(const HttpCookie& cookie);
|
||||
|
||||
private:
|
||||
|
||||
/** Request headers */
|
||||
QMap<QByteArray,QByteArray> headers;
|
||||
/** Request headers */
|
||||
QMap<QByteArray,QByteArray> headers;
|
||||
|
||||
/** Socket for writing output */
|
||||
QTcpSocket* socket;
|
||||
/** Socket for writing output */
|
||||
QTcpSocket* socket;
|
||||
|
||||
/** HTTP status code*/
|
||||
int statusCode;
|
||||
/** HTTP status code*/
|
||||
int statusCode;
|
||||
|
||||
/** HTTP status code description */
|
||||
QByteArray statusText;
|
||||
/** HTTP status code description */
|
||||
QByteArray statusText;
|
||||
|
||||
/** Indicator whether headers have been sent */
|
||||
bool sentHeaders;
|
||||
/** Indicator whether headers have been sent */
|
||||
bool sentHeaders;
|
||||
|
||||
/** Indicator whether the body has been sent completely */
|
||||
bool sentLastPart;
|
||||
/** Indicator whether the body has been sent completely */
|
||||
bool sentLastPart;
|
||||
|
||||
/** Cookies */
|
||||
QMap<QByteArray,HttpCookie> cookies;
|
||||
/** Cookies */
|
||||
QMap<QByteArray,HttpCookie> cookies;
|
||||
|
||||
/** Write raw data to the socket. This method blocks until all bytes have been passed to the TCP buffer */
|
||||
bool writeToSocket(QByteArray data);
|
||||
/** Write raw data to the socket. This method blocks until all bytes have been passed to the TCP buffer */
|
||||
bool writeToSocket(QByteArray data);
|
||||
|
||||
/**
|
||||
Write the response HTTP status and headers to the socket.
|
||||
Calling this method is optional, because writeBody() calls
|
||||
it automatically when required.
|
||||
*/
|
||||
void writeHeaders();
|
||||
/**
|
||||
Write the response HTTP status and headers to the socket.
|
||||
Calling this method is optional, because writeBody() calls
|
||||
it automatically when required.
|
||||
*/
|
||||
void writeHeaders();
|
||||
|
||||
};
|
||||
|
||||
|
@ -25,72 +25,72 @@ class HttpSession {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
Constructor.
|
||||
@param canStore The session can store data, if this parameter is true.
|
||||
Otherwise all calls to set() and remove() do not have any effect.
|
||||
*/
|
||||
HttpSession(bool canStore=false);
|
||||
/**
|
||||
Constructor.
|
||||
@param canStore The session can store data, if this parameter is true.
|
||||
Otherwise all calls to set() and remove() do not have any effect.
|
||||
*/
|
||||
HttpSession(bool canStore=false);
|
||||
|
||||
/**
|
||||
Copy constructor. Creates another HttpSession object that shares the
|
||||
data of the other object.
|
||||
*/
|
||||
HttpSession(const HttpSession& other);
|
||||
/**
|
||||
Copy constructor. Creates another HttpSession object that shares the
|
||||
data of the other object.
|
||||
*/
|
||||
HttpSession(const HttpSession& other);
|
||||
|
||||
/**
|
||||
Copy operator. Detaches from the current shared data and attaches to
|
||||
the data of the other object.
|
||||
*/
|
||||
HttpSession& operator= (const HttpSession& other);
|
||||
/**
|
||||
Copy operator. Detaches from the current shared data and attaches to
|
||||
the data of the other object.
|
||||
*/
|
||||
HttpSession& operator= (const HttpSession& other);
|
||||
|
||||
|
||||
/**
|
||||
Destructor. Detaches from the shared data.
|
||||
*/
|
||||
virtual ~HttpSession();
|
||||
/**
|
||||
Destructor. Detaches from the shared data.
|
||||
*/
|
||||
virtual ~HttpSession();
|
||||
|
||||
/** Get the unique ID of this session. This method is thread safe. */
|
||||
QByteArray getId() const;
|
||||
/** Get the unique ID of this session. This method is thread safe. */
|
||||
QByteArray getId() const;
|
||||
|
||||
/**
|
||||
Null sessions cannot store data. All calls to set() and remove()
|
||||
do not have any effect.This method is thread safe.
|
||||
*/
|
||||
bool isNull() const;
|
||||
/**
|
||||
Null sessions cannot store data. All calls to set() and remove()
|
||||
do not have any effect.This method is thread safe.
|
||||
*/
|
||||
bool isNull() const;
|
||||
|
||||
/** Set a value. This method is thread safe. */
|
||||
void set(const QByteArray& key, const QVariant& value);
|
||||
/** Set a value. This method is thread safe. */
|
||||
void set(const QByteArray& key, const QVariant& value);
|
||||
|
||||
/** Remove a value. This method is thread safe. */
|
||||
void remove(const QByteArray& key);
|
||||
/** Remove a value. This method is thread safe. */
|
||||
void remove(const QByteArray& key);
|
||||
|
||||
/** Get a value. This method is thread safe. */
|
||||
QVariant get(const QByteArray& key) const;
|
||||
/** Get a value. This method is thread safe. */
|
||||
QVariant get(const QByteArray& key) const;
|
||||
|
||||
/** Check if a key exists. This method is thread safe. */
|
||||
bool contains(const QByteArray& key) const;
|
||||
/** Check if a key exists. This method is thread safe. */
|
||||
bool contains(const QByteArray& key) const;
|
||||
|
||||
/**
|
||||
Get a copy of all data stored in this session.
|
||||
Changes to the session do not affect the copy and vice versa.
|
||||
This method is thread safe.
|
||||
*/
|
||||
QMap<QByteArray,QVariant> getAll() const;
|
||||
/**
|
||||
Get a copy of all data stored in this session.
|
||||
Changes to the session do not affect the copy and vice versa.
|
||||
This method is thread safe.
|
||||
*/
|
||||
QMap<QByteArray,QVariant> getAll() const;
|
||||
|
||||
/**
|
||||
Get the timestamp of last access. That is the time when the last
|
||||
HttpSessionStore::getSession() has been called.
|
||||
This method is thread safe.
|
||||
*/
|
||||
qint64 getLastAccess() const;
|
||||
/**
|
||||
Get the timestamp of last access. That is the time when the last
|
||||
HttpSessionStore::getSession() has been called.
|
||||
This method is thread safe.
|
||||
*/
|
||||
qint64 getLastAccess() const;
|
||||
|
||||
/**
|
||||
Set the timestamp of last access, to renew the timeout period.
|
||||
Called by HttpSessionStore::getSession().
|
||||
This method is thread safe.
|
||||
*/
|
||||
void setLastAccess();
|
||||
/**
|
||||
Set the timestamp of last access, to renew the timeout period.
|
||||
Called by HttpSessionStore::getSession().
|
||||
This method is thread safe.
|
||||
*/
|
||||
void setLastAccess();
|
||||
|
||||
//A<>ADIDO
|
||||
//sets
|
||||
@ -157,8 +157,8 @@ private:
|
||||
|
||||
};
|
||||
|
||||
/** Pointer to the shared data. */
|
||||
HttpSessionData* dataPtr;
|
||||
/** Pointer to the shared data. */
|
||||
HttpSessionData* dataPtr;
|
||||
|
||||
};
|
||||
|
||||
|
@ -40,47 +40,47 @@
|
||||
*/
|
||||
|
||||
class StaticFileController : public HttpRequestHandler {
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(StaticFileController);
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(StaticFileController);
|
||||
public:
|
||||
|
||||
/** Constructor */
|
||||
StaticFileController(QSettings* settings, QObject* parent = 0);
|
||||
/** Constructor */
|
||||
StaticFileController(QSettings* settings, QObject* parent = 0);
|
||||
|
||||
/** Generates the response */
|
||||
void service(HttpRequest& request, HttpResponse& response);
|
||||
/** Generates the response */
|
||||
void service(HttpRequest& request, HttpResponse& response);
|
||||
|
||||
private:
|
||||
|
||||
/** Encoding of text files */
|
||||
QString encoding;
|
||||
/** Encoding of text files */
|
||||
QString encoding;
|
||||
|
||||
/** Root directory of documents */
|
||||
QString docroot;
|
||||
/** Root directory of documents */
|
||||
QString docroot;
|
||||
|
||||
/** Maximum age of files in the browser cache */
|
||||
int maxAge;
|
||||
/** Maximum age of files in the browser cache */
|
||||
int maxAge;
|
||||
|
||||
struct CacheEntry {
|
||||
QByteArray document;
|
||||
qint64 created;
|
||||
};
|
||||
struct CacheEntry {
|
||||
QByteArray document;
|
||||
qint64 created;
|
||||
};
|
||||
|
||||
/** Timeout for each cached file */
|
||||
int cacheTimeout;
|
||||
/** Timeout for each cached file */
|
||||
int cacheTimeout;
|
||||
|
||||
|
||||
/** Maximum size of files in cache, larger files are not cached */
|
||||
int maxCachedFileSize;
|
||||
/** Maximum size of files in cache, larger files are not cached */
|
||||
int maxCachedFileSize;
|
||||
|
||||
/** Cache storage */
|
||||
QCache<QString,CacheEntry> cache;
|
||||
/** Cache storage */
|
||||
QCache<QString,CacheEntry> cache;
|
||||
|
||||
/** Used to synchronize cache access for threads */
|
||||
QMutex mutex;
|
||||
/** Used to synchronize cache access for threads */
|
||||
QMutex mutex;
|
||||
|
||||
/** Set a content-type header in the response depending on the ending of the filename */
|
||||
void setContentType(QString file, HttpResponse& response) const;
|
||||
/** Set a content-type header in the response depending on the ending of the filename */
|
||||
void setContentType(QString file, HttpResponse& response) const;
|
||||
|
||||
QString getLocalizedFileName(QString fileName, QString locales, QString path) const;
|
||||
QString getDeviceAwareFileName(QString fileName, QString device, QString locales, QString path) const;
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "db_helper.h"
|
||||
|
||||
RequestMapper::RequestMapper(QObject* parent)
|
||||
:HttpRequestHandler(parent) {}
|
||||
:HttpRequestHandler(parent) {}
|
||||
|
||||
void RequestMapper::service(HttpRequest& request, HttpResponse& response) {
|
||||
QByteArray path=request.getPath();
|
||||
|
@ -22,48 +22,48 @@
|
||||
#define DESCRIPTION "Comic reader and organizer"
|
||||
|
||||
void Startup::start() {
|
||||
// Initialize the core application
|
||||
QCoreApplication* app = QApplication::instance();
|
||||
app->setApplicationName(APPNAME);
|
||||
app->setOrganizationName(ORGANISATION);
|
||||
QString configFileName=Static::getConfigDir()+"/"+QCoreApplication::applicationName()+".ini";
|
||||
// Initialize the core application
|
||||
QCoreApplication* app = QApplication::instance();
|
||||
app->setApplicationName(APPNAME);
|
||||
app->setOrganizationName(ORGANISATION);
|
||||
QString configFileName=Static::getConfigDir()+"/"+QCoreApplication::applicationName()+".ini";
|
||||
|
||||
// Configure logging into files
|
||||
QSettings* mainLogSettings=new QSettings(configFileName,QSettings::IniFormat,app);
|
||||
mainLogSettings->beginGroup("mainLogFile");
|
||||
QSettings* debugLogSettings=new QSettings(configFileName,QSettings::IniFormat,app);
|
||||
debugLogSettings->beginGroup("debugLogFile");
|
||||
Logger* logger=new DualFileLogger(mainLogSettings,debugLogSettings,10000,app);
|
||||
logger->installMsgHandler();
|
||||
// Configure logging into files
|
||||
QSettings* mainLogSettings=new QSettings(configFileName,QSettings::IniFormat,app);
|
||||
mainLogSettings->beginGroup("mainLogFile");
|
||||
QSettings* debugLogSettings=new QSettings(configFileName,QSettings::IniFormat,app);
|
||||
debugLogSettings->beginGroup("debugLogFile");
|
||||
Logger* logger=new DualFileLogger(mainLogSettings,debugLogSettings,10000,app);
|
||||
logger->installMsgHandler();
|
||||
|
||||
// Configure template loader and cache
|
||||
QSettings* templateSettings=new QSettings(configFileName,QSettings::IniFormat,app);
|
||||
templateSettings->beginGroup("templates");
|
||||
Static::templateLoader=new TemplateCache(templateSettings,app);
|
||||
// Configure template loader and cache
|
||||
QSettings* templateSettings=new QSettings(configFileName,QSettings::IniFormat,app);
|
||||
templateSettings->beginGroup("templates");
|
||||
Static::templateLoader=new TemplateCache(templateSettings,app);
|
||||
|
||||
// Configure session store
|
||||
QSettings* sessionSettings=new QSettings(configFileName,QSettings::IniFormat,app);
|
||||
sessionSettings->beginGroup("sessions");
|
||||
Static::sessionStore=new HttpSessionStore(sessionSettings,app);
|
||||
// Configure session store
|
||||
QSettings* sessionSettings=new QSettings(configFileName,QSettings::IniFormat,app);
|
||||
sessionSettings->beginGroup("sessions");
|
||||
Static::sessionStore=new HttpSessionStore(sessionSettings,app);
|
||||
|
||||
// Configure static file controller
|
||||
QSettings* fileSettings=new QSettings(configFileName,QSettings::IniFormat,app);
|
||||
fileSettings->beginGroup("docroot");
|
||||
Static::staticFileController=new StaticFileController(fileSettings,app);
|
||||
// Configure static file controller
|
||||
QSettings* fileSettings=new QSettings(configFileName,QSettings::IniFormat,app);
|
||||
fileSettings->beginGroup("docroot");
|
||||
Static::staticFileController=new StaticFileController(fileSettings,app);
|
||||
|
||||
// Configure and start the TCP listener
|
||||
qDebug("ServiceHelper: Starting service");
|
||||
QSettings* listenerSettings=new QSettings(configFileName,QSettings::IniFormat,app);
|
||||
listenerSettings->beginGroup("listener");
|
||||
listener = new HttpListener(listenerSettings,new RequestMapper(app),app);
|
||||
// Configure and start the TCP listener
|
||||
qDebug("ServiceHelper: Starting service");
|
||||
QSettings* listenerSettings=new QSettings(configFileName,QSettings::IniFormat,app);
|
||||
listenerSettings->beginGroup("listener");
|
||||
listener = new HttpListener(listenerSettings,new RequestMapper(app),app);
|
||||
|
||||
qDebug("ServiceHelper: Service has started");
|
||||
qDebug("ServiceHelper: Service has started");
|
||||
}
|
||||
|
||||
|
||||
void Startup::stop() {
|
||||
qDebug("ServiceHelper: Service has been stopped");
|
||||
// QCoreApplication destroys all objects that have been created in start().
|
||||
qDebug("ServiceHelper: Service has been stopped");
|
||||
// QCoreApplication destroys all objects that have been created in start().
|
||||
delete listener;
|
||||
}
|
||||
|
||||
|
@ -18,12 +18,12 @@ private:
|
||||
HttpListener * listener;
|
||||
public:
|
||||
|
||||
/** Constructor */
|
||||
Startup();
|
||||
/** Constructor */
|
||||
Startup();
|
||||
/** Start the server */
|
||||
void start();
|
||||
void start();
|
||||
/** Stop the server */
|
||||
void stop();
|
||||
void stop();
|
||||
|
||||
QString getPort();
|
||||
protected:
|
||||
|
@ -23,32 +23,32 @@
|
||||
QList<QString> addresses()
|
||||
{
|
||||
struct ifaddrs * ifAddrStruct=NULL;
|
||||
struct ifaddrs * ifa=NULL;
|
||||
void * tmpAddrPtr=NULL;
|
||||
struct ifaddrs * ifa=NULL;
|
||||
void * tmpAddrPtr=NULL;
|
||||
|
||||
QList<QString> localAddreses;
|
||||
|
||||
getifaddrs(&ifAddrStruct);
|
||||
getifaddrs(&ifAddrStruct);
|
||||
|
||||
for (ifa = ifAddrStruct; ifa != NULL; ifa = ifa->ifa_next) {
|
||||
if (ifa ->ifa_addr->sa_family==AF_INET) { // check it is IP4
|
||||
// is a valid IP4 Address
|
||||
tmpAddrPtr=&((struct sockaddr_in *)ifa->ifa_addr)->sin_addr;
|
||||
char addressBuffer[INET_ADDRSTRLEN];
|
||||
inet_ntop(AF_INET, tmpAddrPtr, addressBuffer, INET_ADDRSTRLEN);
|
||||
QString add(addressBuffer);
|
||||
for (ifa = ifAddrStruct; ifa != NULL; ifa = ifa->ifa_next) {
|
||||
if (ifa ->ifa_addr->sa_family==AF_INET) { // check it is IP4
|
||||
// is a valid IP4 Address
|
||||
tmpAddrPtr=&((struct sockaddr_in *)ifa->ifa_addr)->sin_addr;
|
||||
char addressBuffer[INET_ADDRSTRLEN];
|
||||
inet_ntop(AF_INET, tmpAddrPtr, addressBuffer, INET_ADDRSTRLEN);
|
||||
QString add(addressBuffer);
|
||||
localAddreses.push_back(QString(addressBuffer));
|
||||
//printf("%s IP Address %s\n", ifa->ifa_name, addressBuffer);
|
||||
} else if (ifa->ifa_addr->sa_family==AF_INET6) { // check it is IP6
|
||||
// is a valid IP6 Address
|
||||
tmpAddrPtr=&((struct sockaddr_in6 *)ifa->ifa_addr)->sin6_addr;
|
||||
char addressBuffer[INET6_ADDRSTRLEN];
|
||||
inet_ntop(AF_INET6, tmpAddrPtr, addressBuffer, INET6_ADDRSTRLEN);
|
||||
//printf("%s IP Address %s\n", ifa->ifa_name, addressBuffer);
|
||||
}
|
||||
}
|
||||
if (ifAddrStruct!=NULL) freeifaddrs(ifAddrStruct);
|
||||
return localAddreses;
|
||||
//printf("%s IP Address %s\n", ifa->ifa_name, addressBuffer);
|
||||
} else if (ifa->ifa_addr->sa_family==AF_INET6) { // check it is IP6
|
||||
// is a valid IP6 Address
|
||||
tmpAddrPtr=&((struct sockaddr_in6 *)ifa->ifa_addr)->sin6_addr;
|
||||
char addressBuffer[INET6_ADDRSTRLEN];
|
||||
inet_ntop(AF_INET6, tmpAddrPtr, addressBuffer, INET6_ADDRSTRLEN);
|
||||
//printf("%s IP Address %s\n", ifa->ifa_name, addressBuffer);
|
||||
}
|
||||
}
|
||||
if (ifAddrStruct!=NULL) freeifaddrs(ifAddrStruct);
|
||||
return localAddreses;
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -89,7 +89,7 @@ ServerConfigDialog::ServerConfigDialog(QWidget * parent)
|
||||
|
||||
//FORM---------------------------------------------------------------------
|
||||
QWidget * form = new QWidget(this);
|
||||
QFormLayout * formLayout = new QFormLayout;
|
||||
QFormLayout * formLayout = new QFormLayout;
|
||||
|
||||
/*QLabel * ipLabel = new QLabel(tr("IP address"),this);
|
||||
ipLabel->move(452,75);
|
||||
@ -101,22 +101,22 @@ ServerConfigDialog::ServerConfigDialog(QWidget * parent)
|
||||
|
||||
ip = new QComboBox(this);
|
||||
connect(ip,SIGNAL(activated(const QString &)),this,SLOT(regenerateQR(const QString &)));
|
||||
//ip->move(520,71);
|
||||
//ip->move(520,71);
|
||||
#ifndef Q_OS_WIN32
|
||||
ip->setStyleSheet("QComboBox{font-size:10px;}");
|
||||
ip->setStyleSheet("QComboBox{font-size:10px;}");
|
||||
#endif
|
||||
ip->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
ip->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
#ifdef Q_OS_WIN32
|
||||
ip->setMinimumWidth(120);
|
||||
ip->setMinimumWidth(120);
|
||||
#else
|
||||
ip->setFixedSize(120,ip->height());
|
||||
ip->setFixedSize(120,ip->height());
|
||||
#endif
|
||||
|
||||
port = new QLineEdit("8080",this);
|
||||
port->setReadOnly(false);
|
||||
port->setMaximumWidth(50);
|
||||
port->setMaximumWidth(50);
|
||||
#ifndef Q_OS_WIN32
|
||||
port->setStyleSheet("QLineEdit{font-size:10px;}");
|
||||
port->setStyleSheet("QLineEdit{font-size:10px;}");
|
||||
#endif
|
||||
//port->move(520,110);
|
||||
QValidator *validator = new QIntValidator(1024, 65535, this);
|
||||
@ -125,7 +125,7 @@ ServerConfigDialog::ServerConfigDialog(QWidget * parent)
|
||||
//accept->move(514,149);
|
||||
connect(accept,SIGNAL(pressed()),this,SLOT(updatePort()));
|
||||
|
||||
formLayout->addRow(tr("IP address"),ip);
|
||||
formLayout->addRow(tr("IP address"),ip);
|
||||
formLayout->addRow(tr("Port"),port);
|
||||
formLayout->addRow("",accept);
|
||||
|
||||
@ -133,7 +133,7 @@ ServerConfigDialog::ServerConfigDialog(QWidget * parent)
|
||||
#ifdef Q_OS_WIN32
|
||||
form->move(444,70);
|
||||
#else
|
||||
form->move(435,70);
|
||||
form->move(435,70);
|
||||
#endif
|
||||
//END FORM-----------------------------------------------------------------
|
||||
|
||||
|
@ -9,11 +9,11 @@
|
||||
#include <QAction>
|
||||
|
||||
YACReaderMainToolBar::YACReaderMainToolBar(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
QWidget(parent)
|
||||
{
|
||||
mainLayout = new QHBoxLayout;
|
||||
mainLayout = new QHBoxLayout;
|
||||
|
||||
currentFolder = new QLabel(this);
|
||||
currentFolder = new QLabel(this);
|
||||
currentFolder->setAlignment(Qt::AlignCenter);
|
||||
currentFolder->setStyleSheet(" QLabel {color:#404040; font-size:22px; font-weight:bold;}");
|
||||
|
||||
@ -23,92 +23,92 @@ YACReaderMainToolBar::YACReaderMainToolBar(QWidget *parent) :
|
||||
|
||||
QString qToolButtonStyleSheet = "QToolButton {border:none;}";
|
||||
|
||||
backButton = new QToolButton();
|
||||
backButton->setStyleSheet(qToolButtonStyleSheet);
|
||||
backButton = new QToolButton();
|
||||
backButton->setStyleSheet(qToolButtonStyleSheet);
|
||||
|
||||
|
||||
forwardButton = new QToolButton();
|
||||
forwardButton->setStyleSheet(qToolButtonStyleSheet);
|
||||
forwardButton = new QToolButton();
|
||||
forwardButton->setStyleSheet(qToolButtonStyleSheet);
|
||||
forwardButton->setDisabled(true);
|
||||
|
||||
settingsButton = new QToolButton();
|
||||
settingsButton->setStyleSheet(qToolButtonStyleSheet);
|
||||
settingsButton = new QToolButton();
|
||||
settingsButton->setStyleSheet(qToolButtonStyleSheet);
|
||||
settingsButton->setIconSize(QSize(24,24));
|
||||
|
||||
serverButton = new QToolButton();
|
||||
serverButton->setStyleSheet(qToolButtonStyleSheet);
|
||||
serverButton->setIconSize(QSize(17,24));
|
||||
serverButton = new QToolButton();
|
||||
serverButton->setStyleSheet(qToolButtonStyleSheet);
|
||||
serverButton->setIconSize(QSize(17,24));
|
||||
|
||||
|
||||
helpButton = new QToolButton();
|
||||
helpButton->setStyleSheet(qToolButtonStyleSheet);
|
||||
helpButton->setIconSize(QSize(14,25));
|
||||
helpButton = new QToolButton();
|
||||
helpButton->setStyleSheet(qToolButtonStyleSheet);
|
||||
helpButton->setIconSize(QSize(14,25));
|
||||
|
||||
fullscreenButton = new QToolButton();
|
||||
fullscreenButton->setStyleSheet(qToolButtonStyleSheet);
|
||||
fullscreenButton->setIconSize(QSize(24,24));
|
||||
fullscreenButton = new QToolButton();
|
||||
fullscreenButton->setStyleSheet(qToolButtonStyleSheet);
|
||||
fullscreenButton->setIconSize(QSize(24,24));
|
||||
|
||||
|
||||
mainLayout->setMargin(0);
|
||||
mainLayout->setSpacing(0);
|
||||
mainLayout->setMargin(0);
|
||||
mainLayout->setSpacing(0);
|
||||
|
||||
mainLayout->addSpacing(12);
|
||||
mainLayout->addWidget(backButton);
|
||||
addDivider();
|
||||
mainLayout->addWidget(forwardButton);
|
||||
mainLayout->addSpacing(12);
|
||||
mainLayout->addWidget(backButton);
|
||||
addDivider();
|
||||
mainLayout->addWidget(forwardButton);
|
||||
|
||||
mainLayout->addSpacing(34);
|
||||
mainLayout->addWidget(settingsButton);
|
||||
addWideDivider();
|
||||
mainLayout->addWidget(serverButton);
|
||||
addWideDivider();
|
||||
mainLayout->addWidget(helpButton);
|
||||
mainLayout->addSpacing(34);
|
||||
mainLayout->addWidget(settingsButton);
|
||||
addWideDivider();
|
||||
mainLayout->addWidget(serverButton);
|
||||
addWideDivider();
|
||||
mainLayout->addWidget(helpButton);
|
||||
|
||||
mainLayout->addStretch();
|
||||
mainLayout->addStretch();
|
||||
|
||||
mainLayout->addWidget(fullscreenButton);
|
||||
mainLayout->addSpacing(10);
|
||||
mainLayout->addWidget(fullscreenButton);
|
||||
mainLayout->addSpacing(10);
|
||||
|
||||
setLayout(mainLayout);
|
||||
setLayout(mainLayout);
|
||||
|
||||
setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||
setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||
}
|
||||
|
||||
|
||||
QSize YACReaderMainToolBar::sizeHint() const
|
||||
{
|
||||
return QSize(200,40);
|
||||
return QSize(200,40);
|
||||
}
|
||||
|
||||
void YACReaderMainToolBar::paintEvent(QPaintEvent * event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
Q_UNUSED(event);
|
||||
|
||||
QPainter painter (this);
|
||||
painter.fillRect(0,0,width(),height(),QColor("#F0F0F0"));
|
||||
QPainter painter (this);
|
||||
painter.fillRect(0,0,width(),height(),QColor("#F0F0F0"));
|
||||
}
|
||||
|
||||
void YACReaderMainToolBar::resizeEvent(QResizeEvent * event)
|
||||
{
|
||||
currentFolder->move((event->size().width()-currentFolder->width())/2,(event->size().height()-currentFolder->height())/2);
|
||||
currentFolder->move((event->size().width()-currentFolder->width())/2,(event->size().height()-currentFolder->height())/2);
|
||||
}
|
||||
|
||||
void YACReaderMainToolBar::addDivider()
|
||||
{
|
||||
QPixmap img(":/images/main_toolbar/divider.png");
|
||||
QLabel * divider = new QLabel();
|
||||
divider->setPixmap(img);
|
||||
QPixmap img(":/images/main_toolbar/divider.png");
|
||||
QLabel * divider = new QLabel();
|
||||
divider->setPixmap(img);
|
||||
|
||||
mainLayout->addSpacing(5);
|
||||
mainLayout->addWidget(divider);
|
||||
mainLayout->addSpacing(5);
|
||||
mainLayout->addSpacing(5);
|
||||
mainLayout->addWidget(divider);
|
||||
mainLayout->addSpacing(5);
|
||||
}
|
||||
|
||||
void YACReaderMainToolBar::addWideDivider()
|
||||
{
|
||||
mainLayout->addSpacing(3);
|
||||
addDivider();
|
||||
mainLayout->addSpacing(3);
|
||||
mainLayout->addSpacing(3);
|
||||
addDivider();
|
||||
mainLayout->addSpacing(3);
|
||||
}
|
||||
|
||||
void YACReaderMainToolBar::setCurrentFolderName(const QString & name)
|
||||
|
@ -11,37 +11,37 @@ class QHBoxLayout;
|
||||
|
||||
class YACReaderMainToolBar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit YACReaderMainToolBar(QWidget *parent = 0);
|
||||
QSize sizeHint() const;
|
||||
explicit YACReaderMainToolBar(QWidget *parent = 0);
|
||||
QSize sizeHint() const;
|
||||
|
||||
QToolButton * backButton;
|
||||
QToolButton * forwardButton;
|
||||
QToolButton * settingsButton;
|
||||
QToolButton * serverButton;
|
||||
QToolButton * helpButton;
|
||||
QToolButton * fullscreenButton;
|
||||
QToolButton * forwardButton;
|
||||
QToolButton * settingsButton;
|
||||
QToolButton * serverButton;
|
||||
QToolButton * helpButton;
|
||||
QToolButton * fullscreenButton;
|
||||
|
||||
void setCurrentFolderName(const QString & name);
|
||||
signals:
|
||||
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
void paintEvent(QPaintEvent *);
|
||||
void resizeEvent(QResizeEvent *);
|
||||
void paintEvent(QPaintEvent *);
|
||||
void resizeEvent(QResizeEvent *);
|
||||
|
||||
|
||||
|
||||
QHBoxLayout * mainLayout;
|
||||
|
||||
QLabel * currentFolder;
|
||||
QLabel * currentFolder;
|
||||
|
||||
void addDivider();
|
||||
void addWideDivider();
|
||||
void addDivider();
|
||||
void addWideDivider();
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // YACREADER_MAIN_TOOLBAR_H
|
||||
|
Reference in New Issue
Block a user