1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-24 04:36:34 +01:00

[Code] Use QVector instead of QList for elements bigger than pointer.

This commit is contained in:
nowrep 2013-02-26 12:56:11 +01:00
parent a25e189904
commit d885444501
56 changed files with 197 additions and 134 deletions

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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
@ -362,9 +362,11 @@ IShellLink* QtWin::CreateShellLink(const QString &title, const QString &descript
void QtWin::populateFrequentSites(IObjectCollection* collection, const QString &appPath)
{
History* history = mApp->history();
QList<HistoryEntry> mostList = history->mostVisited(6);
foreach(const HistoryEntry & entry, mostList)
collection->AddObject(CreateShellLink(entry.title, entry.url.toString(), appPath, QString(" " + entry.url.toEncoded()), appPath, 1));
QVector<HistoryEntry> mostList = history->mostVisited(6);
foreach(const HistoryEntry & entry, mostList) {
collection->AddObject(CreateShellLink(entry.title, entry.url.toString(), appPath, QString(" " + entry.url.toEncoded()), appPath, 1));
}
collection->AddObject(CreateShellLink("", "", "", "", "", 0)); //Spacer
}

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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
@ -19,7 +19,7 @@
#define ADBLOCKADDSUBSCRIPTIONDIALOG_H
#include <QDialog>
#include <QList>
#include <QVector>
#include "qz_namespace.h"
@ -49,13 +49,15 @@ private:
QString title;
QString url;
Subscription() {}
Subscription(const QString &t, const QString &u) {
title = t;
url = u;
}
};
QList<Subscription> m_knownSubscriptions;
QVector<Subscription> m_knownSubscriptions;
};
#endif // ADBLOCKADDSUBSCRIPTIONDIALOG_H

View File

@ -145,7 +145,8 @@ void AdBlockIcon::createMenu(QMenu* menu)
}
menu->addSeparator();
QList<WebPage::AdBlockedEntry> entries = page->adBlockedEntries();
QVector<WebPage::AdBlockedEntry> entries = page->adBlockedEntries();
if (entries.isEmpty()) {
menu->addAction(tr("No content blocked"))->setEnabled(false);
}

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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
@ -54,7 +54,7 @@ private:
QupZilla* p_QupZilla;
QAction* m_menuAction;
QList<QPair<AdBlockRule, QUrl> > m_blockedPopups;
QVector<QPair<AdBlockRule, QUrl> > m_blockedPopups;
QTimer* m_flashTimer;
int m_timerTicks;

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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
@ -20,7 +20,7 @@
#include <QPair>
#include <QString>
#include <QList>
#include <QVector>
#include <iostream>
#include "qz_namespace.h"
@ -33,7 +33,7 @@ public:
QString text;
};
typedef QList<ActionPair> ActionPairList;
typedef QVector<ActionPair> ActionPairList;
explicit CommandLineOptions(int &argc);
ActionPairList getActions();
@ -46,4 +46,7 @@ private:
ActionPairList m_actions;
};
// Hint to QVector to use std::realloc on item moving
Q_DECLARE_TYPEINFO(CommandLineOptions::ActionPair, Q_MOVABLE_TYPE);
#endif // COMMANDLINEOPTIONS_H

View File

@ -1087,14 +1087,16 @@ bool MainApplication::restoreStateSlot(QupZilla* window, RestoreData recoveryDat
// Instead create new one and restore pinned tabs there
QupZilla* newWin = makeNewWindow(Qz::BW_OtherRestoredWindow);
newWin->restoreWindowState(recoveryData.takeFirst());
newWin->restoreWindowState(recoveryData.first());
recoveryData.remove(0);
}
else {
// QTabWidget::count() - count of tabs is not updated after closing
// recovery tab ...
int tabCount = window->tabWidget()->count();
RestoreManager::WindowData data = recoveryData.takeFirst();
RestoreManager::WindowData data = recoveryData.first();
data.currentTab += tabCount;
recoveryData.remove(0);
window->restoreWindowState(data);
}

View File

