Add saving location change option, OAuth2 bugfix
This commit is contained in:
parent
d44aae4f43
commit
d3d6aa1bde
@ -4,6 +4,7 @@
|
|||||||
#include "ui_settingsdialog.h"
|
#include "ui_settingsdialog.h"
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
#include <QComboBox>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
@ -62,6 +63,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::Se
|
|||||||
ui->quickMode->setChecked(settings::settings().value("quickMode", false).toBool());
|
ui->quickMode->setChecked(settings::settings().value("quickMode", false).toBool());
|
||||||
ui->hideToTray->setChecked(settings::settings().value("hideOnClose", true).toBool());
|
ui->hideToTray->setChecked(settings::settings().value("hideOnClose", true).toBool());
|
||||||
ui->captureCursor->setChecked(settings::settings().value("captureCursor", true).toBool());
|
ui->captureCursor->setChecked(settings::settings().value("captureCursor", true).toBool());
|
||||||
|
ui->saveLocation->setCurrentIndex(settings::settings().value("saveLocation", 1).toInt());
|
||||||
for (int i = 0; i < (int)formats::Recording::None; i++) {
|
for (int i = 0; i < (int)formats::Recording::None; i++) {
|
||||||
ui->formatBox->addItem(formats::recordingFormatName(static_cast<formats::Recording>(i)));
|
ui->formatBox->addItem(formats::recordingFormatName(static_cast<formats::Recording>(i)));
|
||||||
}
|
}
|
||||||
@ -153,3 +155,7 @@ void SettingsDialog::on_pushButton_clicked() {
|
|||||||
a->setAttribute(Qt::WA_DeleteOnClose);
|
a->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
a->show();
|
a->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::on_saveLocation_currentIndexChanged(int index) {
|
||||||
|
settings::settings().setValue("saveLocation", index);
|
||||||
|
}
|
||||||
|
@ -17,7 +17,7 @@ public:
|
|||||||
~SettingsDialog();
|
~SettingsDialog();
|
||||||
void setScheme(QString scheme);
|
void setScheme(QString scheme);
|
||||||
|
|
||||||
public slots:
|
private slots:
|
||||||
void on_uploaderList_clicked(const QModelIndex &);
|
void on_uploaderList_clicked(const QModelIndex &);
|
||||||
void on_uploaderList_doubleClicked(const QModelIndex &);
|
void on_uploaderList_doubleClicked(const QModelIndex &);
|
||||||
void on_delay_valueChanged(double arg1);
|
void on_delay_valueChanged(double arg1);
|
||||||
@ -32,6 +32,7 @@ public slots:
|
|||||||
void on_nameScheme_textChanged(const QString &arg1);
|
void on_nameScheme_textChanged(const QString &arg1);
|
||||||
void newUploader(Uploader *u);
|
void newUploader(Uploader *u);
|
||||||
void uploaderChanged(QString newName);
|
void uploaderChanged(QString newName);
|
||||||
|
void on_saveLocation_currentIndexChanged(int index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::SettingsDialog *ui;
|
Ui::SettingsDialog *ui;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>483</width>
|
<width>483</width>
|
||||||
<height>470</height>
|
<height>530</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -17,21 +17,21 @@
|
|||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QListWidget" name="uploaderList"/>
|
<widget class="QListWidget" name="uploaderList"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="1">
|
<item row="8" column="1">
|
||||||
<widget class="QCheckBox" name="quickMode">
|
<widget class="QCheckBox" name="quickMode">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Quick mode (mouse release screenshots)</string>
|
<string>Quick mode (mouse release screenshots)</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="6" column="1">
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Delay before taking a screenshot</string>
|
<string>Delay before taking a screenshot</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1">
|
<item row="7" column="1">
|
||||||
<widget class="QDoubleSpinBox" name="delay">
|
<widget class="QDoubleSpinBox" name="delay">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>In seconds</string>
|
<string>In seconds</string>
|
||||||
@ -44,7 +44,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2" rowspan="5">
|
<item row="1" column="2" rowspan="7">
|
||||||
<widget class="QListWidget" name="hotkeys"/>
|
<widget class="QListWidget" name="hotkeys"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
@ -54,31 +54,31 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="11" column="1" colspan="2">
|
<item row="12" column="2">
|
||||||
|
<widget class="QComboBox" name="imageFormatBox"/>
|
||||||
|
</item>
|
||||||
|
<item row="13" column="1" colspan="2">
|
||||||
<widget class="QPushButton" name="pushButton">
|
<widget class="QPushButton" name="pushButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Encoder settings</string>
|
<string>Encoder settings</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="1">
|
<item row="12" column="1">
|
||||||
<widget class="QLabel" name="label_7">
|
<widget class="QLabel" name="label_7">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Still image format</string>
|
<string>Still image format</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="2">
|
<item row="11" column="1">
|
||||||
<widget class="QComboBox" name="imageFormatBox"/>
|
|
||||||
</item>
|
|
||||||
<item row="9" column="1">
|
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QLabel" name="label_4">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Recording format</string>
|
<string>Recording format</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="1" colspan="2">
|
<item row="9" column="1" colspan="2">
|
||||||
<widget class="QCheckBox" name="captureCursor">
|
<widget class="QCheckBox" name="captureCursor">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Capture cursor</string>
|
<string>Capture cursor</string>
|
||||||
@ -102,21 +102,21 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="1" colspan="2">
|
<item row="10" column="1" colspan="2">
|
||||||
<widget class="QCheckBox" name="hideToTray">
|
<widget class="QCheckBox" name="hideToTray">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Pressing <X> hides to tray</string>
|
<string>Pressing <X> hides to tray</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="2">
|
<item row="11" column="2">
|
||||||
<widget class="QComboBox" name="formatBox">
|
<widget class="QComboBox" name="formatBox">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>-1</number>
|
<number>-1</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="2">
|
<item row="8" column="2">
|
||||||
<widget class="QPushButton" name="settingsButton">
|
<widget class="QPushButton" name="settingsButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Open settings directory</string>
|
<string>Open settings directory</string>
|
||||||
@ -130,7 +130,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="12" column="1" colspan="2">
|
<item row="14" column="1" colspan="2">
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
@ -140,6 +140,27 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>File save location</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1">
|
||||||
|
<widget class="QComboBox" name="saveLocation">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Pictures folder</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Screenshots folder (In your user folder)</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
@ -19,7 +19,7 @@ using formats::recordingFormatMIME;
|
|||||||
using std::runtime_error;
|
using std::runtime_error;
|
||||||
|
|
||||||
void error(QString absFilePath, QString err) {
|
void error(QString absFilePath, QString err) {
|
||||||
throw runtime_error((QString("Invalid file: ").append(absFilePath) + ": " + err).toStdString());
|
throw runtime_erraor((QString("Invalid file: ").append(absFilePath) + ": " + err).toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomUploader::CustomUploader(QString absFilePath) {
|
CustomUploader::CustomUploader(QString absFilePath) {
|
||||||
|
@ -64,8 +64,8 @@ void ImgurUploader::doUpload(QByteArray byteArray, QString format) {
|
|||||||
if (settings::settings().contains("imgur/expire") //
|
if (settings::settings().contains("imgur/expire") //
|
||||||
&& settings::settings().contains("imgur/refresh") //
|
&& settings::settings().contains("imgur/refresh") //
|
||||||
&& settings::settings().contains("imgur/access")) {
|
&& settings::settings().contains("imgur/access")) {
|
||||||
QDateTime loltheseguysIminacallwithareretarded = settings::settings().value("imgur/expire").toDateTime();
|
QDateTime expireTime = settings::settings().value("imgur/expire").toDateTime();
|
||||||
if (loltheseguysIminacallwithareretarded.msecsTo(QDateTime::currentDateTimeUtc()) < 0) {
|
if (QDateTime::currentDateTimeUtc() > expireTime) {
|
||||||
new SegfaultWorkaround(byteArray, this, mime);
|
new SegfaultWorkaround(byteArray, this, mime);
|
||||||
} else
|
} else
|
||||||
handleSend("Bearer " + settings::settings().value("imgur/access").toString(), mime, byteArray);
|
handleSend("Bearer " + settings::settings().value("imgur/access").toString(), mime, byteArray);
|
||||||
|
@ -13,11 +13,23 @@
|
|||||||
#include <settings.hpp>
|
#include <settings.hpp>
|
||||||
#include <uploaders/default/imgplusuploader.hpp>
|
#include <uploaders/default/imgplusuploader.hpp>
|
||||||
|
|
||||||
UploaderSingleton::UploaderSingleton()
|
UploaderSingleton::UploaderSingleton() : QObject() {
|
||||||
: QObject(), saveDir(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)) {
|
switch (settings::settings().value("saveLocation", 1).toInt()) {
|
||||||
|
case 0:
|
||||||
|
saveDir = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
|
||||||
if (QStandardPaths::writableLocation(QStandardPaths::PicturesLocation).isEmpty()) {
|
if (QStandardPaths::writableLocation(QStandardPaths::PicturesLocation).isEmpty()) {
|
||||||
qFatal("Cannot determine location for pictures");
|
qFatal("Cannot determine location for pictures");
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (QStandardPaths::writableLocation(QStandardPaths::HomeLocation).isEmpty()) {
|
||||||
|
qFatal("Cannot determine location of your home directory");
|
||||||
|
}
|
||||||
|
saveDir = QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/Screenshots";
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!saveDir.exists()) {
|
if (!saveDir.exists()) {
|
||||||
if (!saveDir.mkpath(".")) {
|
if (!saveDir.mkpath(".")) {
|
||||||
qFatal("Could not create the path %s to store images in!", saveDir.absolutePath().toLocal8Bit().constData());
|
qFatal("Could not create the path %s to store images in!", saveDir.absolutePath().toLocal8Bit().constData());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user