2011-12-04 16:54:57 +01:00
|
|
|
/* ============================================================
|
|
|
|
* QupZilla - WebKit based browser
|
2012-01-01 15:29:55 +01:00
|
|
|
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
|
2011-12-04 16:54:57 +01:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
* ============================================================ */
|
2011-12-02 23:25:27 +01:00
|
|
|
#ifndef SPEEDDIAL_H
|
|
|
|
#define SPEEDDIAL_H
|
|
|
|
|
|
|
|
#include <QObject>
|
2011-12-09 21:56:01 +01:00
|
|
|
#include <QWeakPointer>
|
2012-02-29 18:33:50 +01:00
|
|
|
|
|
|
|
#include "qz_namespace.h"
|
|
|
|
|
|
|
|
class QUrl;
|
|
|
|
class QWebFrame;
|
|
|
|
class QPixmap;
|
2011-12-02 23:25:27 +01:00
|
|
|
|
|
|
|
class PageThumbnailer;
|
2012-02-29 18:33:50 +01:00
|
|
|
|
|
|
|
class QT_QUPZILLA_EXPORT SpeedDial : public QObject
|
2011-12-02 23:25:27 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2012-02-05 16:00:23 +01:00
|
|
|
struct Page {
|
|
|
|
QString title;
|
|
|
|
QString url;
|
|
|
|
|
|
|
|
bool operator==(const Page &other) {
|
|
|
|
return (this->title == other.title &&
|
|
|
|
this->url == other.url);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2011-12-02 23:25:27 +01:00
|
|
|
explicit SpeedDial(QObject* parent = 0);
|
|
|
|
|
|
|
|
void loadSettings();
|
|
|
|
void saveSettings();
|
|
|
|
|
2012-02-05 16:00:23 +01:00
|
|
|
Page pageForUrl(const QUrl &url);
|
|
|
|
QUrl urlForShortcut(int key);
|
|
|
|
|
2011-12-02 23:25:27 +01:00
|
|
|
void addWebFrame(QWebFrame* frame);
|
2011-12-24 13:31:32 +01:00
|
|
|
void addPage(const QUrl &url, const QString &title);
|
2012-02-05 16:00:23 +01:00
|
|
|
void removePage(const Page &page);
|
2011-12-24 13:31:32 +01:00
|
|
|
|
2012-01-18 20:10:04 +01:00
|
|
|
int pagesInRow();
|
2012-01-19 18:05:21 +01:00
|
|
|
int sdSize();
|
2012-07-29 20:58:23 +02:00
|
|
|
int sdCntr();
|
|
|
|
|
2012-01-09 16:23:03 +01:00
|
|
|
QString backgroundImage();
|
|
|
|
QString backgroundImageSize();
|
2011-12-02 23:25:27 +01:00
|
|
|
QString initialScript();
|
|
|
|
|
|
|
|
signals:
|
2012-02-05 16:00:23 +01:00
|
|
|
void pagesChanged();
|
2011-12-02 23:25:27 +01:00
|
|
|
|
|
|
|
public slots:
|
2012-04-12 15:24:57 +02:00
|
|
|
void changed(const QString &allPages);
|
|
|
|
void loadThumbnail(const QString &url, bool loadTitle = false);
|
|
|
|
void removeImageForUrl(const QString &url);
|
2011-12-02 23:25:27 +01:00
|
|
|
|
2012-04-12 15:24:57 +02:00
|
|
|
QString getOpenFileName();
|
|
|
|
QString urlFromUserInput(const QString &url);
|
|
|
|
void setBackgroundImage(const QString &image);
|
|
|
|
void setBackgroundImageSize(const QString &size);
|
|
|
|
void setPagesInRow(int count);
|
|
|
|
void setSdSize(int count);
|
2012-07-29 20:58:23 +02:00
|
|
|
void setSdCentered(int cntr);
|
2012-01-18 15:05:50 +01:00
|
|
|
|
2011-12-02 23:25:27 +01:00
|
|
|
private slots:
|
2012-04-12 15:24:57 +02:00
|
|
|
void thumbnailCreated(const QPixmap &pixmap);
|
2011-12-02 23:25:27 +01:00
|
|
|
|
|
|
|
private:
|
2012-07-14 16:19:33 +02:00
|
|
|
QString escapeTitle(QString string) const;
|
|
|
|
QString escapeUrl(QString url) const;
|
|
|
|
|
2012-02-05 16:00:23 +01:00
|
|
|
QList<QWebFrame*> cleanFrames();
|
|
|
|
QString generateAllPages();
|
|
|
|
|
2011-12-02 23:25:27 +01:00
|
|
|
QString m_initialScript;
|
|
|
|
QString m_thumbnailsDir;
|
2012-01-18 21:09:27 +01:00
|
|
|
QString m_backgroundImage;
|
|
|
|
QString m_backgroundImageSize;
|
2012-01-18 20:10:04 +01:00
|
|
|
int m_maxPagesInRow;
|
2012-01-19 18:05:21 +01:00
|
|
|
int m_sizeOfSpeedDials;
|
2012-07-29 20:58:23 +02:00
|
|
|
int m_sdcentered;
|
2011-12-02 23:25:27 +01:00
|
|
|
|
2011-12-09 21:56:01 +01:00
|
|
|
QList<QWeakPointer<QWebFrame> > m_webFrames;
|
2012-02-05 16:00:23 +01:00
|
|
|
QList<Page> m_webPages;
|
2011-12-02 23:25:27 +01:00
|
|
|
|
|
|
|
bool m_loaded;
|
|
|
|
bool m_regenerateScript;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SPEEDDIAL_H
|