diff --git a/src/data/html.qrc b/src/data/html.qrc index 58373083a..54382bc18 100644 --- a/src/data/html.qrc +++ b/src/data/html.qrc @@ -20,5 +20,6 @@ html/reload.png html/qupzilla.ico html/broken-page.png + html/setting.png diff --git a/src/data/html/setting.png b/src/data/html/setting.png new file mode 100644 index 000000000..86153a7fb Binary files /dev/null and b/src/data/html/setting.png differ diff --git a/src/data/html/speeddial.html b/src/data/html/speeddial.html index cdc7b6a4b..599d3f84d 100644 --- a/src/data/html/speeddial.html +++ b/src/data/html/speeddial.html @@ -3,8 +3,8 @@ %SITE-TITLE% @@ -273,11 +284,73 @@ function alignPage() { if (margintop < 0) margintop = 0; $("#quickdial").css('margin-top', margintop + 'px'); } + +function toggleDisplay(id) { + var div = document.getElementById(id); + div.style.display = (div.style.display == 'block' ? 'none' : 'block'); +} + +function checkSet() { + var checkb = document.getElementById('BgImgToggle'); + var BgImgSel = document.getElementById('BgImgSel'); + var BgImgSz = document.getElementById('BgImgSelSiz'); + var bgImg = '%IMG_BACKGROUND%'; + checkb.checked = (bgImg == '' ? false : true); + BgImgSel.disabled = (bgImg == '' ? true : false); + BgImgSz.disabled = (bgImg == '' ? true : false); +} + +function bgImageSel() { + var img = speeddial.getOpenFileName(); + if (img) { + document.getElementById('BgImgHold').value = 'file://' + img; + } +} + +function saveSettings() { + var BgImg = document.getElementById('BgImgHold').value; + var BgImgSz = document.getElementById('BgImgSelSiz').value; + speeddial.setBackgroundImage(BgImg); + speeddial.setBackgroundImageSize(BgImgSz); +} + +function bgImgToggle() { + var check = document.getElementById('BgImgToggle'); + var BgImgSel = document.getElementById('BgImgSel'); + var BgImgHold = document.getElementById('BgImgHold'); + var BgImgSz = document.getElementById('BgImgSelSiz'); + if (check.checked) { + BgImgSel.disabled = false; + BgImgHold.disabled = false; + BgImgSz.disabled = false; + BgImgHold.value = '%IMG_BACKGROUND%'; + } + else { + BgImgSel.disabled = true; + BgImgHold.disabled = true; + BgImgSz.disabled = true; + BgImgHold.value = ''; + } +} + +function bgImgUpdate() { + var imgUrl = document.getElementById('BgImgHold').value; + var imgSize = document.getElementById('BgImgSelSiz').value; + var imgThumb = document.getElementById('thumb'); + imgThumb.style.backgroundImage = 'url("' + imgUrl + '")'; + imgThumb.title = imgUrl.substring(imgUrl.lastIndexOf('/')+1); + imgThumb.style.backgroundSize = imgSize; + document.body.style.backgroundImage = 'url("' + imgUrl + '")'; + document.body.style.backgroundSize = imgSize; +} + +document.addEventListener("DOMContentLoaded", checkSet, false);
+ +
+
 
+
+

+ + +

+

+
+ +

+

+ +

+
+

