Ejemplo n.º 1
0
void SettingsManager::load()
{
    QString path = QDesktopServices::storageLocation(QDesktopServices::DataLocation) + "/";
    QDir dir;
    if(!dir.mkpath(path))
    {
        return;
    }
    QWebSettings::setIconDatabasePath(path);
    QSettings settings("PayableOnDeath", "Surfer");
    setImagesEnabled(settings.value("webkit/images", true).toBool());
    setJavascriptEnabled(settings.value("webkit/javascript", true).toBool());
    setJavaEnabled(settings.value("webkit/java", true).toBool());
    setPluginsEnabled(settings.value("webkit/plugins", true).toBool());
    setPrivateBrowsingEnabled(settings.value("webkit/private_browsing", false).toBool());
    setMainWindowGeometry(settings.value("geometry/main_window").toRect());
    setHistoryDialogGeometry(settings.value("geometry/history_dialog").toRect());
    setBookmarksDialogGeometry(settings.value("geometry/bookmarks_dialog").toRect());
    setSettingsDialogGeometry(settings.value("geometry/settings_dialog").toRect());
    setDownloadDialogGeometry(settings.value("geometry/download_dialog").toRect());
    setMaximumCacheSize(settings.value("extension/cache/maximum_size", 50 * 1024 * 1024).toLongLong());
    setHistoryExpirationDays(settings.value("extension/history/expiration_days", 7).toInt());
    setDownloadPath(settings.value("extension/download/path", "").toString());
    setSansFontFamily(settings.value("font/sans/family").toString());
    setSerifFontFamily(settings.value("font/serif/family").toString());
    setMonoFontFamily(settings.value("font/mono/family").toString());
    setStandardFontSize(settings.value("font/standard/size", 12).toInt());
    setMonoFontSize(settings.value("font/mono/size", 12).toInt());
}
Ejemplo n.º 2
0
void NetworkCache::optionChanged(const QString &option, const QVariant &value)
{
	if (option == QLatin1String("Cache/DiskCacheLimit"))
	{
		setMaximumCacheSize(value.toInt() * 1024);
	}
}
Ejemplo n.º 3
0
void BrowserNetworkDiskCache::loadSettings()
{
	qint64 maximumCacheSize = QBook::settings().value(QLatin1String("webkit/maxCacheSize"), 20).toInt();
	if (maximumCacheSize >= MAX_CACHE_SIZE) 
		maximumCacheSize = MAX_CACHE_SIZE * 1024 * 1024;
	else 
		maximumCacheSize = maximumCacheSize * 1024 * 1024;
	setMaximumCacheSize(maximumCacheSize);
}
Ejemplo n.º 4
0
NetworkDiskCache::NetworkDiskCache(QObject * parent)
        : QNetworkDiskCache(parent)
{
    QString path =
            QDesktopServices::storageLocation(QDesktopServices::DataLocation) + "/cache";
    setCacheDirectory(path);

    setMaximumCacheSize(SettingsManager::settingsManager()->maximumCacheSize());
}
	QNetworkAccessManager* StandardNAMFactory::create (QObject *parent)
	{
		auto nam = new QNetworkAccessManager (parent);

		auto cache = new NetworkDiskCache (Subpath_, nam);
		cache->setMaximumCacheSize (CacheSizeGetter_ ());
		nam->setCache (cache);

		return nam;
	}
Ejemplo n.º 6
0
void SettingsManager::reset()
{
    setImagesEnabled(true);
    setJavascriptEnabled(true);
    setJavaEnabled(true);
    setPluginsEnabled(true);
    setPrivateBrowsingEnabled(false);
    setMaximumCacheSize(50 * 1024 * 1024);
    setHistoryExpirationDays(7);
    setDownloadPath("");
    setStandardFontSize(12);
    setMonoFontSize(12);
}
Ejemplo n.º 7
0
NetworkCache::NetworkCache(QObject *parent) : QNetworkDiskCache(parent)
{
	const QString cachePath(SessionsManager::getCachePath());

	if (!cachePath.isEmpty())
	{
		QDir().mkpath(cachePath);

		setCacheDirectory(cachePath);
		setMaximumCacheSize(SettingsManager::getValue(QLatin1String("Cache/DiskCacheLimit")).toInt() * 1024);
	}

	connect(SettingsManager::getInstance(), SIGNAL(valueChanged(QString,QVariant)), this, SLOT(optionChanged(QString,QVariant)));
}
void UBGraphicsSvgItem::init()
{
    setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object);

    mDelegate = new UBGraphicsItemDelegate(this, 0, true, true, false);
    mDelegate->init();
    mDelegate->setFlippable(true);
    mDelegate->setRotatable(true);

    setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);

    setCacheMode(QGraphicsItem::DeviceCoordinateCache);
    setMaximumCacheSize(boundingRect().size().toSize() * UB_MAX_ZOOM);

    setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly

    setUuid(QUuid::createUuid());
}
int QGraphicsSvgItem::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QGraphicsObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: d_func()->_q_repaintItem(); break;
        default: ;
        }
        _id -= 1;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = elementId(); break;
        case 1: *reinterpret_cast< QSize*>(_v) = maximumCacheSize(); break;
        }
        _id -= 2;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setElementId(*reinterpret_cast< QString*>(_v)); break;
        case 1: setMaximumCacheSize(*reinterpret_cast< QSize*>(_v)); break;
        }
        _id -= 2;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 2;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
		void load()
		{
			setCacheDirectory("./cache");
			setMaximumCacheSize(Config::getValue("/Network/Cache/Maximum", 100 * 1024 * 1024));
		}
Ejemplo n.º 11
0
MazeItem::MazeItem() : QGraphicsSvgItem()
{
    // Configure the cache in order to increase the performance
    setCacheMode(DeviceCoordinateCache);
    setMaximumCacheSize(QSize(2000, 2000));
}