2011-09-23 22:06:21 +02:00
|
|
|
/* ============================================================
|
|
|
|
* QupZilla - WebKit based browser
|
2014-01-11 16:11:42 +01:00
|
|
|
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
|
2011-09-23 22:06:21 +02: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-05-07 12:59:53 +02:00
|
|
|
#ifndef CLOSEDTABSMANAGER_H
|
|
|
|
#define CLOSEDTABSMANAGER_H
|
|
|
|
|
|
|
|
#include <QUrl>
|
2014-03-30 12:46:06 +02:00
|
|
|
#include <QIcon>
|
2014-02-10 19:23:08 +01:00
|
|
|
#include <QLinkedList>
|
2012-02-29 18:33:50 +01:00
|
|
|
|
2014-02-26 20:03:20 +01:00
|
|
|
#include "qzcommon.h"
|
2011-05-07 12:59:53 +02:00
|
|
|
|
2012-03-12 18:22:01 +01:00
|
|
|
class WebTab;
|
2012-02-29 18:33:50 +01:00
|
|
|
|
2014-02-19 22:12:32 +01:00
|
|
|
class QUPZILLA_EXPORT ClosedTabsManager
|
2011-05-07 12:59:53 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
struct Tab {
|
|
|
|
QUrl url;
|
|
|
|
QString title;
|
2014-03-30 12:46:06 +02:00
|
|
|
QIcon icon;
|
|
|
|
QByteArray history;
|
2011-12-11 17:03:18 +01:00
|
|
|
int position;
|
2011-05-07 12:59:53 +02:00
|
|
|
|
2011-12-12 21:14:43 +01:00
|
|
|
bool operator==(const Tab &a) const {
|
2011-12-11 17:03:18 +01:00
|
|
|
return (a.url == url &&
|
|
|
|
a.history == history &&
|
|
|
|
a.position == position);
|
2011-05-07 12:59:53 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-02-29 18:33:50 +01:00
|
|
|
explicit ClosedTabsManager();
|
|
|
|
|
2014-03-30 12:46:06 +02:00
|
|
|
void saveTab(WebTab* tab, int position);
|
2011-05-07 12:59:53 +02:00
|
|
|
bool isClosedTabAvailable();
|
|
|
|
|
2014-02-10 19:23:08 +01:00
|
|
|
// Takes tab that was most recently closed
|
|
|
|
Tab takeLastClosedTab();
|
|
|
|
// Takes tab at given index
|
|
|
|
Tab takeTabAt(int index);
|
|
|
|
|
|
|
|
QLinkedList<Tab> allClosedTabs();
|
|
|
|
void clearList();
|
2011-05-07 12:59:53 +02:00
|
|
|
|
|
|
|
private:
|
2014-02-10 19:23:08 +01:00
|
|
|
QLinkedList<Tab> m_closedTabs;
|
2011-05-07 12:59:53 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2014-02-10 19:23:08 +01:00
|
|
|
// Hint to Qt to use std::realloc on item moving
|
2013-02-26 12:56:11 +01:00
|
|
|
Q_DECLARE_TYPEINFO(ClosedTabsManager::Tab, Q_MOVABLE_TYPE);
|
|
|
|
|
2011-05-07 12:59:53 +02:00
|
|
|
#endif // CLOSEDTABSMANAGER_H
|