aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLibravatar keshavbhatt <keshavnrj@gmail.com>2021-05-12 19:04:43 +0530
committerLibravatar keshavbhatt <keshavnrj@gmail.com>2021-05-12 19:04:43 +0530
commit2abe5e01d1bc786cf177b0db2645818f57d4f540 (patch)
tree205b5d8f022ed3ec4a2efc4dbf631548125ada23 /src
parentc13e84957e0aefd96b57f98ca1128c93901f587d (diff)
downloadwhatsie-2abe5e01d1bc786cf177b0db2645818f57d4f540.tar.gz
whatsie-2abe5e01d1bc786cf177b0db2645818f57d4f540.zip
implemented page zoom feature,
- in settings widget.
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp9
-rw-r--r--src/settingswidget.cpp33
-rw-r--r--src/settingswidget.h6
-rw-r--r--src/settingswidget.ui422
4 files changed, 318 insertions, 152 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index cdeab28..a2a7770 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -203,6 +203,12 @@ void MainWindow::init_settingWidget()
}
});
+ connect(settingsWidget,&SettingsWidget::zoomChanged,[=]()
+ {
+ double currentFactor = settings.value("zoomFactor",1.0).toDouble();
+ webEngine->page()->setZoomFactor(currentFactor);
+ });
+
connect(settingsWidget,&SettingsWidget::notificationPopupTimeOutChanged,[=](){
setNotificationPresenter(this->webEngine->page()->profile());
});
@@ -593,6 +599,9 @@ void MainWindow::createWebPage(bool offTheRecord)
connect(webEngine->page(), SIGNAL(fullScreenRequested(QWebEngineFullScreenRequest)),
this, SLOT(fullScreenRequested(QWebEngineFullScreenRequest)));
+
+ double currentFactor = settings.value("zoomFactor",1.0).toDouble();
+ webEngine->page()->setZoomFactor(currentFactor);
}
void MainWindow::setNotificationPresenter(QWebEngineProfile* profile)
diff --git a/src/settingswidget.cpp b/src/settingswidget.cpp
index 79394aa..9d4904a 100644
--- a/src/settingswidget.cpp
+++ b/src/settingswidget.cpp
@@ -19,6 +19,10 @@ SettingsWidget::SettingsWidget(QWidget *parent, QString engineCachePath, QString
this->engineCachePath = engineCachePath;
this->enginePersistentStoragePath = enginePersistentStoragePath;
+ ui->zoomFactorSpinBox->setRange(0.25,5.0);
+ ui->zoomFactorSpinBox->setValue(settings.value("zoomFactor",1.0).toDouble());
+ //emit zoomChanged();
+
ui->closeButtonActionComboBox->setCurrentIndex(settings.value("closeButtonActionCombo",0).toInt());
ui->notificationCheckBox->setChecked(settings.value("disableNotificationPopups",false).toBool());
ui->muteAudioCheckBox->setChecked(settings.value("muteAudio",false).toBool());
@@ -422,3 +426,32 @@ void SettingsWidget::on_useNativeFileDialog_toggled(bool checked)
{
settings.setValue("useNativeFileDialog",checked);
}
+
+void SettingsWidget::on_zoomPlus_clicked()
+{
+ double currentFactor = settings.value("zoomFactor",1.0).toDouble();
+ double newFactor = currentFactor + 0.25;
+ ui->zoomFactorSpinBox->setValue(newFactor);
+
+ settings.setValue("zoomFactor",ui->zoomFactorSpinBox->value());
+ emit zoomChanged();
+}
+
+void SettingsWidget::on_zoomMinus_clicked()
+{
+ double currentFactor = settings.value("zoomFactor",1.0).toDouble();
+ double newFactor = currentFactor - 0.25;
+ ui->zoomFactorSpinBox->setValue(newFactor);
+
+ settings.setValue("zoomFactor",ui->zoomFactorSpinBox->value());
+ emit zoomChanged();
+}
+
+void SettingsWidget::on_zoomReset_clicked()
+{
+ double newFactor = 1.0;
+ ui->zoomFactorSpinBox->setValue(newFactor);
+
+ settings.setValue("zoomFactor",ui->zoomFactorSpinBox->value());
+ emit zoomChanged();
+}
diff --git a/src/settingswidget.h b/src/settingswidget.h
index a49eda8..6f0fa4a 100644
--- a/src/settingswidget.h
+++ b/src/settingswidget.h
@@ -28,6 +28,7 @@ signals:
void spellCheckChanged(bool checked);
void notificationPopupTimeOutChanged();
void notify(QString message);
+ void zoomChanged();
public:
explicit SettingsWidget(QWidget *parent = nullptr,QString engineCachePath = "",
@@ -88,6 +89,11 @@ private slots:
void themeSwitchTimerTimeout();
void on_useNativeFileDialog_toggled(bool checked);
+ void on_zoomPlus_clicked();
+ void on_zoomMinus_clicked();
+
+ void on_zoomReset_clicked();
+
private:
Ui::SettingsWidget *ui;
QString engineCachePath,enginePersistentStoragePath;
diff --git a/src/settingswidget.ui b/src/settingswidget.ui
index 3f7e2d4..55f55a1 100644
--- a/src/settingswidget.ui
+++ b/src/settingswidget.ui
@@ -109,42 +109,6 @@ background:transparent;
<string>General settings</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
- <item row="12" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>User Agent</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="userAgentLineEdit"/>
- </item>
- <item>
- <widget class="QPushButton" name="setUserAgent">
- <property name="text">
- <string> Set</string>
- </property>
- <property name="icon">
- <iconset resource="icons.qrc">
- <normaloff>:/icons/categories/utilities.png</normaloff>:/icons/categories/utilities.png</iconset>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="defaultUserAgentButton">
- <property name="text">
- <string> Default</string>
- </property>
- <property name="icon">
- <iconset resource="icons.qrc">
- <normaloff>:/icons/refresh-line.png</normaloff>:/icons/refresh-line.png</iconset>
- </property>
- </widget>
- </item>
- </layout>
- </item>
<item row="8" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
@@ -178,6 +142,101 @@ background:transparent;
</item>
</layout>
</item>
+ <item row="5" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QCheckBox" name="applock_checkbox">
+ <property name="toolTip">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enable application lock screen.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="text">
+ <string>Enable App Lock on Start</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="current_password">
+ <property name="text">
+ <string>Current Password:</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="1">
+ <widget class="Line" name="line_3">
+ <property name="minimumSize">
+ <size>
+ <width>1</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>1</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">background-color: rgba(63, 129, 216, 48);</string>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="notificationCheckBox">
+ <property name="text">
+ <string>Disable Notifications PopUp</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QCheckBox" name="autoPlayMediaCheckBox">
+ <property name="text">
+ <string>Disable Auto Playback of Media</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="muteAudioCheckBox">
+ <property name="text">
+ <string>Mute Audio from Page</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <layout class="QHBoxLayout" name="horizontalLayout_9">
+ <item>
+ <widget class="QLabel" name="label_14">
+ <property name="text">
+ <string>PopUp timeout</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="notificationTimeOutspinBox">
+ <property name="suffix">
+ <string> Secs</string>
+ </property>
+ <property name="minimum">
+ <number>2</number>
+ </property>
+ <property name="maximum">
+ <number>20</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
<item row="4" column="0">
<widget class="Line" name="line_2">
<property name="minimumSize">
@@ -203,6 +262,17 @@ background:transparent;
</property>
</widget>
</item>
+ <item row="3" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout_10">
+ <item>
+ <widget class="QCheckBox" name="useNativeFileDialog">
+ <property name="text">
+ <string>Use Native File Dialog</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
@@ -296,25 +366,112 @@ background:transparent;
</item>
</layout>
</item>
- <item row="5" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout_4">
- <property name="topMargin">
- <number>0</number>
+ <item row="0" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout_11">
+ <item>
+ <widget class="QLabel" name="label_16">
+ <property name="text">
+ <string>Notification type</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="notificationCombo">
+ <item>
+ <property name="text">
+ <string>Native notification</string>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/categories/featured.png</normaloff>:/icons/categories/featured.png</iconset>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Customized notification</string>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/categories/devices-and-iot.png</normaloff>:/icons/categories/devices-and-iot.png</iconset>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="tryNotification">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string> Try</string>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/categories/science.png</normaloff>:/icons/categories/science.png</iconset>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="11" column="0">
+ <widget class="Line" name="line_4">
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>1</height>
+ </size>
</property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>1</height>
+ </size>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">background-color: rgba(63, 129, 216, 48);</string>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="13" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
- <widget class="QCheckBox" name="applock_checkbox">
- <property name="toolTip">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enable application lock screen.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>User Agent</string>
</property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="userAgentLineEdit"/>
+ </item>
+ <item>
+ <widget class="QPushButton" name="setUserAgent">
<property name="text">
- <string>Enable App Lock on Start</string>
+ <string> Set</string>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/categories/utilities.png</normaloff>:/icons/categories/utilities.png</iconset>
</property>
</widget>
</item>
<item>
- <widget class="QLabel" name="current_password">
+ <widget class="QPushButton" name="defaultUserAgentButton">
<property name="text">
- <string>Current Password:</string>
+ <string> Default</string>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/refresh-line.png</normaloff>:/icons/refresh-line.png</iconset>
</property>
</widget>
</item>
@@ -369,60 +526,79 @@ background:transparent;
</item>
</layout>
</item>
- <item row="0" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout_11">
+ <item row="12" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout_12">
+ <property name="topMargin">
+ <number>0</number>
+ </property>
<item>
- <widget class="QLabel" name="label_16">
+ <widget class="QLabel" name="label_15">
<property name="text">
- <string>Notification type</string>
+ <string>Zoom factor</string>
</property>
</widget>
</item>
<item>
- <widget class="QComboBox" name="notificationCombo">
- <item>
- <property name="text">
- <string>Native notification</string>
- </property>
- <property name="icon">
- <iconset resource="icons.qrc">
- <normaloff>:/icons/categories/featured.png</normaloff>:/icons/categories/featured.png</iconset>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Customized notification</string>
- </property>
- <property name="icon">
- <iconset resource="icons.qrc">
- <normaloff>:/icons/categories/devices-and-iot.png</normaloff>:/icons/categories/devices-and-iot.png</iconset>
- </property>
- </item>
+ <widget class="QPushButton" name="zoomMinus">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>Zoom Out</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/minus.png</normaloff>:/icons/minus.png</iconset>
+ </property>
</widget>
</item>
<item>
- <widget class="QPushButton" name="tryNotification">
+ <widget class="QDoubleSpinBox" name="zoomFactorSpinBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ <property name="buttonSymbols">
+ <enum>QAbstractSpinBox::NoButtons</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="zoomPlus">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
+ <property name="toolTip">
+ <string>Zoom In</string>
+ </property>
<property name="text">
- <string> Try</string>
+ <string/>
</property>
<property name="icon">
<iconset resource="icons.qrc">
- <normaloff>:/icons/categories/science.png</normaloff>:/icons/categories/science.png</iconset>
+ <normaloff>:/icons/plus.png</normaloff>:/icons/plus.png</iconset>
</property>
</widget>
</item>
- </layout>
- </item>
- <item row="1" column="0">
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="1">
- <widget class="Line" name="line_3">
+ <item>
+ <widget class="Line" name="line_5">
<property name="minimumSize">
<size>
<width>1</width>
@@ -438,89 +614,31 @@ background:transparent;
<property name="styleSheet">
<string notr="true">background-color: rgba(63, 129, 216, 48);</string>
</property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
- <item row="0" column="0">
- <widget class="QCheckBox" name="notificationCheckBox">
- <property name="text">
- <string>Disable Notifications PopUp</string>
+ <item>
+ <widget class="QPushButton" name="zoomReset">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QCheckBox" name="autoPlayMediaCheckBox">
- <property name="text">
- <string>Disable Auto Playback of Media</string>
+ <property name="toolTip">
+ <string>reset</string>
</property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QCheckBox" name="muteAudioCheckBox">
<property name="text">
- <string>Mute Audio from Page</string>
+ <string/>
</property>
- </widget>
- </item>
- <item row="0" column="2">
- <layout class="QHBoxLayout" name="horizontalLayout_9">
- <item>
- <widget class="QLabel" name="label_14">
- <property name="text">
- <string>PopUp timeout</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="notificationTimeOutspinBox">
- <property name="suffix">
- <string> Secs</string>
- </property>
- <property name="minimum">
- <number>2</number>
- </property>
- <property name="maximum">
- <number>20</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- <item row="11" column="0">
- <widget class="Line" name="line_4">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>1</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>1</height>
- </size>
- </property>
- <property name="styleSheet">
- <string notr="true">background-color: rgba(63, 129, 216, 48);</string>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout_10">
- <item>
- <widget class="QCheckBox" name="useNativeFileDialog">
- <property name="text">
- <string>Use Native File Dialog</string>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/arrow-go-back-line.png</normaloff>:/icons/arrow-go-back-line.png</iconset>
</property>
</widget>
</item>