diff --git a/flameshot.pro b/flameshot.pro index 93a4e828..86ba63b3 100644 --- a/flameshot.pro +++ b/flameshot.pro @@ -85,6 +85,7 @@ DEFINES += QAPPLICATION_CLASS=QApplication SOURCES += src/main.cpp \ src/config/filepathconfiguration.cpp \ + src/tools/imgs3/imgs3settings.cpp \ src/widgets/historywidget.cpp \ src/utils/configenterprise.cpp \ src/utils/history.cpp \ @@ -164,6 +165,7 @@ SOURCES += src/main.cpp \ HEADERS += src/widgets/capture/buttonhandler.h \ src/config/filepathconfiguration.h \ + src/tools/imgs3/imgs3settings.h \ src/widgets/historywidget.h \ src/utils/configenterprise.h \ src/utils/history.h \ diff --git a/graphics.qrc b/graphics.qrc index 87a2a790..43919bdc 100644 --- a/graphics.qrc +++ b/graphics.qrc @@ -2,6 +2,7 @@ img/app/flameshot.svg img/app/flameshot.png + img/material/black/delete.svg img/material/black/undo-variant.svg img/material/black/text.svg img/material/black/square.svg diff --git a/img/material/black/delete.png b/img/material/black/delete.png new file mode 100644 index 00000000..024a1100 Binary files /dev/null and b/img/material/black/delete.png differ diff --git a/img/material/black/delete.svg b/img/material/black/delete.svg new file mode 100644 index 00000000..0fcbb634 --- /dev/null +++ b/img/material/black/delete.svg @@ -0,0 +1,7 @@ + + + + + Svg Vector Icons : http://www.onlinewebfonts.com/icon + + \ No newline at end of file diff --git a/src/tools/imgs3/imgs3settings.cpp b/src/tools/imgs3/imgs3settings.cpp new file mode 100644 index 00000000..41695aee --- /dev/null +++ b/src/tools/imgs3/imgs3settings.cpp @@ -0,0 +1,34 @@ +#include "imgs3settings.h" +#include "src/utils/configenterprise.h" +#include + +ImgS3Settings::ImgS3Settings() +{ + m_configEnterprise = new ConfigEnterprise(); + + // get s3 credentials + QSettings *settings = m_configEnterprise->settings(); + settings->beginGroup("S3"); + + m_credsUrl = settings->value("S3_CREDS_URL").toString(); + m_credsUrl = m_credsUrl + ((m_credsUrl.length() > 0 && m_credsUrl[m_credsUrl.length() - 1] == '/') ? "" : "/") + S3_API_IMG_PATH; + + m_xApiKey = settings->value("S3_X_API_KEY").toString(); + + m_url = settings->value("S3_URL").toString(); + m_url = m_url + ((m_url.length() > 0 && m_url[m_url.length() - 1] == '/') ? "" : "/"); + + settings->endGroup(); +} + +const QString &ImgS3Settings::credsUrl() { + return m_credsUrl; +} + +const QString &ImgS3Settings::xApiKey() { + return m_xApiKey; +} + +const QString &ImgS3Settings::url() { + return m_url; +} diff --git a/src/tools/imgs3/imgs3settings.h b/src/tools/imgs3/imgs3settings.h new file mode 100644 index 00000000..d44b79e2 --- /dev/null +++ b/src/tools/imgs3/imgs3settings.h @@ -0,0 +1,27 @@ +#ifndef IMGS3SETTINGS_H +#define IMGS3SETTINGS_H + +#define S3_API_IMG_PATH "v2/image/" + + +#include + +class ConfigEnterprise; + +class ImgS3Settings +{ +public: + ImgS3Settings(); + + const QString &credsUrl(); + const QString &xApiKey(); + const QString &url(); + +private: + ConfigEnterprise *m_configEnterprise; + QString m_credsUrl; + QString m_xApiKey; + QString m_url; +}; + +#endif // IMGS3SETTINGS_H diff --git a/src/tools/imgs3/imgs3uploader.cpp b/src/tools/imgs3/imgs3uploader.cpp index 6357a7b5..4231d6e9 100644 --- a/src/tools/imgs3/imgs3uploader.cpp +++ b/src/tools/imgs3/imgs3uploader.cpp @@ -50,15 +50,31 @@ ImgS3Uploader::ImgS3Uploader(const QPixmap &capture, QWidget *parent) : QWidget(parent), m_pixmap(capture) { + init(tr("Upload image to S3"), tr("Uploading Image")); +} + +ImgS3Uploader::ImgS3Uploader(QWidget *parent) : + QWidget(parent) +{ + init(tr("Delete image from S3"), tr("Deleting image...")); +} + +void ImgS3Uploader::init(const QString &title, const QString &label) { m_proxy = nullptr; - setWindowTitle(tr("Upload to ImgS3")); + + m_imageLabel = nullptr; + m_spinner = nullptr; + + m_success = false; + setWindowTitle(title); setWindowIcon(QIcon(":img/app/flameshot.svg")); m_spinner = new LoadSpinner(this); m_spinner->setColor(ConfigHandler().uiMainColorValue()); m_spinner->start(); - m_infoLabel = new QLabel(tr("Uploading Image")); + m_infoLabel = new QLabel(label); + m_infoLabel->setAlignment(Qt::AlignCenter); m_vLayout = new QVBoxLayout(); setLayout(m_vLayout); @@ -71,23 +87,19 @@ ImgS3Uploader::ImgS3Uploader(const QPixmap &capture, QWidget *parent) : m_configEnterprise = new ConfigEnterprise(); // get s3 credentials - QSettings *settings = m_configEnterprise->settings(); - settings->beginGroup("S3"); - m_s3CredsUrl = settings->value("S3_CREDS_URL").toString(); - m_s3XApiKey = settings->value("S3_X_API_KEY").toString(); - settings->endGroup(); - initNetwork(); - upload(); } void ImgS3Uploader::initNetwork() { // Init network - m_NetworkAM = new QNetworkAccessManager(this); - connect(m_NetworkAM, &QNetworkAccessManager::finished, this, &ImgS3Uploader::handleReply); + m_NetworkAMUpload = new QNetworkAccessManager(this); + connect(m_NetworkAMUpload, &QNetworkAccessManager::finished, this, &ImgS3Uploader::handleReplyUpload); - m_NetworkAMCreds = new QNetworkAccessManager(this); - connect(m_NetworkAMCreds, &QNetworkAccessManager::finished, this, &ImgS3Uploader::handleCredsReply); + m_NetworkAMGetCreds = new QNetworkAccessManager(this); + connect(m_NetworkAMGetCreds, &QNetworkAccessManager::finished, this, &ImgS3Uploader::handleReplyGetCreds); + + m_NetworkAMRemove = new QNetworkAccessManager(this); + connect(m_NetworkAMRemove, &QNetworkAccessManager::finished, this, &ImgS3Uploader::handleReplyDeleteResource); // get proxy settings from "config.ini" file QSettings *settings = m_configEnterprise->settings(); @@ -137,7 +149,7 @@ void ImgS3Uploader::initNetwork() { } else { // Get proxy settings from OS settings - QNetworkProxyQuery q(QUrl(m_s3CredsUrl.toUtf8())); + QNetworkProxyQuery q(QUrl(m_s3Settings.credsUrl().toUtf8())); q.setQueryType(QNetworkProxyQuery::UrlRequest); q.setProtocolTag("http"); @@ -160,10 +172,10 @@ void ImgS3Uploader::initNetwork() { qDebug() << "proxy user:" << (m_proxy->user().length() > 0 ? m_proxy->user() : "no user"); qDebug() << "proxy password:" << (m_proxy->password().length() > 0 ? "***" : "no password"); - QNetworkProxy::setApplicationProxy(*m_proxy); - m_NetworkAM->setProxy(*m_proxy); - m_NetworkAMCreds->setProxy(*m_proxy); + m_NetworkAMUpload->setProxy(*m_proxy); + m_NetworkAMGetCreds->setProxy(*m_proxy); + m_NetworkAMRemove->setProxy(*m_proxy); } else { qDebug() << "No proxy"; @@ -171,29 +183,56 @@ void ImgS3Uploader::initNetwork() { } -void ImgS3Uploader::handleReply(QNetworkReply *reply) { - m_spinner->deleteLater(); +void ImgS3Uploader::handleReplyUpload(QNetworkReply *reply) { + hideSpinner(); + m_s3ImageName.clear(); if (reply->error() == QNetworkReply::NoError) { // save history QString imageName = m_imageURL.toString(); int lastSlash = imageName.lastIndexOf("/"); if (lastSlash >= 0) { - imageName = imageName.mid(lastSlash); + imageName = imageName.mid(lastSlash + 1); } + m_s3ImageName = imageName; History history; + imageName = history.packFileName(SCREENSHOT_STORAGE_TYPE_S3, m_deleteToken, imageName); history.save(m_pixmap, imageName); + m_success = true; // Copy url to clipboard if required if (ConfigHandler().copyAndCloseAfterUploadEnabled()) { QApplication::clipboard()->setText(m_imageURL.toString()); - SystemNotification().sendMessage(QObject::tr("URL copied to clipboard.")); + SystemNotification().sendMessage(tr("URL copied to clipboard.")); close(); } else { onUploadOk(); } } else { QString reason = reply->attribute( QNetworkRequest::HttpReasonPhraseAttribute ).toString(); - m_infoLabel->setText(reply->errorString()); + setInfoLabelText(reply->errorString()); + } + new QShortcut(Qt::Key_Escape, this, SLOT(close())); +} + +void ImgS3Uploader::handleReplyDeleteResource(QNetworkReply *reply) { + if (reply->error() == QNetworkReply::NoError) { + m_success = true; + + // remove local file + History history; + QString packedFileName = history.packFileName(SCREENSHOT_STORAGE_TYPE_S3, m_deleteToken, m_s3ImageName); + QString fullFileName = history.path() + packedFileName; + + QFile file(fullFileName); + if (file.exists()) { + file.remove(); + } + m_deleteToken.clear(); + m_s3ImageName.clear(); + close(); + } else { + QString reason = reply->attribute( QNetworkRequest::HttpReasonPhraseAttribute ).toString(); + setInfoLabelText(reply->errorString()); } new QShortcut(Qt::Key_Escape, this, SLOT(close())); } @@ -210,94 +249,40 @@ void ImgS3Uploader::startDrag() { dragHandler->exec(); } -void ImgS3Uploader::handleCredsReply(QNetworkReply *reply){ +void ImgS3Uploader::handleReplyGetCreds(QNetworkReply *reply){ if (reply->error() == QNetworkReply::NoError) { QJsonDocument response = QJsonDocument::fromJson(reply->readAll()); uploadToS3(response); } else { - if(m_s3CredsUrl.length() == 0){ - m_infoLabel->setText("S3 Creds URL is not found in your configuration file"); + if(m_s3Settings.credsUrl().length() == 0){ + setInfoLabelText(tr("S3 Creds URL is not found in your configuration file")); } else { - m_infoLabel->setText(reply->errorString()); + setInfoLabelText(reply->errorString()); } } new QShortcut(Qt::Key_Escape, this, SLOT(close())); } void ImgS3Uploader::uploadToS3(QJsonDocument &response) { - QJsonObject json = response.object(); - QJsonObject formData = json["formData"].toObject(); - QJsonObject fields = formData["fields"].toObject(); - - QString resultURL = json["resultURL"].toString(); - - QString url = formData["url"].toString(); - - QString acl = fields["acl"].toString(); - QString contentType = fields["Content-Type"].toString(); - QString key = fields["Key"].toString(); - QString bucket = fields["bucket"].toString(); - QString xAmzAlgorithm = fields["X-Amz-Algorithm"].toString(); - QString xAmzCredential = fields["X-Amz-Credential"].toString(); - QString xAmzDate = fields["X-Amz-Date"].toString(); - QString xAmzSecurityToken = fields["X-Amz-Security-Token"].toString(); - QString policy = fields["Policy"].toString(); - QString xAmzSignature = fields["X-Amz-Signature"].toString(); - - // + // set paramets from "fields" QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType); - QHttpPart aclPart; - aclPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"acl\"")); - aclPart.setBody(acl.toLatin1()); - multiPart->append(aclPart); - - QHttpPart contentTypePart; - contentTypePart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"Content-Type\"")); - contentTypePart.setBody(contentType.toLatin1()); - multiPart->append(contentTypePart); - - QHttpPart keyPart; - keyPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"Key\"")); - keyPart.setBody(key.toLatin1()); - multiPart->append(keyPart); - - QHttpPart bucketPart; - bucketPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"bucket\"")); - bucketPart.setBody(bucket.toLatin1()); - multiPart->append(bucketPart); - - QHttpPart xAmzAlgorithmPart; - xAmzAlgorithmPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"X-Amz-Algorithm\"")); - xAmzAlgorithmPart.setBody(xAmzAlgorithm.toLatin1()); - multiPart->append(xAmzAlgorithmPart); - - QHttpPart xAmzCredentialPart; - xAmzCredentialPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"X-Amz-Credential\"")); - xAmzCredentialPart.setBody(xAmzCredential.toLatin1()); - multiPart->append(xAmzCredentialPart); - - QHttpPart xAmzDatePart; - xAmzDatePart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"X-Amz-Date\"")); - xAmzDatePart.setBody(xAmzDate.toLatin1()); - multiPart->append(xAmzDatePart); - - QHttpPart xAmzSecurityTokenPart; - xAmzSecurityTokenPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"X-Amz-Security-Token\"")); - xAmzSecurityTokenPart.setBody(xAmzSecurityToken.toLatin1()); - multiPart->append(xAmzSecurityTokenPart); - - QHttpPart policyPart; - policyPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"Policy\"")); - policyPart.setBody(policy.toLatin1()); - multiPart->append(policyPart); - - QHttpPart xAmzSignaturePart; - xAmzSignaturePart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"X-Amz-Signature\"")); - xAmzSignaturePart.setBody(xAmzSignature.toLatin1()); - multiPart->append(xAmzSignaturePart); + // read JSON response + QJsonObject json = response.object(); + QString resultURL = json["resultURL"].toString(); + QJsonObject formData = json["formData"].toObject(); + QString url = formData["url"].toString(); + m_deleteToken = json["deleteToken"].toString(); + QJsonObject fields = formData["fields"].toObject(); + foreach (auto key, fields.keys()) { + QString field = fields[key].toString(); + QHttpPart part; + part.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"" + key + "\"")); + part.setBody(field.toLatin1()); + multiPart->append(part); + } QHttpPart imagePart; imagePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("image/png")); @@ -316,45 +301,64 @@ void ImgS3Uploader::uploadToS3(QJsonDocument &response) { QUrl qUrl(url); QNetworkRequest request(qUrl); - m_NetworkAM->post(request, multiPart); + m_NetworkAMUpload->post(request, multiPart); +} + +void ImgS3Uploader::deleteResource(const QString &fileName, const QString &deleteToken) { + QNetworkRequest request; + m_s3ImageName = fileName; + m_deleteToken = deleteToken; + request.setUrl(m_s3Settings.credsUrl().toUtf8() + fileName); + request.setRawHeader("X-API-Key", m_s3Settings.xApiKey().toLatin1()); + request.setRawHeader("Authorization", "Bearer " + deleteToken.toLatin1()); + m_NetworkAMRemove->deleteResource(request); } void ImgS3Uploader::upload() { + m_deleteToken.clear(); + m_s3ImageName.clear(); + // get creads - QUrl creds(m_s3CredsUrl); + QUrl creds(m_s3Settings.credsUrl()); QNetworkRequest requestCreds(creds); - if(m_s3XApiKey.length() > 0) { - requestCreds.setRawHeader(QByteArray("X-API-Key"), QByteArray(m_s3XApiKey.toLocal8Bit())); + if(m_s3Settings.xApiKey().length() > 0) { + requestCreds.setRawHeader(QByteArray("X-API-Key"), QByteArray(m_s3Settings.xApiKey().toLocal8Bit())); } - m_NetworkAMCreds->get(requestCreds); + m_NetworkAMGetCreds->get(requestCreds); } void ImgS3Uploader::onUploadOk() { - m_infoLabel->deleteLater(); + hideSpinner(); m_notification = new NotificationWidget(); m_vLayout->addWidget(m_notification); - ImageLabel *imageLabel = new ImageLabel(); - imageLabel->setScreenshot(m_pixmap); - imageLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - connect(imageLabel, &ImageLabel::dragInitiated, this, &ImgS3Uploader::startDrag); - m_vLayout->addWidget(imageLabel); + if(nullptr == m_imageLabel) { + m_imageLabel = new ImageLabel(); + m_imageLabel->setScreenshot(m_pixmap); + m_imageLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + connect(m_imageLabel, &ImageLabel::dragInitiated, this, &ImgS3Uploader::startDrag); + m_vLayout->addWidget(m_imageLabel); + } m_hLayout = new QHBoxLayout(); m_vLayout->addLayout(m_hLayout); m_copyUrlButton = new QPushButton(tr("Copy URL")); m_openUrlButton = new QPushButton(tr("Open URL")); + m_deleteImageOnS3 = new QPushButton(tr("Delete image")); m_toClipboardButton = new QPushButton(tr("Image to Clipboard.")); m_hLayout->addWidget(m_copyUrlButton); m_hLayout->addWidget(m_openUrlButton); + m_hLayout->addWidget(m_deleteImageOnS3); m_hLayout->addWidget(m_toClipboardButton); connect(m_copyUrlButton, &QPushButton::clicked, this, &ImgS3Uploader::copyURL); connect(m_openUrlButton, &QPushButton::clicked, this, &ImgS3Uploader::openURL); + connect(m_deleteImageOnS3, &QPushButton::clicked, + this, &ImgS3Uploader::deleteImageOnS3); connect(m_toClipboardButton, &QPushButton::clicked, this, &ImgS3Uploader::copyImage); } @@ -375,3 +379,30 @@ void ImgS3Uploader::copyImage() { QApplication::clipboard()->setPixmap(m_pixmap); m_notification->showMessage(tr("Screenshot copied to clipboard.")); } + +void ImgS3Uploader::deleteImageOnS3() { + if(nullptr != m_imageLabel) { + m_imageLabel->hide(); + } + m_spinner->show(); + setInfoLabelText(tr("Deleting image...")); + deleteResource(m_s3ImageName, m_deleteToken); +} + +bool ImgS3Uploader::success() { + return m_success; +} + +void ImgS3Uploader::hideSpinner() { + if(nullptr != m_spinner) { + m_spinner->hide(); + } + if(nullptr != m_imageLabel) { + m_imageLabel->hide(); + } +} + +void ImgS3Uploader::setInfoLabelText(const QString &infoText) { + m_infoLabel->setText(infoText); + m_infoLabel->show(); +} diff --git a/src/tools/imgs3/imgs3uploader.h b/src/tools/imgs3/imgs3uploader.h index 3df0a224..9c90e207 100644 --- a/src/tools/imgs3/imgs3uploader.h +++ b/src/tools/imgs3/imgs3uploader.h @@ -17,6 +17,9 @@ #pragma once +#define S3_API_IMG_PATH "v2/image/" + +#include "imgs3settings.h" #include #include @@ -31,35 +34,53 @@ class QPushButton; class QUrl; class NotificationWidget; class ConfigEnterprise; +class ImageLabel; class ImgS3Uploader : public QWidget { Q_OBJECT public: explicit ImgS3Uploader(const QPixmap &capture, QWidget *parent = nullptr); + explicit ImgS3Uploader(QWidget *parent = nullptr); + void upload(); + void deleteResource(const QString &, const QString &); + bool success(); private slots: - void handleReply(QNetworkReply *reply); - void handleCredsReply(QNetworkReply *reply); + void handleReplyUpload(QNetworkReply *reply); + void handleReplyGetCreds(QNetworkReply *reply); + void handleReplyDeleteResource(QNetworkReply *reply); void startDrag(); void openURL(); void copyURL(); void copyImage(); + void deleteImageOnS3(); private: + void init(const QString &title, const QString &label); void uploadToS3(QJsonDocument &response); void initNetwork(); + void onUploadOk(); + + void hideSpinner(); + void setInfoLabelText(const QString &); + + +// class members private: + bool m_success; ConfigEnterprise *m_configEnterprise; - QString m_s3CredsUrl; - QString m_s3XApiKey; + ImgS3Settings m_s3Settings; + + ImageLabel *m_imageLabel; QString m_hostName; QPixmap m_pixmap; QNetworkProxy *m_proxy; - QNetworkAccessManager *m_NetworkAM; - QNetworkAccessManager *m_NetworkAMCreds; + QNetworkAccessManager *m_NetworkAMUpload; + QNetworkAccessManager *m_NetworkAMGetCreds; + QNetworkAccessManager *m_NetworkAMRemove; QVBoxLayout *m_vLayout; QHBoxLayout *m_hLayout; @@ -70,9 +91,11 @@ private: QPushButton *m_openUrlButton; QPushButton *m_copyUrlButton; QPushButton *m_toClipboardButton; + QPushButton *m_deleteImageOnS3; QUrl m_imageURL; NotificationWidget *m_notification; - void upload(); - void onUploadOk(); + // Temporary variables + QString m_deleteToken; + QString m_s3ImageName; }; diff --git a/src/tools/imgs3/imgs3uploadertool.cpp b/src/tools/imgs3/imgs3uploadertool.cpp index 99bf1856..45f04aaf 100644 --- a/src/tools/imgs3/imgs3uploadertool.cpp +++ b/src/tools/imgs3/imgs3uploadertool.cpp @@ -47,7 +47,9 @@ QString ImgS3UploaderTool::description() const { } QWidget *ImgS3UploaderTool::widget() { - return new ImgS3Uploader(capture); + ImgS3Uploader *p = new ImgS3Uploader(capture); + p->upload(); + return p; } void ImgS3UploaderTool::setCapture(const QPixmap &pixmap) { diff --git a/src/utils/history.cpp b/src/utils/history.cpp index 4cade7a8..c58c6d60 100644 --- a/src/utils/history.cpp +++ b/src/utils/history.cpp @@ -3,6 +3,7 @@ #include #include #include +#include History::History() @@ -28,11 +29,7 @@ const QString &History::path() { void History::save(const QPixmap &pixmap, const QString &fileName) { QFile file(path() + fileName); file.open(QIODevice::WriteOnly); - pixmap.scaled(HISTORY_THUNB_WIDTH, - HISTORY_THUNB_HEIGH, - Qt::KeepAspectRatio, - Qt::SmoothTransformation - ).save(&file, "PNG"); + pixmap.save(&file, "PNG"); history(); } @@ -52,3 +49,45 @@ const QList &History::history() { } return m_thumbs; } + +const HISTORY_FILE_NAME &History::unpackFileName(const QString &fileNamePacked) { + int nPathIndex = fileNamePacked.lastIndexOf("/"); + QStringList unpackedFileName; + if(nPathIndex == -1) { + unpackedFileName = fileNamePacked.split("-"); + } else { + unpackedFileName = fileNamePacked.mid(nPathIndex + 1).split("-"); + } + + switch (unpackedFileName.length()) { + case 3: + m_unpackedFileName.file = unpackedFileName[2]; + m_unpackedFileName.token = unpackedFileName[1]; + m_unpackedFileName.type = unpackedFileName[0]; + break; + case 2: + m_unpackedFileName.file = unpackedFileName[1]; + m_unpackedFileName.token = ""; + m_unpackedFileName.type = unpackedFileName[0]; + break; + default: + m_unpackedFileName.file = unpackedFileName[0]; + m_unpackedFileName.token = ""; + m_unpackedFileName.type = SCREENSHOT_STORAGE_TYPE_LOCAL; + break; + } + return m_unpackedFileName; +} + +const QString &History::packFileName(const QString &storageType, const QString &deleteToken, const QString &fileName) { + m_packedFileName = fileName; + if(storageType.length() > 0) { + if(deleteToken.length() > 0) { + m_packedFileName = storageType + "-" + deleteToken + "-" + m_packedFileName; + } + else { + m_packedFileName = storageType + "-" + m_packedFileName; + } + } + return m_packedFileName; +} diff --git a/src/utils/history.h b/src/utils/history.h index 6a2fc686..fc111615 100644 --- a/src/utils/history.h +++ b/src/utils/history.h @@ -1,16 +1,23 @@ #ifndef HISTORY_H #define HISTORY_H -#define HISTORY_MAX_SIZE 10 -#define HISTORY_THUNB_SCALE 1.5 -#define HISTORY_THUNB_WIDTH 160*HISTORY_THUNB_SCALE -#define HISTORY_THUNB_HEIGH 90*HISTORY_THUNB_SCALE +#define HISTORY_MAX_SIZE 25 #include #include #include +#define SCREENSHOT_STORAGE_TYPE_LOCAL "" +#define SCREENSHOT_STORAGE_TYPE_S3 "s3" +#define SCREENSHOT_STORAGE_TYPE_IMGUR "imgur" + +struct HISTORY_FILE_NAME { + QString file; + QString token; + QString type; +}; + class History { public: @@ -20,9 +27,16 @@ public: const QList &history(); const QString &path(); + const HISTORY_FILE_NAME &unpackFileName(const QString &); + const QString &packFileName(const QString &, const QString &, const QString &); + private: QString m_historyPath; QList m_thumbs; + + // temporary variables + QString m_packedFileName; + HISTORY_FILE_NAME m_unpackedFileName; }; #endif // HISTORY_H diff --git a/src/widgets/historywidget.cpp b/src/widgets/historywidget.cpp index 20b8140f..138069a9 100644 --- a/src/widgets/historywidget.cpp +++ b/src/widgets/historywidget.cpp @@ -1,7 +1,7 @@ #include "historywidget.h" #include "src/utils/history.h" -#include "src/utils/configenterprise.h" #include "src/widgets/notificationwidget.h" +#include "src/tools/imgs3/imgs3uploader.h" #include #include #include @@ -18,12 +18,13 @@ #include #include #include +#include HistoryWidget::HistoryWidget(QWidget *parent) : QDialog(parent) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - setWindowTitle(tr("Screenshots history")); + setWindowTitle(tr("Latest Uploads")); setFixedSize(800, this->height()); m_notification = new NotificationWidget(); @@ -43,88 +44,146 @@ HistoryWidget::HistoryWidget(QWidget *parent) : QDialog(parent) } void HistoryWidget::loadHistory() { + // read history files History history = History(); QList historyFiles = history.history(); - ConfigEnterprise configEnterprise; - QSettings *settings = configEnterprise.settings(); - settings->beginGroup("S3"); - QString s3BaseUrl = settings->value("S3_URL").toString(); - settings->endGroup(); - if(historyFiles.isEmpty()) { - QPushButton *buttonEmpty = new QPushButton; - buttonEmpty->setText(tr("Screenshots history is empty")); - buttonEmpty->setMinimumSize(1, HISTORYPIXMAP_MAX_PREVIEW_HEIGHT); - connect(buttonEmpty, &QPushButton::clicked, this, [=](){ - this->close(); - }); - m_pVBox->addWidget(buttonEmpty); - return; + setEmptyMessage(); } - foreach(QString fileName, historyFiles) { - // generate url - QString fullFileName = history.path() + fileName; - QString url = s3BaseUrl + fileName; - - // load pixmap - QPixmap pixmap; - pixmap.load( fullFileName, "png" ); - - if (pixmap.height() / HISTORYPIXMAP_MAX_PREVIEW_HEIGHT >= pixmap.width() / HISTORYPIXMAP_MAX_PREVIEW_WIDTH) { - pixmap = pixmap.scaledToHeight(HISTORYPIXMAP_MAX_PREVIEW_HEIGHT); - } else { - pixmap = pixmap.scaledToWidth(HISTORYPIXMAP_MAX_PREVIEW_WIDTH); + else { + // generate history list + foreach(QString fileName, historyFiles) { + addLine(history.path(), fileName); } - - // get file info - QFileInfo *pFileInfo = new QFileInfo(fullFileName); - QString lastModified = pFileInfo->lastModified().toString(" yyyy-MM-dd hh:mm:ss"); - - // screenshot preview - QLabel *pScreenshot = new QLabel(); - pScreenshot->setStyleSheet("padding: 5px;"); - pScreenshot->setMinimumHeight(HISTORYPIXMAP_MAX_PREVIEW_HEIGHT); - pScreenshot->setPixmap(pixmap); - - // screenshot datetime - QLabel *pScreenshotText = new QLabel(); - pScreenshotText->setStyleSheet("padding: 5px;"); - pScreenshotText->setMinimumHeight(HISTORYPIXMAP_MAX_PREVIEW_HEIGHT); - pScreenshotText->setText(lastModified); - - // copy url - QPushButton *buttonCopyUrl = new QPushButton; - buttonCopyUrl->setText(tr("Copy URL")); - buttonCopyUrl->setMinimumHeight(HISTORYPIXMAP_MAX_PREVIEW_HEIGHT); - connect(buttonCopyUrl, &QPushButton::clicked, this, [=](){ - QApplication::clipboard()->setText(url); - m_notification->showMessage(tr("URL copied to clipboard.")); - this->close(); - }); - - // open in browser - QPushButton *buttonOpen = new QPushButton; - buttonOpen->setText(tr("Open in browser")); - buttonOpen->setMinimumHeight(HISTORYPIXMAP_MAX_PREVIEW_HEIGHT); - connect(buttonOpen, &QPushButton::clicked, this, [=](){ - QDesktopServices::openUrl(QUrl(url)); - this->close(); - }); - - // layout - QHBoxLayout *phbl = new QHBoxLayout(); - phbl->addWidget(pScreenshot); - phbl->addWidget(pScreenshotText); - phbl->addWidget(buttonCopyUrl); - phbl->addWidget(buttonOpen); - - phbl->setStretchFactor(pScreenshot, 3); - phbl->setStretchFactor(pScreenshotText, 2); - phbl->setStretchFactor(buttonCopyUrl, 2); - phbl->setStretchFactor(buttonOpen, 2); - - // add to scroll - m_pVBox->addLayout(phbl); + } +} + +void HistoryWidget::setEmptyMessage() { + QPushButton *buttonEmpty = new QPushButton; + buttonEmpty->setText(tr("Screenshots history is empty")); + buttonEmpty->setMinimumSize(1, HISTORYPIXMAP_MAX_PREVIEW_HEIGHT); + connect(buttonEmpty, &QPushButton::clicked, this, [=](){ + this->close(); + }); + m_pVBox->addWidget(buttonEmpty); +} + +void HistoryWidget::addLine(const QString &path, const QString& fileName) { + QHBoxLayout *phbl = new QHBoxLayout(); + QString fullFileName = path + fileName; + + History history; + HISTORY_FILE_NAME unpackFileName = history.unpackFileName(fileName); + + QString url = m_s3Settings.url() + unpackFileName.file; + + // load pixmap + QPixmap pixmap; + pixmap.load( fullFileName, "png" ); + + if (pixmap.height() / HISTORYPIXMAP_MAX_PREVIEW_HEIGHT >= pixmap.width() / HISTORYPIXMAP_MAX_PREVIEW_WIDTH) { + pixmap = pixmap.scaledToHeight(HISTORYPIXMAP_MAX_PREVIEW_HEIGHT); + } else { + pixmap = pixmap.scaledToWidth(HISTORYPIXMAP_MAX_PREVIEW_WIDTH); + } + + // get file info + QFileInfo *pFileInfo = new QFileInfo(fullFileName); + QString lastModified = pFileInfo->lastModified().toString(" yyyy-MM-dd\nhh:mm:ss"); + + // screenshot preview + QLabel *pScreenshot = new QLabel(); + pScreenshot->setStyleSheet("padding: 5px;"); + pScreenshot->setMinimumHeight(HISTORYPIXMAP_MAX_PREVIEW_HEIGHT); + pScreenshot->setPixmap(pixmap); + + // screenshot datetime + QLabel *pScreenshotText = new QLabel(); + pScreenshotText->setStyleSheet("padding: 5px;"); + pScreenshotText->setMinimumHeight(HISTORYPIXMAP_MAX_PREVIEW_HEIGHT); + pScreenshotText->setAlignment(Qt::AlignCenter); + pScreenshotText->setText(lastModified); + + // copy url + QPushButton *buttonCopyUrl = new QPushButton; + buttonCopyUrl->setText(tr("Copy URL")); + buttonCopyUrl->setMinimumHeight(HISTORYPIXMAP_MAX_PREVIEW_HEIGHT); + connect(buttonCopyUrl, &QPushButton::clicked, this, [=](){ + QApplication::clipboard()->setText(url); + m_notification->showMessage(tr("URL copied to clipboard.")); + this->close(); + }); + + // open in browser + QPushButton *buttonOpen = new QPushButton; + buttonOpen->setText(tr("Open in browser")); + buttonOpen->setMinimumHeight(HISTORYPIXMAP_MAX_PREVIEW_HEIGHT); + connect(buttonOpen, &QPushButton::clicked, this, [=](){ + QDesktopServices::openUrl(QUrl(url)); + this->close(); + }); + + // delete + QPushButton *buttonDelete = new QPushButton; + buttonDelete->setIcon(QIcon(":/img/material/black/delete.svg")); + buttonDelete->setMinimumHeight(HISTORYPIXMAP_MAX_PREVIEW_HEIGHT); + connect(buttonDelete, &QPushButton::clicked, this, [=](){ + if (unpackFileName.token.length() > 0) { + removeItem(phbl, unpackFileName.file, unpackFileName.token); + } + else { + // for compatibility with previous versions and to be able to remove previous screenshots + QFile file(fullFileName); + if (file.exists()) { + file.remove(); + } + removeLocalItem(phbl); + } + }); + + // layout + phbl->addWidget(pScreenshot); + phbl->addWidget(pScreenshotText); + phbl->addWidget(buttonCopyUrl); + phbl->addWidget(buttonOpen); + phbl->addWidget(buttonDelete); + + phbl->setStretchFactor(pScreenshot, 6); + phbl->setStretchFactor(pScreenshotText, 4); + phbl->setStretchFactor(buttonCopyUrl, 4); + phbl->setStretchFactor(buttonOpen, 4); + phbl->setStretchFactor(buttonDelete, 1); + + // add to scroll + m_pVBox->addLayout(phbl); +} + +void HistoryWidget::removeItem(QLayout *pl, const QString& s3FileName, const QString& deleteToken) { + ImgS3Uploader *uploader = new ImgS3Uploader(); + hide(); + uploader->show(); + uploader->deleteResource(s3FileName, deleteToken); + connect(uploader, &QWidget::destroyed, this, [=](){ + if(uploader->success()) { + removeLocalItem(pl); + } + show(); + }); +} + +void HistoryWidget::removeLocalItem(QLayout *pl) { + // remove current row or refresh list + while(pl->count() > 0) { + QLayoutItem *item = pl->takeAt(0); + delete item->widget(); + delete item; + } + m_pVBox->removeItem(pl); + delete pl; + + // set "empty" message if no items left + if(m_pVBox->count() == 0) { + setEmptyMessage(); } } diff --git a/src/widgets/historywidget.h b/src/widgets/historywidget.h index e0f1bac1..b29cb000 100644 --- a/src/widgets/historywidget.h +++ b/src/widgets/historywidget.h @@ -7,7 +7,10 @@ #include #include #include +#include +#include "src/tools/imgs3/imgs3settings.h" +class QLayout; class QVBoxLayout; class NotificationWidget; @@ -21,8 +24,13 @@ signals: private: void loadHistory(); + void addLine(const QString &, const QString &); + void removeItem(QLayout *pl, const QString& s3FileName, const QString& deleteToken); + void removeLocalItem(QLayout *pl); + void setEmptyMessage(); private: + ImgS3Settings m_s3Settings; QVBoxLayout *m_pVBox; NotificationWidget *m_notification; }; diff --git a/translations/Internationalization_ca.ts b/translations/Internationalization_ca.ts index f5dc2206..531de07d 100644 --- a/translations/Internationalization_ca.ts +++ b/translations/Internationalization_ca.ts @@ -440,27 +440,27 @@ Press Space to open the side panel. HistoryWidget - - Screenshots history + + Latest Uploads - + Screenshots history is empty - + Copy URL Copia l'URL - + URL copied to clipboard. L'URL s'ha copiat al porta-retalls. - + Open in browser @@ -469,41 +469,63 @@ Press Space to open the side panel. ImgS3Uploader - Upload to ImgS3 - - - - Uploading Image S'està pujant la imatge - + + Upload image to S3 + + + + + Delete image from S3 + + + + + S3 Creds URL is not found in your configuration file + + + + Copy URL Copia l'URL - + Open URL Obri l'URL - + + Delete image + + + + Image to Clipboard. Imatge al porta-retalls. - + Unable to open the URL. No es pot obrir l'URL. - + + URL copied to clipboard. L'URL s'ha copiat al porta-retalls. - + + + Deleting image... + + + + Screenshot copied to clipboard. La captura s'ha copiat al porta-retalls. @@ -800,7 +822,6 @@ Press Space to open the side panel. - URL copied to clipboard. L'URL s'ha copiat al porta-retalls. diff --git a/translations/Internationalization_de_DE.ts b/translations/Internationalization_de_DE.ts index 18254720..362f135d 100644 --- a/translations/Internationalization_de_DE.ts +++ b/translations/Internationalization_de_DE.ts @@ -443,27 +443,27 @@ Drücke die Leertaste um das Seitenmenü zu öffnen. HistoryWidget - - Screenshots history + + Latest Uploads - + Screenshots history is empty - + Copy URL URL kopieren - + URL copied to clipboard. URL kopiert. - + Open in browser @@ -472,41 +472,63 @@ Drücke die Leertaste um das Seitenmenü zu öffnen. ImgS3Uploader - Upload to ImgS3 - - - - Uploading Image Bild hochladen - + + Upload image to S3 + + + + + Delete image from S3 + + + + + S3 Creds URL is not found in your configuration file + + + + Copy URL URL kopieren - + Open URL URL öffnen - + + Delete image + Bild löschen + + + Image to Clipboard. Bild in Zwischenablage. - + Unable to open the URL. Kann URL nicht öffnen. - + + URL copied to clipboard. URL kopiert. - + + + Deleting image... + + + + Screenshot copied to clipboard. Bildschirmaufnahme in Zwischenablage kopiert. @@ -803,7 +825,6 @@ Drücke die Leertaste um das Seitenmenü zu öffnen. Kein Schreibzugriff auf - URL copied to clipboard. URL kopiert. diff --git a/translations/Internationalization_es.ts b/translations/Internationalization_es.ts index 51ad0a58..a1c72751 100644 --- a/translations/Internationalization_es.ts +++ b/translations/Internationalization_es.ts @@ -443,27 +443,27 @@ Presiona Espacio para abrir el panel lateral. HistoryWidget - - Screenshots history + + Latest Uploads - + Screenshots history is empty - + Copy URL Copiar URL - + URL copied to clipboard. URL copiada al portapapeles. - + Open in browser @@ -472,41 +472,63 @@ Presiona Espacio para abrir el panel lateral. ImgS3Uploader - Upload to ImgS3 - - - - Uploading Image Subiendo Imagen - + + Upload image to S3 + + + + + Delete image from S3 + + + + + S3 Creds URL is not found in your configuration file + + + + Copy URL Copiar URL - + Open URL Abrir URL - + + Delete image + Borrar imagen + + + Image to Clipboard. Imagen al Portapapeles. - + Unable to open the URL. No puede abrir la URL. - + + URL copied to clipboard. URL copiada al portapapeles. - + + + Deleting image... + + + + Screenshot copied to clipboard. Captura copiada al portapapeles. @@ -803,7 +825,6 @@ Presiona Espacio para abrir el panel lateral. Imposible escribir en - URL copied to clipboard. URL copiada al portapapeles. diff --git a/translations/Internationalization_fr.ts b/translations/Internationalization_fr.ts index 24644a32..5ef43c67 100644 --- a/translations/Internationalization_fr.ts +++ b/translations/Internationalization_fr.ts @@ -443,27 +443,27 @@ Appuyer sur Espace pour ouvrir le panneau latéral. HistoryWidget - - Screenshots history + + Latest Uploads - + Screenshots history is empty - + Copy URL Copier l'URL - + URL copied to clipboard. URL copiée dans le Presse-papier. - + Open in browser @@ -472,41 +472,63 @@ Appuyer sur Espace pour ouvrir le panneau latéral. ImgS3Uploader - Upload to ImgS3 - - - - Uploading Image Mise en ligne de l'image - + + Upload image to S3 + + + + + Delete image from S3 + + + + + S3 Creds URL is not found in your configuration file + + + + Copy URL Copier l'URL - + Open URL Ouvrir l'URL - + + Delete image + + + + Image to Clipboard. Image dans le Presse-papier. - + Unable to open the URL. Impossible d'ouvrir l'URL. - + + URL copied to clipboard. URL copiée dans le Presse-papier. - + + + Deleting image... + + + + Screenshot copied to clipboard. Capture d'écran copiée dans le Presse-papier. @@ -803,7 +825,6 @@ Appuyer sur Espace pour ouvrir le panneau latéral. Imposible d'écrire par dessus - URL copied to clipboard. URL copiée dans le Presse-papier. diff --git a/translations/Internationalization_hu.ts b/translations/Internationalization_hu.ts index 2bc58ac8..3fce8960 100644 --- a/translations/Internationalization_hu.ts +++ b/translations/Internationalization_hu.ts @@ -384,10 +384,6 @@ Press Space to open the side panel. HistoryWidget - - Screenshots history - - URL copied to clipboard. URL másolva a vágólapra. @@ -404,13 +400,13 @@ Press Space to open the side panel. Copy URL URL másolása + + Latest Uploads + + ImgS3Uploader - - Upload to ImgS3 - - Uploading Image Kép felötlése @@ -439,6 +435,26 @@ Press Space to open the side panel. Screenshot copied to clipboard. Képernyőmentés másolva a vágólapra. + + Upload image to S3 + + + + Delete image from S3 + + + + Delete image + + + + S3 Creds URL is not found in your configuration file + + + + Deleting image... + + ImgS3UploaderTool diff --git a/translations/Internationalization_ja.ts b/translations/Internationalization_ja.ts index dd4e4e17..a0891358 100644 --- a/translations/Internationalization_ja.ts +++ b/translations/Internationalization_ja.ts @@ -443,27 +443,27 @@ Enter を押すと画面をキャプチャー。 HistoryWidget - - Screenshots history + + Latest Uploads - + Screenshots history is empty - + Copy URL URL をコピー - + URL copied to clipboard. URL をクリップボードにコピーしました。 - + Open in browser @@ -472,41 +472,63 @@ Enter を押すと画面をキャプチャー。 ImgS3Uploader - Upload to ImgS3 - - - - Uploading Image 画像をアップロード中 - + + Upload image to S3 + + + + + Delete image from S3 + + + + + S3 Creds URL is not found in your configuration file + + + + Copy URL URL をコピー - + Open URL URL を開く - + + Delete image + 画像を削除 + + + Image to Clipboard. 画像をクリップボードへ。 - + Unable to open the URL. URL を開けません。 - + + URL copied to clipboard. URL をクリップボードにコピーしました。 - + + + Deleting image... + + + + Screenshot copied to clipboard. スクリーンショットをクリップボードにコピーしました。 @@ -803,7 +825,6 @@ Enter を押すと画面をキャプチャー。 書き込めません: - URL copied to clipboard. URL をクリップボードにコピーしました。 diff --git a/translations/Internationalization_ka.ts b/translations/Internationalization_ka.ts index c9a573fe..7134590f 100644 --- a/translations/Internationalization_ka.ts +++ b/translations/Internationalization_ka.ts @@ -439,27 +439,27 @@ Press Space to open the side panel. HistoryWidget - - Screenshots history + + Latest Uploads - + Screenshots history is empty - + Copy URL URL-ის კოპირება - + URL copied to clipboard. URL დაკოპირდა გაცვლის ბუფერში. - + Open in browser @@ -468,41 +468,63 @@ Press Space to open the side panel. ImgS3Uploader - Upload to ImgS3 - - - - Uploading Image სურათის ატვირთვა - + + Upload image to S3 + + + + + Delete image from S3 + + + + + S3 Creds URL is not found in your configuration file + + + + Copy URL URL-ის კოპირება - + Open URL URL-ის გახსნა - + + Delete image + + + + Image to Clipboard. სურათის გაცვლის ბუფერში გაგზავნა - + Unable to open the URL. URL-ის გახსნა ვერ მოხერხდა. - + + URL copied to clipboard. URL დაკოპირდა გაცვლის ბუფერში. - + + + Deleting image... + + + + Screenshot copied to clipboard. სურათი დაკოპირდა გაცვლის ბუფერში. @@ -799,7 +821,6 @@ Press Space to open the side panel. შემდეგ მისამართზე ჩაწერა ვერ მოხერხდა: - URL copied to clipboard. URL დაკოპირდა გაცვლის ბუფერში. diff --git a/translations/Internationalization_nl.ts b/translations/Internationalization_nl.ts index 1cbbfd2d..87f7751d 100644 --- a/translations/Internationalization_nl.ts +++ b/translations/Internationalization_nl.ts @@ -443,27 +443,27 @@ Druk op spatie om het zijpaneel te openen. HistoryWidget - - Screenshots history + + Latest Uploads - + Screenshots history is empty - + Copy URL URL kopiëren - + URL copied to clipboard. URL gekopieerd naar klembord. - + Open in browser @@ -472,41 +472,63 @@ Druk op spatie om het zijpaneel te openen. ImgS3Uploader - Upload to ImgS3 - - - - Uploading Image Bezig met uploaden van afbeelding... - + + Upload image to S3 + + + + + Delete image from S3 + + + + + S3 Creds URL is not found in your configuration file + + + + Copy URL URL kopiëren - + Open URL URL openen - + + Delete image + Afbeelding verwijderen + + + Image to Clipboard. Afbeelding naar klembord. - + Unable to open the URL. Kan URL niet openen. - + + URL copied to clipboard. URL gekopieerd naar klembord. - + + + Deleting image... + + + + Screenshot copied to clipboard. Schermafdruk gekopieerd naar klembord. @@ -803,7 +825,6 @@ Druk op spatie om het zijpaneel te openen. Kan niet wegschrijven naar - URL copied to clipboard. URL gekopieerd naar klembord. diff --git a/translations/Internationalization_pl.ts b/translations/Internationalization_pl.ts index e2c0ad36..9a8fe7aa 100644 --- a/translations/Internationalization_pl.ts +++ b/translations/Internationalization_pl.ts @@ -442,27 +442,27 @@ Spacja, aby pokazać panel boczny. HistoryWidget - - Screenshots history + + Latest Uploads - + Screenshots history is empty - + Copy URL Kopiuj URL - + URL copied to clipboard. URL skopiowany do schowka. - + Open in browser @@ -471,41 +471,63 @@ Spacja, aby pokazać panel boczny. ImgS3Uploader - Upload to ImgS3 - - - - Uploading Image Wysyłanie obrazka - + + Upload image to S3 + + + + + Delete image from S3 + + + + + S3 Creds URL is not found in your configuration file + + + + Copy URL Kopiuj URL - + Open URL Otwórz URL - + + Delete image + Usuń obrazek + + + Image to Clipboard. Obrazek do schowka. - + Unable to open the URL. Nie można otworzyć adresu URL. - + + URL copied to clipboard. URL skopiowany do schowka. - + + + Deleting image... + + + + Screenshot copied to clipboard. Zrzut ekranu skopiowany do schowka. @@ -802,7 +824,6 @@ Spacja, aby pokazać panel boczny. Nie można zapisać w - URL copied to clipboard. URL skopiowany do schowka. diff --git a/translations/Internationalization_pt_br.ts b/translations/Internationalization_pt_br.ts index 0699934e..2e409a6e 100644 --- a/translations/Internationalization_pt_br.ts +++ b/translations/Internationalization_pt_br.ts @@ -443,27 +443,27 @@ Pressione espaço abrir o painel lateral. HistoryWidget - - Screenshots history + + Latest Uploads - + Screenshots history is empty - + Copy URL Copiar URL - + URL copied to clipboard. URL copiada para o clipboard. - + Open in browser @@ -472,41 +472,63 @@ Pressione espaço abrir o painel lateral. ImgS3Uploader - Upload to ImgS3 - - - - Uploading Image Upando Imagem - + + Upload image to S3 + + + + + Delete image from S3 + + + + + S3 Creds URL is not found in your configuration file + + + + Copy URL Copiar URL - + Open URL Abrir URL - + + Delete image + Deletar imagem + + + Image to Clipboard. Imagem no Clipboard. - + Unable to open the URL. Não foi possível abrir a URL. - + + URL copied to clipboard. URL copiada para o clipboard. - + + + Deleting image... + + + + Screenshot copied to clipboard. Screenshot copiada para o clipboard. @@ -803,7 +825,6 @@ Pressione espaço abrir o painel lateral. Não foi possível escrever em - URL copied to clipboard. URL copiada para o clipboard. diff --git a/translations/Internationalization_ru.ts b/translations/Internationalization_ru.ts index 55b45049..fd13d4c0 100644 --- a/translations/Internationalization_ru.ts +++ b/translations/Internationalization_ru.ts @@ -451,31 +451,35 @@ Press Space to open the side panel. HistoryWidget - Screenshots history - История скриншотов + История скриншотов Screenshots history is epmty История скриншотов пустая - + + Latest Uploads + Последние загрузки + + + Screenshots history is empty История скриншотов пуста - + Copy URL Скопировать URL - + URL copied to clipboard. URL скопирован в буфер обмена. - + Open in browser Открыть в браузере @@ -483,46 +487,72 @@ Press Space to open the side panel. ImgS3Uploader - Upload to ImgS3 - Загрузить на S3 + Загрузить на S3 - + Uploading Image Загрузка изображения - + + Upload image to S3 + Загрузить на S3 + + + + Delete image from S3 + Удалить скриншот с S3 + + + Deleting Image + Удалить скриншот + + + + S3 Creds URL is not found in your configuration file + Параметры доступов к S3 не найдены в конфигурационном файле + + + Copy URL Скопировать URL - + Open URL Открыть URL + Delete image - Удалить изображение + Удалить изображение - + Image to Clipboard. Изображение в буфер обмена. - + Unable to open the URL. Не удалось открыть URL. - + + URL copied to clipboard. URL скопирован в буфер обмена. - + + + Deleting image... + Удаление скриншота... + + + Screenshot copied to clipboard. Снимок скопирован в буфер обмена. @@ -823,11 +853,14 @@ Press Space to open the side panel. Не удалось сохранить - URL copied to clipboard. URL скопирован в буфер обмена. + + File is deleted from S3 + Файл удален с S3 + RectangleTool diff --git a/translations/Internationalization_sk.ts b/translations/Internationalization_sk.ts index ca1c13ab..292a2eb5 100644 --- a/translations/Internationalization_sk.ts +++ b/translations/Internationalization_sk.ts @@ -443,27 +443,27 @@ Stlačte medzerník pre otvorenie postranného panelu. HistoryWidget - - Screenshots history + + Latest Uploads - + Screenshots history is empty - + Copy URL Kopírovať URL - + URL copied to clipboard. URL skopírovaná do schránky. - + Open in browser @@ -472,41 +472,63 @@ Stlačte medzerník pre otvorenie postranného panelu. ImgS3Uploader - Upload to ImgS3 - - - - Uploading Image Nahrávam obrázok - + + Upload image to S3 + + + + + Delete image from S3 + + + + + S3 Creds URL is not found in your configuration file + + + + Copy URL Kopírovať URL - + Open URL Otvoriť URL - + + Delete image + Vymazať obrázok + + + Image to Clipboard. Obrázok do schránky. - + Unable to open the URL. Nepodarilo sa otvoriť URL. - + + URL copied to clipboard. URL skopírovaná do schránky. - + + + Deleting image... + + + + Screenshot copied to clipboard. Snímka obrazovky bola skopírovaná do schránky. @@ -803,7 +825,6 @@ Stlačte medzerník pre otvorenie postranného panelu. Chyba pri ukladaní - URL copied to clipboard. URL skopírovaná do schránky. diff --git a/translations/Internationalization_sr.ts b/translations/Internationalization_sr.ts index 0017f9ed..fa8a97b9 100644 --- a/translations/Internationalization_sr.ts +++ b/translations/Internationalization_sr.ts @@ -443,27 +443,27 @@ Press Space to open the side panel. HistoryWidget - - Screenshots history + + Latest Uploads - + Screenshots history is empty - + Copy URL Запамти интернет адресу - + URL copied to clipboard. Интернет адреса је сачувана у привременој меморији. - + Open in browser @@ -472,41 +472,63 @@ Press Space to open the side panel. ImgS3Uploader - Upload to ImgS3 - - - - Uploading Image Објављујем слику - + + Upload image to S3 + + + + + Delete image from S3 + + + + + S3 Creds URL is not found in your configuration file + + + + Copy URL Запамти интернет адресу - + Open URL Посети интернет адресу - + + Delete image + Избриши слику + + + Image to Clipboard. Сачувај у привремену меморију. - + Unable to open the URL. Нисам успео да посетим интернет адресу. - + + URL copied to clipboard. Интернет адреса је сачувана у привременој меморији. - + + + Deleting image... + + + + Screenshot copied to clipboard. Слика је сачувана у привременој меморији. @@ -803,7 +825,6 @@ Press Space to open the side panel. Нисам успео са сачувам - URL copied to clipboard. Интернет адреса је сачувана у привременој меморији. diff --git a/translations/Internationalization_tr.ts b/translations/Internationalization_tr.ts index 4a710cf6..d64c51e4 100644 --- a/translations/Internationalization_tr.ts +++ b/translations/Internationalization_tr.ts @@ -443,27 +443,27 @@ Yan paneli açmak için Boşluk tuşuna basın. HistoryWidget - - Screenshots history + + Latest Uploads - + Screenshots history is empty - + Copy URL URL Kopyala - + URL copied to clipboard. URL panoya kopyalandı. - + Open in browser @@ -472,41 +472,63 @@ Yan paneli açmak için Boşluk tuşuna basın. ImgS3Uploader - Upload to ImgS3 - - - - Uploading Image Resim Yükleniyor - + + Upload image to S3 + + + + + Delete image from S3 + + + + + S3 Creds URL is not found in your configuration file + + + + Copy URL URL Kopyala - + Open URL URL Aç - + + Delete image + Resmi sil + + + Image to Clipboard. Resim Pano'ya. - + Unable to open the URL. URL açılamıyor. - + + URL copied to clipboard. URL panoya kopyalandı. - + + + Deleting image... + + + + Screenshot copied to clipboard. Ekran görüntüsü panoya kopyalandı. @@ -803,7 +825,6 @@ Yan paneli açmak için Boşluk tuşuna basın. Yazma mümkün değil - URL copied to clipboard. URL panoya kopyalandı. diff --git a/translations/Internationalization_uk.ts b/translations/Internationalization_uk.ts index 86721e74..02617ecb 100644 --- a/translations/Internationalization_uk.ts +++ b/translations/Internationalization_uk.ts @@ -451,31 +451,35 @@ Press Space to open the side panel. HistoryWidget - Screenshots history - Історія скріншотів + Історія скріншотів Screenshots history is epmty Історія скріншотів пуста - + + Latest Uploads + Останні завантаження + + + Screenshots history is empty Історія скріншотів пуста - + Copy URL Скопіювати URL - + URL copied to clipboard. URL скопійовано до буферу обміну. - + Open in browser Відкрити у браузері @@ -483,46 +487,72 @@ Press Space to open the side panel. ImgS3Uploader - Upload to ImgS3 - Вивантажити на S3 + Вивантажити на S3 - + Uploading Image Вивантаження зображення - + + Upload image to S3 + Завантажити на S3 + + + + Delete image from S3 + Видалити скріншот з S3 + + + Deleting Image + Видалити скіншот + + + + S3 Creds URL is not found in your configuration file + Параметри доступів до S3 не знайдені у конфігураціонному файлі + + + Copy URL Скопіювати URL - + Open URL Відкрити URL + Delete image - Видалити зображення + Видалити зображення - + Image to Clipboard. Зображення до буферу обміну. - + Unable to open the URL. Не вдалось відкрити URL. - + + URL copied to clipboard. URL скопійовано до буферу обміну. - + + + Deleting image... + Видалення скріншоту... + + + Screenshot copied to clipboard. Знімок скопійовано до буферу обміну. @@ -823,11 +853,14 @@ Press Space to open the side panel. Не вдалось зберегти - URL copied to clipboard. URL скопійовано до буферу обміну. + + File is deleted from S3 + Файл видален з S3 + RectangleTool diff --git a/translations/Internationalization_zh_CN.ts b/translations/Internationalization_zh_CN.ts index c72fad5c..dcb772de 100644 --- a/translations/Internationalization_zh_CN.ts +++ b/translations/Internationalization_zh_CN.ts @@ -444,27 +444,27 @@ Press Space to open the side panel. HistoryWidget - - Screenshots history + + Latest Uploads - + Screenshots history is empty - + Copy URL 复制链接 - + URL copied to clipboard. 复制链接到剪贴板。 - + Open in browser @@ -473,41 +473,63 @@ Press Space to open the side panel. ImgS3Uploader - Upload to ImgS3 - - - - Uploading Image 正在上传 - + + Upload image to S3 + + + + + Delete image from S3 + + + + + S3 Creds URL is not found in your configuration file + + + + Copy URL 复制链接 - + Open URL 打开链接 - + + Delete image + 删除图像 + + + Image to Clipboard. 保存文件到剪贴板。 - + Unable to open the URL. 无法打开此链接。 - + + URL copied to clipboard. 复制链接到剪贴板。 - + + + Deleting image... + + + + Screenshot copied to clipboard. 截图复制到剪贴板。 @@ -804,7 +826,6 @@ Press Space to open the side panel. 无法写入 - URL copied to clipboard. 复制链接到剪贴板。 diff --git a/translations/Internationalization_zh_TW.ts b/translations/Internationalization_zh_TW.ts index 51b53056..2d0330fd 100644 --- a/translations/Internationalization_zh_TW.ts +++ b/translations/Internationalization_zh_TW.ts @@ -439,27 +439,27 @@ Press Space to open the side panel. HistoryWidget - - Screenshots history + + Latest Uploads - + Screenshots history is empty - + Copy URL 複製連結 - + URL copied to clipboard. 連結已複製到剪貼簿 - + Open in browser @@ -468,41 +468,63 @@ Press Space to open the side panel. ImgS3Uploader - Upload to ImgS3 - - - - Uploading Image 正在上傳 - + + Upload image to S3 + + + + + Delete image from S3 + + + + + S3 Creds URL is not found in your configuration file + + + + Copy URL 複製連結 - + Open URL 打開連結 - + + Delete image + + + + Image to Clipboard. 將檔案複製到剪貼簿 - + Unable to open the URL. 無法打開此連結 - + + URL copied to clipboard. 連結已複製到剪貼簿 - + + + Deleting image... + + + + Screenshot copied to clipboard. 截圖已複製到剪貼簿 @@ -799,7 +821,6 @@ Press Space to open the side panel. 無法寫入 - URL copied to clipboard. 連結已複製到剪貼簿