2012-04-02 19:33:05 +02:00
|
|
|
/* ============================================================
|
|
|
|
* QupZilla - WebKit based browser
|
2014-01-11 16:11:42 +01:00
|
|
|
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
|
2012-04-02 19:33:05 +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/>.
|
|
|
|
* ============================================================ */
|
2014-02-26 20:03:20 +01:00
|
|
|
#ifndef QZCOMMON_H
|
|
|
|
#define QZCOMMON_H
|
2012-01-21 23:19:38 +01:00
|
|
|
|
2014-03-16 13:22:41 +01:00
|
|
|
#include <QDebug>
|
2013-05-10 22:34:51 +02:00
|
|
|
#include <QFlags>
|
|
|
|
|
2012-02-29 18:33:50 +01:00
|
|
|
#ifdef QUPZILLA_SHAREDLIBRARY
|
2014-02-19 22:12:32 +01:00
|
|
|
#define QUPZILLA_EXPORT Q_DECL_EXPORT
|
2012-02-29 18:33:50 +01:00
|
|
|
#else
|
2014-02-19 22:12:32 +01:00
|
|
|
#define QUPZILLA_EXPORT Q_DECL_IMPORT
|
2012-02-29 18:33:50 +01:00
|
|
|
#endif
|
|
|
|
|
2013-05-10 13:12:02 +02:00
|
|
|
#ifndef Q_UNLIKELY
|
|
|
|
#define Q_UNLIKELY(x) x
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef Q_LIKELY
|
|
|
|
#define Q_LIKELY(x) x
|
|
|
|
#endif
|
|
|
|
|
2014-03-10 16:55:11 +01:00
|
|
|
#ifndef QSL
|
|
|
|
#define QSL(x) QStringLiteral(x)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef QL1S
|
|
|
|
#define QL1S(x) QLatin1String(x)
|
|
|
|
#endif
|
|
|
|
|
[AdBlock] Improved performance of loading rules
Don't use regexps for parsing rules.
Added benchmark for loading subscriptions
Before:
********* Start testing of AdBlockParseRule *********
Config: Using QTest library 4.8.6, Qt 4.8.6
PASS : AdBlockParseRule::initTestCase()
RESULT : AdBlockParseRule::parseEasyList():
596.3 msecs per iteration (total: 2,982, iterations: 5)
PASS : AdBlockParseRule::parseEasyList()
PASS : AdBlockParseRule::cleanupTestCase()
Totals: 3 passed, 0 failed, 0 skipped
********* Finished testing of AdBlockParseRule *********
After:
********* Start testing of AdBlockParseRule *********
Config: Using QTest library 4.8.6, Qt 4.8.6
PASS : AdBlockParseRule::initTestCase()
RESULT : AdBlockParseRule::parseEasyList():
481.8 msecs per iteration (total: 2,409, iterations: 5)
PASS : AdBlockParseRule::parseEasyList()
PASS : AdBlockParseRule::cleanupTestCase()
Totals: 3 passed, 0 failed, 0 skipped
********* Finished testing of AdBlockParseRule *********
2014-04-06 13:34:01 +02:00
|
|
|
#ifndef QL1C
|
|
|
|
#define QL1C(x) QLatin1Char(x)
|
|
|
|
#endif
|
|
|
|
|
2012-01-21 23:19:38 +01:00
|
|
|
namespace Qz
|
|
|
|
{
|
2012-12-20 15:22:14 +01:00
|
|
|
// Version of session.dat file
|
2014-04-17 15:20:54 +02:00
|
|
|
extern const int sessionVersion;
|
2014-03-14 14:08:38 +01:00
|
|
|
// Backwards compatibility (used to be different for Qt4 and Qt5)
|
2014-04-17 15:20:54 +02:00
|
|
|
extern const int sessionVersionQt5;
|
2012-01-21 23:19:38 +01:00
|
|
|
|
2014-02-06 17:07:19 +01:00
|
|
|
// Version of bookmarks.json file
|
2014-04-17 15:20:54 +02:00
|
|
|
extern const int bookmarksVersion;
|
2014-02-06 17:07:19 +01:00
|
|
|
|
2014-09-25 15:00:15 +02:00
|
|
|
QUPZILLA_EXPORT extern const char* APPNAME;
|
2014-04-23 10:12:32 +02:00
|
|
|
QUPZILLA_EXPORT extern const char* VERSION;
|
2014-09-25 15:00:15 +02:00
|
|
|
QUPZILLA_EXPORT extern const char* AUTHOR;
|
|
|
|
QUPZILLA_EXPORT extern const char* COPYRIGHT;
|
|
|
|
QUPZILLA_EXPORT extern const char* WWWADDRESS;
|
|
|
|
QUPZILLA_EXPORT extern const char* WIKIADDRESS;
|
2014-02-19 22:07:21 +01:00
|
|
|
|
|
|
|
enum BrowserWindowType {
|
2012-01-21 23:19:38 +01:00
|
|
|
BW_FirstAppWindow,
|
|
|
|
BW_OtherRestoredWindow,
|
2013-02-07 14:01:01 +01:00
|
|
|
BW_NewWindow,
|
|
|
|
BW_MacFirstWindow
|
2012-01-21 23:19:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
enum CommandLineAction {
|
|
|
|
CL_NoAction,
|
|
|
|
CL_OpenUrl,
|
2012-04-03 20:41:07 +02:00
|
|
|
CL_OpenUrlInCurrentTab,
|
2012-07-10 00:36:05 +02:00
|
|
|
CL_OpenUrlInNewWindow,
|
2012-01-21 23:19:38 +01:00
|
|
|
CL_StartWithProfile,
|
|
|
|
CL_StartWithoutAddons,
|
|
|
|
CL_NewTab,
|
|
|
|
CL_NewWindow,
|
|
|
|
CL_ShowDownloadManager,
|
2014-01-22 17:34:25 +01:00
|
|
|
CL_ToggleFullScreen,
|
2012-01-21 23:19:38 +01:00
|
|
|
CL_StartPrivateBrowsing,
|
2012-09-01 15:59:27 +02:00
|
|
|
CL_StartNewInstance,
|
2014-01-23 13:02:07 +01:00
|
|
|
CL_StartPortable,
|
2012-01-21 23:19:38 +01:00
|
|
|
CL_ExitAction
|
|
|
|
};
|
|
|
|
|
2012-02-19 17:50:02 +01:00
|
|
|
enum ObjectName {
|
|
|
|
ON_WebView,
|
|
|
|
ON_TabBar,
|
2014-02-26 19:55:49 +01:00
|
|
|
ON_BrowserWindow
|
2012-02-19 17:50:02 +01:00
|
|
|
};
|
|
|
|
|
2012-01-21 23:19:38 +01:00
|
|
|
enum NewTabPositionFlag {
|
|
|
|
NT_SelectedTab = 1,
|
|
|
|
NT_NotSelectedTab = 2,
|
|
|
|
NT_CleanTab = 4,
|
2012-01-26 20:19:56 +01:00
|
|
|
NT_TabAtTheEnd = 8,
|
2013-01-25 23:49:46 +01:00
|
|
|
NT_NewEmptyTab = 16,
|
2012-01-21 23:19:38 +01:00
|
|
|
|
2013-01-25 23:49:46 +01:00
|
|
|
NT_SelectedNewEmptyTab = NT_SelectedTab | NT_TabAtTheEnd | NT_NewEmptyTab,
|
2012-01-26 20:19:56 +01:00
|
|
|
NT_SelectedTabAtTheEnd = NT_SelectedTab | NT_TabAtTheEnd,
|
|
|
|
NT_NotSelectedTabAtTheEnd = NT_NotSelectedTab | NT_TabAtTheEnd,
|
2012-02-19 17:50:02 +01:00
|
|
|
NT_CleanSelectedTabAtTheEnd = NT_SelectedTab | NT_TabAtTheEnd | NT_CleanTab,
|
2012-01-21 23:19:38 +01:00
|
|
|
NT_CleanSelectedTab = NT_CleanTab | NT_SelectedTab,
|
|
|
|
NT_CleanNotSelectedTab = NT_CleanTab | NT_NotSelectedTab
|
|
|
|
};
|
|
|
|
|
|
|
|
Q_DECLARE_FLAGS(NewTabPositionFlags, NewTabPositionFlag)
|
|
|
|
Q_DECLARE_OPERATORS_FOR_FLAGS(Qz::NewTabPositionFlags)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-11-03 16:04:38 +01:00
|
|
|
#define ADBLOCK_EASYLIST_URL "https://easylist-downloads.adblockplus.org/easylist.txt"
|
|
|
|
|
2014-03-03 14:47:47 +01:00
|
|
|
#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
|
2012-04-05 10:27:35 +02:00
|
|
|
#define DEFAULT_THEME_NAME "windows"
|
2012-09-03 22:48:52 +02:00
|
|
|
#elif defined(Q_OS_MAC)
|
2012-04-05 10:27:35 +02:00
|
|
|
#define DEFAULT_THEME_NAME "mac"
|
2014-03-03 14:47:47 +01:00
|
|
|
#elif defined(Q_OS_UNIX)
|
|
|
|
#define DEFAULT_THEME_NAME "linux"
|
2012-04-05 10:27:35 +02:00
|
|
|
#else
|
|
|
|
#define DEFAULT_THEME_NAME "default"
|
|
|
|
#endif
|
|
|
|
|
2012-09-03 22:48:52 +02:00
|
|
|
#ifdef Q_OS_WIN
|
2012-04-05 10:27:35 +02:00
|
|
|
#define DEFAULT_CHECK_UPDATES true
|
|
|
|
#else
|
|
|
|
#define DEFAULT_CHECK_UPDATES false
|
|
|
|
#endif
|
|
|
|
|
2013-01-29 20:34:14 +01:00
|
|
|
#define DEFAULT_CHECK_DEFAULTBROWSER false
|
|
|
|
|
2012-09-03 22:48:52 +02:00
|
|
|
#ifdef Q_OS_WIN
|
2012-04-05 10:27:35 +02:00
|
|
|
#define DEFAULT_DOWNLOAD_USE_NATIVE_DIALOG false
|
|
|
|
#else
|
|
|
|
#define DEFAULT_DOWNLOAD_USE_NATIVE_DIALOG true
|
|
|
|
#endif
|
|
|
|
|
2014-02-26 20:03:20 +01:00
|
|
|
#endif // QZCOMMON_H
|