@ -1078,7 +1078,7 @@ void QupZilla::aboutToShowHistoryMostMenu()
{
m_menuHistoryMost->clear();
const QList<HistoryEntry> &mostList = mApp->history()->mostVisited(10);
const QVector<HistoryEntry> &mostList = mApp->history()->mostVisited(10);
foreach(const HistoryEntry & entry, mostList) {
QString title = entry.title;

View File

@ -112,7 +112,7 @@ void AutoFill::blockStoringforUrl(const QUrl &url)
AutoFillData AutoFill::getFirstFormData(const QUrl &url)
{
QList<AutoFillData> list = getFormData(url, 1);
const QVector<AutoFillData> &list = getFormData(url, 1);
if (list.isEmpty()) {
AutoFillData data;
@ -124,9 +124,9 @@ AutoFillData AutoFill::getFirstFormData(const QUrl &url)
return list.first();
}
QList<AutoFillData> AutoFill::getFormData(const QUrl &url, int limit)
QVector<AutoFillData> AutoFill::getFormData(const QUrl &url, int limit)
{
QList<AutoFillData> list;
QVector<AutoFillData> list;
QString server = url.host();
if (server.isEmpty()) {
@ -255,10 +255,10 @@ void AutoFill::updateEntry(const PageFormData &formData, const AutoFillData &upd
}
// If password was filled in the page, returns all saved passwords on this page
QList<AutoFillData> AutoFill::completePage(WebPage* page)
QVector<AutoFillData> AutoFill::completePage(WebPage* page)
{
bool completed = false;
QList<AutoFillData> list;
QVector<AutoFillData> list;
if (!page) {
return list;
@ -318,7 +318,7 @@ void AutoFill::post(const QNetworkRequest &request, const QByteArray &outgoingDa
AutoFillData updateData = { -1, QString(), QString(), QByteArray() };
if (isStored(siteUrl)) {
const QList<AutoFillData> &list = getFormData(siteUrl);
const QVector<AutoFillData> &list = getFormData(siteUrl);
foreach(const AutoFillData & data, list) {
if (data.username == formData.username) {

View File

@ -54,7 +54,7 @@ public:
void blockStoringforUrl(const QUrl &url);
AutoFillData getFirstFormData(const QUrl &url);
QList<AutoFillData> getFormData(const QUrl &url, int limit = 0);
QVector<AutoFillData> getFormData(const QUrl &url, int limit = 0);
void updateLastUsed(int id);
@ -65,7 +65,7 @@ public:
void updateEntry(const PageFormData &formData, const AutoFillData &updateData);
void post(const QNetworkRequest &request, const QByteArray &outgoingData);
QList<AutoFillData> completePage(WebPage* page);
QVector<AutoFillData> completePage(WebPage* page);
static QByteArray exportPasswords();
static bool importPasswords(const QByteArray &data);
@ -76,4 +76,7 @@ private:
};
// Hint to QVector to use std::realloc on item moving
Q_DECLARE_TYPEINFO(AutoFillData, Q_MOVABLE_TYPE);
#endif // AUTOFILLMODEL_H

View File

@ -37,7 +37,7 @@ void AutoFillIcon::setWebView(WebView* view)
m_view = view;
}
void AutoFillIcon::setFormData(const QList<AutoFillData> &data)
void AutoFillIcon::setFormData(const QVector<AutoFillData> &data)
{
m_data = data;
}

View File

@ -32,7 +32,7 @@ public:
explicit AutoFillIcon(QWidget* parent = 0);
void setWebView(WebView* view);
void setFormData(const QList<AutoFillData> &data);
void setFormData(const QVector<AutoFillData> &data);
private slots:
void iconClicked();
@ -43,7 +43,7 @@ private:
WebView* m_view;
QList<AutoFillData> m_data;
QVector<AutoFillData> m_data;
};

View File

@ -33,7 +33,7 @@ AutoFillWidget::AutoFillWidget(WebView* view, QWidget* parent)
ui->setupUi(this);
}
void AutoFillWidget::setFormData(const QList<AutoFillData> &data)
void AutoFillWidget::setFormData(const QVector<AutoFillData> &data)
{
m_data = data;
@ -66,7 +66,7 @@ void AutoFillWidget::loginToPage()
bool ok;
int index = button->property("data-index").toInt(&ok);
if (ok && QzTools::listContainsIndex(m_data, index)) {
if (ok && QzTools::vectorContainsIndex(m_data, index)) {
const AutoFillData data = m_data.at(index);
PageFormCompleter completer(m_view->page());

View File

@ -40,7 +40,7 @@ public:
explicit AutoFillWidget(WebView* view, QWidget* parent = 0);
~AutoFillWidget();
void setFormData(const QList<AutoFillData> &data);
void setFormData(const QVector<AutoFillData> &data);
private slots:
void loginToPage();
@ -49,7 +49,7 @@ private:
Ui::AutoFillWidget* ui;
WebView* m_view;
QList<AutoFillData> m_data;
QVector<AutoFillData> m_data;
};
#endif // AUTOFILLWIDGET_H

View File

@ -448,9 +448,9 @@ bool BookmarksModel::renameFolder(const QString &before, const QString &after)
return true;
}
QList<Bookmark> BookmarksModel::folderBookmarks(const QString &name)
QVector<Bookmark> BookmarksModel::folderBookmarks(const QString &name)
{
QList<Bookmark> list;
QVector<Bookmark> list;
QSqlQuery query;
query.prepare("SELECT id, url, title, folder, icon FROM bookmarks WHERE folder=?");

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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
@ -91,7 +91,7 @@ public:
bool createFolder(const QString &name);
void removeFolder(const QString &name);
QList<Bookmark> folderBookmarks(const QString &name);
QVector<Bookmark> folderBookmarks(const QString &name);
bool createSubfolder(const QString &name);
bool isSubfolder(const QString &name);
@ -132,6 +132,9 @@ private:
typedef BookmarksModel::Bookmark Bookmark;
Q_DECLARE_METATYPE(BookmarksModel::Bookmark)
// Hint to QVector to use std::realloc on item moving
Q_DECLARE_TYPEINFO(Bookmark, Q_MOVABLE_TYPE);
Q_DECLARE_METATYPE(Bookmark)
#endif // BOOKMARKSMODEL_H

View File

@ -686,7 +686,7 @@ void BookmarksToolbar::refreshMostVisited()
{
m_menuMostVisited->clear();
QList<HistoryEntry> mostList = m_historyModel->mostVisited(10);
QVector<HistoryEntry> mostList = m_historyModel->mostVisited(10);
foreach(const HistoryEntry & entry, mostList) {
QString title = entry.title;
if (title.length() > 40) {

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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
@ -70,7 +70,7 @@ private:
QPixmap m_browserPixmap;
QString m_browserBookmarkFile;
QList<BookmarksModel::Bookmark> m_exportedBookmarks;
QVector<Bookmark> m_exportedBookmarks;
BookmarksImportIconFetcher* m_fetcher;
QThread* m_fetcherThread;

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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
@ -21,6 +21,7 @@
#include <QObject>
#include <QUrl>
#include <QList>
#include <QVector>
#include "qz_namespace.h"
@ -55,9 +56,12 @@ private slots:
void slotFetcherFinished();
private:
QList<Pair> m_pairs;
QVector<Pair> m_pairs;
QList<IconFetcher*> m_fetchers;
};
// Hint to QVector to use std::realloc on item moving
Q_DECLARE_TYPEINFO(BookmarksImportIconFetcher::Pair, Q_MOVABLE_TYPE);
#endif // BOOKMARKSIMPORTICONFETCHER_H

View File

@ -49,9 +49,9 @@ bool ChromeImporter::openFile()
return true;
}
QList<BookmarksModel::Bookmark> ChromeImporter::exportBookmarks()
QVector<Bookmark> ChromeImporter::exportBookmarks()
{
QList<BookmarksModel::Bookmark> list;
QVector<Bookmark> list;
QString bookmarks = QString::fromUtf8(m_file.readAll());
m_file.close();

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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
@ -32,7 +32,7 @@ public:
void setFile(const QString &path);
bool openFile();
QList<BookmarksModel::Bookmark> exportBookmarks();
QVector<Bookmark> exportBookmarks();
bool error() { return m_error; }
QString errorString() { return m_errorString; }

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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
@ -54,9 +54,9 @@ bool FirefoxImporter::openDatabase()
return true;
}
QList<BookmarksModel::Bookmark> FirefoxImporter::exportBookmarks()
QVector<Bookmark> FirefoxImporter::exportBookmarks()
{
QList<BookmarksModel::Bookmark> list;
QVector<Bookmark> list;
QSqlQuery query(db);
query.exec("SELECT title, fk FROM moz_bookmarks WHERE title != ''");

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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
@ -33,7 +33,7 @@ public:
void setFile(const QString &path);
bool openDatabase();
QList<BookmarksModel::Bookmark> exportBookmarks();
QVector<BookmarksModel::Bookmark> exportBookmarks();
bool error() { return m_error; }
QString errorString() { return m_errorString; }

View File

@ -59,9 +59,9 @@ int qzMin(int a, int b)
}
}
QList<BookmarksModel::Bookmark> HtmlImporter::exportBookmarks()
QVector<Bookmark> HtmlImporter::exportBookmarks()
{
QList<BookmarksModel::Bookmark> list;
QVector<BookmarksModel::Bookmark> list;
QString bookmarks = QString::fromUtf8(m_file.readAll());
m_file.close();

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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
@ -32,7 +32,7 @@ public:
void setFile(const QString &path);
bool openFile();
QList<BookmarksModel::Bookmark> exportBookmarks();
QVector<Bookmark> exportBookmarks();
bool error() { return m_error; }
QString errorString() { return m_errorString; }

View File

@ -44,9 +44,9 @@ bool OperaImporter::openFile()
return true;
}
QList<BookmarksModel::Bookmark> OperaImporter::exportBookmarks()
QVector<Bookmark> OperaImporter::exportBookmarks()
{
QList<BookmarksModel::Bookmark> list;
QVector<Bookmark> list;
QString bookmarks = QString::fromUtf8(m_file.readAll());
m_file.close();

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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
@ -32,7 +32,7 @@ public:
void setFile(const QString &path);
bool openFile();
QList<BookmarksModel::Bookmark> exportBookmarks();
QVector<BookmarksModel::Bookmark> exportBookmarks();
bool error() { return m_error; }
QString errorString() { return m_errorString; }

View File

@ -128,9 +128,9 @@ bool DownloadManager::nativeEvent(const QByteArray &eventType, void* _message, l
void DownloadManager::timerEvent(QTimerEvent* e)
{
QList<QTime> remTimes;
QList<int> progresses;
QList<double> speeds;
QVector<QTime> remTimes;
QVector<int> progresses;
QVector<double> speeds;
if (e->timerId() == m_timer.timerId()) {
if (!ui->list->count()) {

View File

@ -214,9 +214,9 @@ bool History::urlIsStored(const QString &url)
return query.next();
}
QList<HistoryEntry> History::mostVisited(int count)
QVector<HistoryEntry> History::mostVisited(int count)
{
QList<HistoryEntry> list;
QVector<HistoryEntry> list;
QSqlQuery query;
query.exec(QString("SELECT count, date, id, title, url FROM history ORDER BY count DESC LIMIT %1").arg(count));
while (query.next()) {

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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
@ -61,7 +61,7 @@ public:
bool urlIsStored(const QString &url);
QList<HistoryEntry> mostVisited(int count);
QVector<HistoryEntry> mostVisited(int count);
bool clearHistory();
bool optimizeHistory();
@ -86,4 +86,7 @@ private:
typedef History::HistoryEntry HistoryEntry;
// Hint to QVector to use std::realloc on item moving
Q_DECLARE_TYPEINFO(HistoryEntry, Q_MOVABLE_TYPE);
#endif // HISTORY_H

View File

@ -300,7 +300,7 @@ void HistoryModel::fetchMore(const QModelIndex &parent)
query.addBindValue(parentItem->startTimestamp());
query.exec();
QList<HistoryEntry> list;
QVector<HistoryEntry> list;
while (query.next()) {
HistoryEntry entry;

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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
@ -231,7 +231,7 @@ void SearchEnginesDialog::accept()
return;
}
QList<SearchEngine> allEngines;
QVector<SearchEngine> allEngines;
for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) {
QTreeWidgetItem* item = ui->treeWidget->topLevelItem(i);

View File

@ -392,7 +392,9 @@ void SearchEnginesManager::removeEngine(const Engine &engine)
{
ENSURE_LOADED;
if (!m_allEngines.contains(engine)) {
int index = m_allEngines.indexOf(engine);
if (index < 0) {
return;
}
@ -402,11 +404,11 @@ void SearchEnginesManager::removeEngine(const Engine &engine)
query.bindValue(1, engine.url);
query.exec();
m_allEngines.removeOne(engine);
m_allEngines.remove(index);
emit enginesChanged();
}
void SearchEnginesManager::setAllEngines(const QList<Engine> &engines)
void SearchEnginesManager::setAllEngines(const QVector<Engine> &engines)
{
ENSURE_LOADED;
@ -414,7 +416,7 @@ void SearchEnginesManager::setAllEngines(const QList<Engine> &engines)
emit enginesChanged();
}
QList<SearchEngine> SearchEnginesManager::allEngines()
QVector<SearchEngine> SearchEnginesManager::allEngines()
{
ENSURE_LOADED;

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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
@ -75,8 +75,8 @@ public:
Engine engineForShortcut(const QString &shortcut);
void setAllEngines(const QList<Engine> &engines);
QList<Engine> allEngines();
void setAllEngines(const QVector<Engine> &engines);
QVector<Engine> allEngines();
static QIcon iconForSearchEngine(const QUrl &url);
@ -108,7 +108,7 @@ private:
QString m_startingEngineName;
QString m_defaultEngineName;
QList<Engine> m_allEngines;
QVector<Engine> m_allEngines;
Engine m_activeEngine;
Engine m_defaultEngine;
@ -116,6 +116,9 @@ private:
typedef SearchEnginesManager::Engine SearchEngine;
Q_DECLARE_METATYPE(SearchEnginesManager::Engine)
// Hint to QVector to use std::realloc on item moving
Q_DECLARE_TYPEINFO(SearchEngine, Q_MOVABLE_TYPE);
Q_DECLARE_METATYPE(SearchEngine)
#endif // SEARCHENGINESMANAGER_H

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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
@ -37,6 +37,8 @@ void DatabaseWriter::execute()
return;
}
QSqlQuery query = m_queries.takeLast();
QSqlQuery query = m_queries.last();
query.exec();
m_queries.remove(m_queries.size() - 1);
}

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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
@ -20,7 +20,7 @@
#include <QObject>
#include <QSqlQuery>
#include <QList>
#include <QVector>
#include "qz_namespace.h"
@ -38,7 +38,7 @@ private slots:
void execute();
private:
QList<QSqlQuery> m_queries;
QVector<QSqlQuery> m_queries;
};
#endif // DATABASEWRITER_H

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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
@ -164,7 +164,7 @@ void PageScreen::createThumbnail()
QImage PageScreen::scaleImage()
{
QList<QImage> scaledImages;
QVector<QImage> scaledImages;
int sumHeight = 0;
foreach(const QImage & image, m_pageImages) {

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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
@ -60,7 +60,7 @@ private:
QFutureWatcher<void>* m_fileSaving;
QFutureWatcher<QImage>* m_imageScaling;
QString m_filePath;
QList<QImage> m_pageImages;
QVector<QImage> m_pageImages;
};
#endif // PAGESCREEN_H

View File

@ -117,7 +117,7 @@ Speller::Language Speller::language() const
return m_language;
}
QList<Speller::Language> Speller::availableLanguages()
QVector<Speller::Language> Speller::availableLanguages()
{
if (!m_availableLanguages.isEmpty()) {
return m_availableLanguages;
@ -327,7 +327,7 @@ void Speller::populateLanguagesMenu()
return;
}
const QList<Language> langs = availableLanguages();
const QVector<Language> langs = availableLanguages();
foreach(const Language & lang, langs) {
QAction* act = menu->addAction(lang.name, this, SLOT(changeLanguage()));
act->setCheckable(true);

View File

@ -20,6 +20,7 @@
#include <QWebElement>
#include <QStringList>
#include <QVector>
#include <QFile>
#include "qz_namespace.h"
@ -54,7 +55,7 @@ public:
void loadSettings();
Language language() const;
QList<Language> availableLanguages();
QVector<Language> availableLanguages();
QString dictionaryPath() const;
void populateContextMenu(QMenu* menu, const QWebHitTestResult &hitTest);
@ -89,7 +90,7 @@ private:
QFile m_userDictionary;
Language m_language;
QList<Language> m_availableLanguages;
QVector<Language> m_availableLanguages;
bool m_enabled;
// Replacing word
@ -98,6 +99,9 @@ private:
int m_endPos;
};
// Hint to QVector to use std::realloc on item moving
Q_DECLARE_TYPEINFO(Speller::Language, Q_MOVABLE_TYPE);
Q_DECLARE_METATYPE(Speller::Language)
#endif // SPELLER_H

View File

@ -20,6 +20,7 @@
#include <QUrl>
#include <QIcon>
#include <QVector>
#include "qz_namespace.h"
#include "animatedwidget.h"
@ -61,7 +62,7 @@ private:
QUrl m_url;
WebView* m_view;
QList<RssApp> m_rssApps;
QVector<RssApp> m_rssApps;
};
#endif // RSSNOTIFICATION_H

View File

@ -72,14 +72,14 @@ void RecoveryWidget::restoreSession()
for (int win = ui->treeWidget->topLevelItemCount() - 1; win >= 0; --win) {
QTreeWidgetItem* root = ui->treeWidget->topLevelItem(win);
if (root->checkState(0) == Qt::Unchecked) {
data.removeAt(win);
data.remove(win);
continue;
}
RestoreManager::WindowData &wd = data[win];
for (int tab = root->childCount() - 1; tab >= 0; --tab) {
if (root->child(tab)->checkState(0) == Qt::Unchecked) {
wd.tabsState.removeAt(tab);
wd.tabsState.remove(tab);
if (wd.currentTab >= tab) {
wd.currentTab--;
}
@ -87,7 +87,7 @@ void RecoveryWidget::restoreSession()
}
if (wd.tabsState.isEmpty()) {
data.removeAt(win);
data.remove(win);
continue;
}

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 Franz Fellner <alpine.art.de@googlemail.com>
* Copyright (C) 2010-2013 Franz Fellner <alpine.art.de@googlemail.com>
* David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
@ -70,7 +70,7 @@ void RestoreManager::createFromFile(const QString &file)
continue;
}
QList<WebTab::SavedTab> tabs;
QVector<WebTab::SavedTab> tabs;
int tabListCount = 0;
tabStream >> tabListCount;
for (int i = 0; i < tabListCount; ++i) {

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 Franz Fellner <alpine.art.de@googlemail.com>
* Copyright (C) 2010-2013 Franz Fellner <alpine.art.de@googlemail.com>
* David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
@ -28,20 +28,23 @@ public:
struct WindowData {
int currentTab;
QByteArray windowState;
QList<WebTab::SavedTab> tabsState;
QVector<WebTab::SavedTab> tabsState;
};
RestoreManager(const QString &sessionFile);
QList<RestoreManager::WindowData> restoreData() const;
QVector<RestoreManager::WindowData> restoreData() const;
bool isValid() const;
private:
void createFromFile(const QString &file);
QList<RestoreManager::WindowData> m_data;
QVector<RestoreManager::WindowData> m_data;
};
typedef QList<RestoreManager::WindowData> RestoreData;
typedef QVector<RestoreManager::WindowData> RestoreData;
// Hint to QVector to use std::realloc on item moving
Q_DECLARE_TYPEINFO(RestoreManager::WindowData, Q_MOVABLE_TYPE);
#endif // RESTOREMANAGER_H

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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
@ -308,7 +308,7 @@ void BookmarksSideBar::changeFolderParent(const QString &name, bool isSubfolder)
}
else {
addFolder(name);
QList<Bookmark> bookmarksList = m_bookmarksModel->folderBookmarks(name);
QVector<Bookmark> bookmarksList = m_bookmarksModel->folderBookmarks(name);
foreach(const Bookmark & b, bookmarksList) {
addBookmark(b);
}

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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
@ -56,7 +56,7 @@ void ButtonWithMenu::addItem(const Item &item)
emit itemAdded(item);
}
void ButtonWithMenu::addItems(const QList<Item> &items)
void ButtonWithMenu::addItems(const QVector<Item> &items)
{
foreach(const Item & item, items) {
addItem(item);
@ -70,7 +70,7 @@ void ButtonWithMenu::removeItem(const Item &item)
return;
}
m_items.removeOne(item);
m_items.remove(index);
if (m_items.count() == 0) {
setIcon(QIcon());

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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
@ -54,12 +54,12 @@ public:
~ButtonWithMenu();
void addItem(const Item &item);
void addItems(const QList<Item> &items);
void addItems(const QVector<Item> &items);
void removeItem(const Item &item);
void setCurrentItem(const Item &item, bool emitSignal = true);
Item currentItem();
QList<Item> allItems() { return m_items; }
QVector<Item> allItems() { return m_items; }
QMenu* menu() const;
signals:
@ -78,10 +78,13 @@ private:
void wheelEvent(QWheelEvent* event);
QMenu* m_menu;
QList<Item> m_items;
QVector<Item> m_items;
Item m_currentItem;
};
// Hint to QVector to use std::realloc on item moving
Q_DECLARE_TYPEINFO(ButtonWithMenu::Item, Q_MOVABLE_TYPE);
Q_DECLARE_METATYPE(ButtonWithMenu::Item)
#endif // BUTTONWITHMENU_H

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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
@ -17,6 +17,7 @@
* ============================================================ */
#include "closedtabsmanager.h"
#include "webtab.h"
#include "qztools.h"
#include "mainapplication.h"
#include <QWebHistory>
@ -45,7 +46,8 @@ ClosedTabsManager::Tab ClosedTabsManager::getFirstClosedTab()
{
Tab tab;
if (m_closedTabs.count() > 0) {
tab = m_closedTabs.takeFirst();
tab = m_closedTabs.first();
m_closedTabs.remove(0);
}
return tab;
@ -54,8 +56,9 @@ ClosedTabsManager::Tab ClosedTabsManager::getFirstClosedTab()
ClosedTabsManager::Tab ClosedTabsManager::getTabAt(int index)
{
Tab tab;
if (m_closedTabs.count() > 0 && m_closedTabs.count() > index) {
tab = m_closedTabs.takeAt(index);
if (QzTools::vectorContainsIndex(m_closedTabs, index)) {
tab = m_closedTabs.at(index);
m_closedTabs.remove(index);
}
return tab;
@ -70,3 +73,8 @@ void ClosedTabsManager::clearList()
{
m_closedTabs.clear();
}
QVector<ClosedTabsManager::Tab> ClosedTabsManager::allClosedTabs()
{
return m_closedTabs;
}

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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
@ -19,6 +19,7 @@
#define CLOSEDTABSMANAGER_H
#include <QUrl>
#include <QVector>
#include "qz_namespace.h"
@ -49,11 +50,14 @@ public:
bool isClosedTabAvailable();
void clearList();
QList<ClosedTabsManager::Tab> allClosedTabs() { return m_closedTabs; }
QVector<ClosedTabsManager::Tab> allClosedTabs();
private:
QList<ClosedTabsManager::Tab> m_closedTabs;
QVector<ClosedTabsManager::Tab> m_closedTabs;
};
// Hint to QVector to use std::realloc on item moving
Q_DECLARE_TYPEINFO(ClosedTabsManager::Tab, Q_MOVABLE_TYPE);
#endif // CLOSEDTABSMANAGER_H

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* 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
@ -82,7 +82,7 @@ private:
QImage m_emptyWebImage;
QPixmap m_bookmarkIcon;
QList<Icon> m_iconBuffer;
QVector<Icon> m_iconBuffer;
};
#endif // ICONPROVIDER_H

View File

@ -691,7 +691,7 @@ void TabWidget::restoreAllClosedTabs()
return;
}
const QList<ClosedTabsManager::Tab> &closedTabs = m_closedTabsManager->allClosedTabs();
const QVector<ClosedTabsManager::Tab> &closedTabs = m_closedTabsManager->allClosedTabs();
foreach(const ClosedTabsManager::Tab & tab, closedTabs) {
int index = addView(QUrl(), tab.title, Qz::NT_CleanSelectedTab);
@ -755,7 +755,7 @@ void TabWidget::aboutToShowClosedTabsMenu()
}
}
QList<WebTab*> TabWidget::allTabs(bool withPinned)
QList<WebTab *> TabWidget::allTabs(bool withPinned)
{
QList<WebTab*> allTabs;
@ -861,7 +861,7 @@ void TabWidget::restorePinnedTabs()
QByteArray TabWidget::saveState()
{
QList<WebTab::SavedTab> tabList;
QVector<WebTab::SavedTab> tabList;
for (int i = 0; i < count(); ++i) {
WebTab* webTab = weTab(i);
@ -887,7 +887,7 @@ QByteArray TabWidget::saveState()
return data;
}
bool TabWidget::restoreState(const QList<WebTab::SavedTab> &tabs, int currentTab)
bool TabWidget::restoreState(const QVector<WebTab::SavedTab> &tabs, int currentTab)
{
m_isRestoringState = true;
setUpdatesEnabled(false);

View File

@ -60,7 +60,7 @@ public:
void loadSettings();
QByteArray saveState();
bool restoreState(const QList<WebTab::SavedTab> &tabs, int currentTab);
bool restoreState(const QVector<WebTab::SavedTab> &tabs, int currentTab);
void closeRecoveryTab();
void savePinnedTabs();

View File

@ -575,7 +575,7 @@ void WebPage::addAdBlockRule(const AdBlockRule* rule, const QUrl &url)
}
}
QList<WebPage::AdBlockedEntry> WebPage::adBlockedEntries() const
QVector<WebPage::AdBlockedEntry> WebPage::adBlockedEntries() const
{
return m_adBlockedEntries;
}
@ -585,7 +585,7 @@ bool WebPage::hasMultipleUsernames() const
return m_autoFillData.count() > 1;
}
QList<AutoFillData> WebPage::autoFillData() const
QVector<AutoFillData> WebPage::autoFillData() const
{
return m_autoFillData;
}

View File

@ -20,6 +20,7 @@
#include <QWebPage>
#include <QSslCertificate>
#include <QVector>
#include "qz_namespace.h"
#include "autofill.h"
@ -63,10 +64,10 @@ public:
void javaScriptAlert(QWebFrame* originatingFrame, const QString &msg);
void addAdBlockRule(const AdBlockRule* rule, const QUrl &url);
QList<AdBlockedEntry> adBlockedEntries() const;
QVector<AdBlockedEntry> adBlockedEntries() const;
bool hasMultipleUsernames() const;
QList<AutoFillData> autoFillData() const;
QVector<AutoFillData> autoFillData() const;
void scheduleAdjustPage();
bool isRunningLoop();
@ -135,9 +136,9 @@ private:
QEventLoop* m_runningLoop;
QSslCertificate m_sslCert;
QList<QSslCertificate> m_rejectedSslCerts;
QList<AdBlockedEntry> m_adBlockedEntries;
QList<AutoFillData> m_autoFillData;
QVector<QSslCertificate> m_rejectedSslCerts;
QVector<AdBlockedEntry> m_adBlockedEntries;
QVector<AutoFillData> m_autoFillData;
QWebPage::NavigationType m_lastRequestType;
QUrl m_lastRequestUrl;

View File

@ -21,7 +21,7 @@
#include "gm_urlmatcher.h"
#include <QObject>
#include <QList>
#include <QVector>
#include <QUrl>
class QWebFrame;
@ -74,8 +74,8 @@ private:
QString m_description;
QString m_version;
QList<GM_UrlMatcher> m_include;
QList<GM_UrlMatcher> m_exclude;
QVector<GM_UrlMatcher> m_include;
QVector<GM_UrlMatcher> m_exclude;
QUrl m_downloadUrl;
StartAt m_startAt;

View File

@ -52,6 +52,11 @@ static bool wildcardMatch(const QString &string, const QString &pattern)
return true;
}
GM_UrlMatcher::GM_UrlMatcher()
: m_useRegExp(false)
{
}
GM_UrlMatcher::GM_UrlMatcher(const QString &pattern)
: m_pattern(pattern)
, m_useRegExp(false)

View File

@ -24,6 +24,7 @@
class GM_UrlMatcher
{
public:
explicit GM_UrlMatcher();
GM_UrlMatcher(const QString &pattern);
QString pattern() const;
@ -41,4 +42,7 @@ private:
bool m_useRegExp;
};
// Hint to QVector to use std::realloc on item moving
Q_DECLARE_TYPEINFO(GM_UrlMatcher, Q_MOVABLE_TYPE);
#endif // GM_URLMATCHER_H