+
diff --git a/src/network/qupzillaschemehandler.cpp b/src/network/qupzillaschemehandler.cpp index 999ce9fd8..c063039bb 100644 --- a/src/network/qupzillaschemehandler.cpp +++ b/src/network/qupzillaschemehandler.cpp @@ -257,12 +257,20 @@ QString QupZillaSchemeReply::speeddialPage() dPage.replace("%TITLE%", tr("Title")); dPage.replace("%EDIT%", tr("Apply")); dPage.replace("%NEW-PAGE%", tr("New Page")); + dPage.replace("%IMG_SETTINGS%", "qrc:html/setting.png"); + dPage.replace("%SETTINGS-TITLE%", tr("Speed Dial settings")); } QString page = dPage; page.replace("%INITIAL-SCRIPT%", mApp->plugins()->speedDial()->initialScript()); page.replace("%IMG_BACKGROUND%", mApp->plugins()->speedDial()->backgroundImage()); page.replace("%B_SIZE%", mApp->plugins()->speedDial()->backgroundImageSize()); - + page.replace("%TXT_PLACEMENT%", tr("Placement: ")); + page.replace("%TXT_AUTO%", tr("Auto")); + page.replace("%TXT_COVER%", tr("Cover")); + page.replace("%TXT_FIT%", tr("Fit")); + page.replace("%TXT_FWIDTH%", tr("Fit Width")); + page.replace("%TXT_FHEIGHT%", tr("Fit Height")); + page.replace("%TXT_NOTE%", tr("Speed Dial background image")); return page; } diff --git a/src/plugins/speeddial.cpp b/src/plugins/speeddial.cpp index 79fb5a11c..6e773f44e 100644 --- a/src/plugins/speeddial.cpp +++ b/src/plugins/speeddial.cpp @@ -36,6 +36,7 @@ void SpeedDial::loadSettings() m_allPages = settings.value("pages", "").toString(); m_bgImg = settings.value("background", "").toString(); m_bgImgSize = settings.value("backsize", "auto").toString(); + m_maxPagesInRow = settings.value("pagesrow", 4).toInt(); settings.endGroup(); if (m_allPages.isEmpty()) { @@ -65,6 +66,7 @@ void SpeedDial::saveSettings() settings.setValue("pages", m_allPages); settings.setValue("background", m_bgImg); settings.setValue("backsize", m_bgImgSize); + settings.setValue("pagesrow", m_maxPagesInRow); settings.endGroup(); } @@ -97,6 +99,15 @@ void SpeedDial::addPage(const QUrl &url, const QString &title) } } +int SpeedDial::pagesInRow() +{ + if (!m_loaded) { + loadSettings(); + } + + return m_maxPagesInRow; +} + QString SpeedDial::backgroundImage() { if (!m_loaded) { @@ -198,7 +209,22 @@ void SpeedDial::removeImageForUrl(const QString &url) QString SpeedDial::getOpenFileName() { - return QFileDialog::getOpenFileName(0, tr("Select image..."), QDir::homePath(), "(*.png *.jpg *.jpeg)"); + return QFileDialog::getOpenFileName(0, tr("Select image..."), QDir::homePath(), "(*.png *.jpg *.jpeg *.bmp *.gif *.tiff)"); +} + +void SpeedDial::setBackgroundImage(const QString &image) +{ + m_bgImg = image; +} + +void SpeedDial::setBackgroundImageSize(const QString &size) +{ + m_bgImgSize = size; +} + +void SpeedDial::setPagesInRow(int count) +{ + m_maxPagesInRow = count; } void SpeedDial::thumbnailCreated(const QPixmap &image) diff --git a/src/plugins/speeddial.h b/src/plugins/speeddial.h index 30aa582f7..eb9ef4e99 100644 --- a/src/plugins/speeddial.h +++ b/src/plugins/speeddial.h @@ -39,6 +39,7 @@ public: void addWebFrame(QWebFrame* frame); void addPage(const QUrl &url, const QString &title); + int pagesInRow(); QString backgroundImage(); QString backgroundImageSize(); QString initialScript(); @@ -51,6 +52,9 @@ public slots: Q_INVOKABLE void removeImageForUrl(const QString &url); Q_INVOKABLE QString getOpenFileName(); + Q_INVOKABLE void setBackgroundImage(const QString &image); + Q_INVOKABLE void setBackgroundImageSize(const QString &size); + Q_INVOKABLE void setPagesInRow(int count); private slots: void thumbnailCreated(const QPixmap &image); @@ -61,6 +65,7 @@ private: QString m_thumbnailsDir; QString m_bgImg; QString m_bgImgSize; + int m_maxPagesInRow; QList > m_webFrames;