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

Add possibility to choose whether to center the speed dials or not

This commit is contained in:
Mladen Pejaković 2012-07-29 20:58:23 +02:00
parent c0e6ee53ec
commit 69cf0c1c8c
4 changed files with 28 additions and 1 deletions

View File

@ -8,7 +8,7 @@ body * {-webkit-user-select: none;font-size: 100%;line-height: 1.6;margin: 0px;}
.add {position: absolute;right:10px;top:10px;width: 24px;height: 24px;background: url(%IMG_PLUS%); cursor: pointer;}
#quickdial {margin: auto;text-align: center;}
#quickdial div.entry {position: relative; display:inline-block; border-width: 10px;
#quickdial div.entry {position: relative; border-width: 10px;
-webkit-border-image: url(%BOX-BORDER%) 10;margin: 5px;}
#quickdial img {display: block;margin: auto;}
#quickdial a {position: absolute;left: 0px;top: 0px;width: 100%;height: 87%;}
@ -333,11 +333,13 @@ function bgImageSel() {
function saveSettings() {
MAX_PAGES_ROW = $('#PgInRow').val();
DIAL_WIDTH = parseInt($('#SdSize').val());
SD_CNTR = ($('#SdCntrToggle').attr('checked') ? 1 : 0 );
speeddial.setBackgroundImage($('#BgImgHold').val());
speeddial.setBackgroundImageSize($('#BgImgSelSiz').val());
speeddial.setPagesInRow(MAX_PAGES_ROW);
speeddial.setSdSize(DIAL_WIDTH);
speeddial.setSdCentered(SD_CNTR);
alignPage();
}
@ -381,11 +383,15 @@ $(document).ready(function () {
$('#BgImgSelSiz').val('%B_SIZE%').attr('selected','selected');
var bgImg = "%IMG_BACKGROUND%";
var sdSize = 'DIAL_WIDTH';
var sdCntr = "%SD-CNTR%";
bgImg == '' ? $('#BgImgToggle').prop('checked', false) : $('#BgImgToggle').prop('checked', true)
sdSize == '231' ? $('#SdSizeToggle').prop('checked', false) : $('#SdSizeToggle').prop('checked', true)
$('#BgImgToggle').is(':checked') ? $('#BgImgSel').removeAttr('disabled') : $('#BgImgSel').attr('disabled', 'disabled');
$('#BgImgToggle').is(':checked') ? $('#BgImgSelSiz').removeAttr('disabled') : $('#BgImgSelSiz').attr('disabled', 'disabled');
$('#SdSizeToggle').is(':checked') ? $('#SdSize').removeAttr('disabled') : $('#SdSize').attr('disabled', 'disabled');
sdCntr == 0 ? $('#SdCntrToggle').prop('checked', false) : $('#SdCntrToggle').prop('checked', true);
sdCntr == 0 ? $('#quickdial div.entry').css('float', 'left') : $('#quickdial div.entry').css('display', 'inline-block');
});
</script>
@ -424,6 +430,7 @@ $("#quickdial").sortable({
<input id="PgInRow" type="range" min="2" max="8" value="%ROW-PAGES%" step="1" onchange="$('#sliderValuePg').html(this.value);" />
</div>
<div class="togop">
<input type="checkbox" name="sdcntrt" id="SdCntrToggle" />&nbsp;<label for="SdCntrToggle">%TXT_CNTRDLS%</label><br />
<input type="checkbox" name="sdsizet" id="SdSizeToggle" onchange="sdSizeToggle()" />&nbsp;<label for="SdSizeToggle">%TXT_SDSIZE%</label>
</div>
<div class="rowsel">

View File

@ -284,6 +284,7 @@ QString QupZillaSchemeReply::speeddialPage()
dPage.replace("%TXT_SELECTIMAGE%", tr("Select image"));
dPage.replace("%TXT_NRROWS%", tr("Maximum pages in a row:"));
dPage.replace("%TXT_SDSIZE%", tr("Change size of pages:"));
dPage.replace("%TXT_CNTRDLS%", tr("Center speed dials"));
}
QString page = dPage;
@ -294,6 +295,7 @@ QString QupZillaSchemeReply::speeddialPage()
page.replace("%B_SIZE%", dial->backgroundImageSize());
page.replace("%ROW-PAGES%", QString::number(dial->pagesInRow()));
page.replace("%SD-SIZE%", QString::number(dial->sdSize()));
page.replace("%SD-CNTR%", QString::number(dial->sdCntr()));
return page;
}

View File

@ -50,6 +50,7 @@ void SpeedDial::loadSettings()
m_backgroundImageSize = settings.value("backsize", "auto").toString();
m_maxPagesInRow = settings.value("pagesrow", 4).toInt();
m_sizeOfSpeedDials = settings.value("sdsize", 231).toInt();
m_sdcentered = settings.value("sdcenter", 0).toInt();
settings.endGroup();
if (allPages.isEmpty()) {
@ -84,6 +85,7 @@ void SpeedDial::saveSettings()
settings.setValue("backsize", m_backgroundImageSize);
settings.setValue("pagesrow", m_maxPagesInRow);
settings.setValue("sdsize", m_sizeOfSpeedDials);
settings.setValue("sdcenter", m_sdcentered);
settings.endGroup();
}
@ -175,6 +177,13 @@ int SpeedDial::sdSize()
return m_sizeOfSpeedDials;
}
int SpeedDial::sdCntr()
{
ENSURE_LOADED;
return m_sdcentered;
}
QString SpeedDial::backgroundImage()
{
ENSURE_LOADED;
@ -311,6 +320,11 @@ void SpeedDial::setSdSize(int count)
m_sizeOfSpeedDials = count;
}
void SpeedDial::setSdCentered(int cntr)
{
m_sdcentered = cntr;
}
void SpeedDial::thumbnailCreated(const QPixmap &pixmap)
{
PageThumbnailer* thumbnailer = qobject_cast<PageThumbnailer*>(sender());

View File

@ -57,6 +57,8 @@ public:
int pagesInRow();
int sdSize();
int sdCntr();
QString backgroundImage();
QString backgroundImageSize();
QString initialScript();
@ -75,6 +77,7 @@ public slots:
void setBackgroundImageSize(const QString &size);
void setPagesInRow(int count);
void setSdSize(int count);
void setSdCentered(int cntr);
private slots:
void thumbnailCreated(const QPixmap &pixmap);
@ -92,6 +95,7 @@ private:
QString m_backgroundImageSize;
int m_maxPagesInRow;
int m_sizeOfSpeedDials;
int m_sdcentered;
QList<QWeakPointer<QWebFrame> > m_webFrames;
QList<Page> m_webPages;