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 <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QDesktopServices>
|
||||
#include <QInputDialog>
|
||||
#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->hideToTray->setChecked(settings::settings().value("hideOnClose", 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++) {
|
||||
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->show();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_saveLocation_currentIndexChanged(int index) {
|
||||
settings::settings().setValue("saveLocation", index);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ public:
|
||||
~SettingsDialog();
|
||||
void setScheme(QString scheme);
|
||||
|
||||
public slots:
|
||||
private slots:
|
||||
void on_uploaderList_clicked(const QModelIndex &);
|
||||
void on_uploaderList_doubleClicked(const QModelIndex &);
|
||||
void on_delay_valueChanged(double arg1);
|
||||
@ -32,6 +32,7 @@ public slots:
|
||||
void on_nameScheme_textChanged(const QString &arg1);
|
||||
void newUploader(Uploader *u);
|
||||
void uploaderChanged(QString newName);
|
||||
void on_saveLocation_currentIndexChanged(int index);
|
||||
|
||||
private:
|
||||
Ui::SettingsDialog *ui;
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>483</width>
|
||||
<height>470</height>
|
||||
<height>530</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -17,21 +17,21 @@
|
||||
<item row="1" column="1">
|
||||
<widget class="QListWidget" name="uploaderList"/>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="8" column="1">
|
||||
<widget class="QCheckBox" name="quickMode">
|
||||
<property name="text">
|
||||
<string>Quick mode (mouse release screenshots)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="6" column="1">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Delay before taking a screenshot</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="7" column="1">
|
||||
<widget class="QDoubleSpinBox" name="delay">
|
||||
<property name="toolTip">
|
||||
<string>In seconds</string>
|
||||
@ -44,7 +44,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" rowspan="5">
|
||||
<item row="1" column="2" rowspan="7">
|
||||
<widget class="QListWidget" name="hotkeys"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
@ -54,31 +54,31 @@
|
||||
</property>
|
||||
</widget>
|
||||
</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">
|
||||
<property name="text">
|
||||
<string>Encoder settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<item row="12" column="1">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Still image format</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="2">
|
||||
<widget class="QComboBox" name="imageFormatBox"/>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<item row="11" column="1">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Recording format</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1" colspan="2">
|
||||
<item row="9" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="captureCursor">
|
||||
<property name="text">
|
||||
<string>Capture cursor</string>
|
||||
@ -102,21 +102,21 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1" colspan="2">
|
||||
<item row="10" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="hideToTray">
|
||||
<property name="text">
|
||||
<string>Pressing <X> hides to tray</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="2">
|
||||
<item row="11" column="2">
|
||||
<widget class="QComboBox" name="formatBox">
|
||||
<property name="currentIndex">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<item row="8" column="2">
|
||||
<widget class="QPushButton" name="settingsButton">
|
||||
<property name="text">
|
||||
<string>Open settings directory</string>
|
||||
@ -130,7 +130,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1" colspan="2">
|
||||
<item row="14" column="1" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -140,6 +140,27 @@
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
@ -19,7 +19,7 @@ using formats::recordingFormatMIME;
|
||||
using std::runtime_error;
|
||||
|
||||
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) {
|
||||
|
@ -64,8 +64,8 @@ void ImgurUploader::doUpload(QByteArray byteArray, QString format) {
|
||||
if (settings::settings().contains("imgur/expire") //
|
||||
&& settings::settings().contains("imgur/refresh") //
|
||||
&& settings::settings().contains("imgur/access")) {
|
||||
QDateTime loltheseguysIminacallwithareretarded = settings::settings().value("imgur/expire").toDateTime();
|
||||
if (loltheseguysIminacallwithareretarded.msecsTo(QDateTime::currentDateTimeUtc()) < 0) {
|
||||
QDateTime expireTime = settings::settings().value("imgur/expire").toDateTime();
|
||||
if (QDateTime::currentDateTimeUtc() > expireTime) {
|
||||
new SegfaultWorkaround(byteArray, this, mime);
|
||||
} else
|
||||
handleSend("Bearer " + settings::settings().value("imgur/access").toString(), mime, byteArray);
|
||||
|
@ -13,11 +13,23 @@
|
||||
#include <settings.hpp>
|
||||
#include <uploaders/default/imgplusuploader.hpp>
|
||||
|
||||
UploaderSingleton::UploaderSingleton()
|
||||
: QObject(), saveDir(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)) {
|
||||
if (QStandardPaths::writableLocation(QStandardPaths::PicturesLocation).isEmpty()) {
|
||||
qFatal("Cannot determine location for pictures");
|
||||
UploaderSingleton::UploaderSingleton() : QObject() {
|
||||
switch (settings::settings().value("saveLocation", 1).toInt()) {
|
||||
case 0:
|
||||
saveDir = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
|
||||
if (QStandardPaths::writableLocation(QStandardPaths::PicturesLocation).isEmpty()) {
|
||||
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.mkpath(".")) {
|
||||
qFatal("Could not create the path %s to store images in!", saveDir.absolutePath().toLocal8Bit().constData());
|
||||
|
Loading…
x
Reference in New Issue
Block a user