Commit 5bafcb9d authored by Isa's avatar Isa Committed by Andreas Traczyk

ui/ux: shrink settings widget and move export/delete buttons

Change-Id: I9879630dd56563563ec9449f27a22d2f044e1004
parent 29fa5e0b
......@@ -25,8 +25,14 @@
<layout class="QVBoxLayout" name="verticalLayout" stretch="0">
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="minimumSize">
<size>
<width>600</width>
<height>0</height>
</size>
</property>
<property name="currentIndex">
<number>2</number>
<number>0</number>
</property>
<widget class="QWidget" name="start">
<widget class="QWidget" name="verticalLayoutWidget_2">
......@@ -38,7 +44,7 @@
<height>761</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="1,0,0,0,0,0,1">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
......@@ -72,6 +78,12 @@
</item>
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
......@@ -133,6 +145,12 @@
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>To add a new device, enter your account password:</string>
</property>
......@@ -170,6 +188,12 @@
</item>
<item>
<widget class="QLineEdit" name="passwordLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>250</width>
......@@ -216,6 +240,12 @@
</item>
<item>
<widget class="QPushButton" name="cancelBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Cancel</string>
</property>
......@@ -239,6 +269,12 @@
</item>
<item>
<widget class="QPushButton" name="enterBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Enter</string>
</property>
......@@ -285,7 +321,7 @@
<height>771</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="1,0,1">
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
......@@ -319,6 +355,12 @@
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Exporting account on the network</string>
</property>
......@@ -426,7 +468,7 @@
<height>771</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="1,0,0,0,0,1">
<item>
<spacer name="verticalSpacer_6">
<property name="orientation">
......@@ -457,6 +499,12 @@
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Your generated pin:</string>
</property>
......@@ -494,6 +542,12 @@
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
......@@ -545,6 +599,12 @@
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>This pin and the account password should be entered in your device within 5 minutes.</string>
</property>
......@@ -582,6 +642,12 @@
</item>
<item>
<widget class="QPushButton" name="closePushButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Close</string>
</property>
......
......@@ -25,6 +25,7 @@
#include <QInputDialog>
#include <QStandardPaths>
#include <QMessageBox>
#include <QSettings>
// account settings
#include "api/newdevicemodel.h"
......@@ -636,9 +637,10 @@ void
SettingsWidget::showCurrentAccountSlot()
{
disconnect(linkDevWidget);
delete linkDevWidget;
ui->centralWidget->show();
updateAndShowDevicesSlot();
}
void
......@@ -728,12 +730,12 @@ SettingsWidget::setConnections()
void SettingsWidget::populateGeneralSettings()
{
settings_ = new QSettings;
QSettings settings;
// settings
ui->downloadButton->setText(settings_->value(SettingsKey::downloadPath).toString());
ui->closeOrMinCheckBox->setChecked(settings_->value(SettingsKey::closeOrMinimized).toBool());
ui->notificationCheckBox->setChecked(settings_->value(SettingsKey::enableNotifications).toBool());
ui->downloadButton->setText(QString::fromStdString(LRCInstance::dataTransferModel().downloadDirectory));
ui->closeOrMinCheckBox->setChecked(settings.value(SettingsKey::closeOrMinimized).toBool());
ui->notificationCheckBox->setChecked(settings.value(SettingsKey::enableNotifications).toBool());
//recordings
ui->alwaysRecordingCheckBox->setChecked(media::RecordingModel::instance().isAlwaysRecording());
......@@ -751,21 +753,23 @@ void SettingsWidget::populateGeneralSettings()
void
SettingsWidget::setNotificationsSlot(int state)
{
QSettings settings;
if (state == Qt::CheckState::Unchecked) {
settings_->setValue(SettingsKey::enableNotifications, false);
settings.setValue(SettingsKey::enableNotifications, false);
} else {
settings_->setValue(SettingsKey::enableNotifications, true);
settings.setValue(SettingsKey::enableNotifications, true);
}
}
void
SettingsWidget::setClosedOrMinSlot(int state)
{
QSettings settings;
if (state == Qt::CheckState::Unchecked) {
settings_->setValue(SettingsKey::closeOrMinimized, false);
settings.setValue(SettingsKey::closeOrMinimized, false);
}
else {
settings_->setValue(SettingsKey::closeOrMinimized, true);
settings.setValue(SettingsKey::closeOrMinimized, true);
}
}
......@@ -796,13 +800,14 @@ SettingsWidget::setUpdateAutomaticSlot(int state)
void
SettingsWidget::openDownloadFolderSlot()
{
QSettings settings;
QString dir = QFileDialog::getExistingDirectory(this, tr("Select A Folder For Your Downloads"),
QStandardPaths::writableLocation(QStandardPaths::DownloadLocation), QFileDialog::ShowDirsOnly
| QFileDialog::DontResolveSymlinks);
if (!dir.isEmpty()) {
ui->downloadButton->setText(dir);
settings_->setValue(SettingsKey::downloadPath, dir);
settings.setValue(SettingsKey::downloadPath, dir);
LRCInstance::editableDataTransferModel()->downloadDirectory = dir.toStdString() + "/";
}
}
......
......@@ -18,7 +18,6 @@
#pragma once
#include <QScrollArea>
#include <QSettings>
#include <QMovie>
#include "navwidget.h"
......@@ -126,9 +125,6 @@ private slots:
// ************************* General Settings *************************
private:
void populateGeneralSettings();
QSettings* settings_;
QMetaObject::Connection accountAddedConnection_;
private slots:
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment