Skip to content

Commit

Permalink
Translation polish, added Imgur direct link option.
Browse files Browse the repository at this point in the history
  • Loading branch information
ckaiser committed Mar 15, 2014
1 parent c864f5f commit b4c2386
Show file tree
Hide file tree
Showing 22 changed files with 2,041 additions and 1,965 deletions.
3 changes: 3 additions & 0 deletions dialogs/optionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ void OptionsDialog::loadSettings()
ui.currentMonitorCheckBox->setChecked(settings()->value("currentMonitor", false).toBool());
ui.replaceCheckBox->setChecked(settings()->value("replace", false).toBool());
ui.uploadCheckBox->setChecked(settings()->value("uploadAuto", false).toBool());
ui.uploadDirectLinkCheckBox->setChecked(settings()->value("uploadDirectLink", false).toBool());

#ifdef Q_WS_WIN
if (!QFile::exists(qApp->applicationDirPath() + QDir::separator() + "optipng.exe")) {
Expand Down Expand Up @@ -315,6 +316,8 @@ void OptionsDialog::saveSettings()

//Upload
settings()->setValue("uploadAuto", ui.uploadCheckBox->isChecked());
settings()->setValue("uploadDirectLink", ui.uploadDirectLinkCheckBox->isChecked());

settings()->endGroup();

settings()->beginGroup("actions");
Expand Down
81 changes: 71 additions & 10 deletions dialogs/optionsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@
<string>Options - Lightscreen</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="margin">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item>
Expand Down Expand Up @@ -48,12 +57,21 @@
<bool>true</bool>
</property>
<layout class="QGridLayout" name="fileGroupBoxLayout">
<property name="verticalSpacing">
<number>4</number>
<property name="leftMargin">
<number>6</number>
</property>
<property name="margin">
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>4</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="directoryLabel">
<property name="text">
Expand Down Expand Up @@ -368,7 +386,16 @@ Quality is related to file size and of course to readability and overall quality
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<property name="spacing">
Expand Down Expand Up @@ -470,7 +497,16 @@ Quality is related to file size and of course to readability and overall quality
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<property name="spacing">
Expand Down Expand Up @@ -531,7 +567,16 @@ Quality is related to file size and of course to readability and overall quality
<string>Options</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_8">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
Expand Down Expand Up @@ -562,15 +607,24 @@ Quality is related to file size and of course to readability and overall quality
<rect>
<x>0</x>
<y>0</y>
<width>311</width>
<height>780</height>
<width>358</width>
<height>803</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<property name="spacing">
<number>4</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item>
Expand Down Expand Up @@ -1043,6 +1097,13 @@ Quality is related to file size and of course to readability and overall quality
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="uploadDirectLinkCheckBox">
<property name="text">
<string>Get the direct image link when uploading.</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
Expand Down
14 changes: 7 additions & 7 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ int main(int argc, char *argv[])
JumpList jumpList("Lightscreen");

QList<JumpListItem> tasks;
tasks.append(JumpListItem(application.applicationFilePath(), "--screen" , QObject::tr("Screen") , "", "", 0, application.applicationDirPath()));
tasks.append(JumpListItem(application.applicationFilePath(), "--area" , QObject::tr("Area") , "", "", 0, application.applicationDirPath()));
tasks.append(JumpListItem(application.applicationFilePath(), "--activewindow", QObject::tr("Active Window"), "", "", 0, application.applicationDirPath()));
tasks.append(JumpListItem(application.applicationFilePath(), "--pickwindow" , QObject::tr("Pick Window") , "", "", 0, application.applicationDirPath()));
tasks.append(JumpListItem(application.applicationFilePath(), "--screen" , application.translate("JumpList", "Screen"), "", "", 0, application.applicationDirPath()));
tasks.append(JumpListItem(application.applicationFilePath(), "--area" , application.translate("JumpList", "Area") , "", "", 0, application.applicationDirPath()));
tasks.append(JumpListItem(application.applicationFilePath(), "--activewindow", application.translate("JumpList", "Active Window"), "", "", 0, application.applicationDirPath()));
tasks.append(JumpListItem(application.applicationFilePath(), "--pickwindow" , application.translate("JumpList", "Pick Window") , "", "", 0, application.applicationDirPath()));
tasks.append(JumpListItem());
tasks.append(JumpListItem(application.applicationFilePath(), "--uploadlast" , QObject::tr("Upload Last") , "", "", 0, application.applicationDirPath()));
tasks.append(JumpListItem(application.applicationFilePath(), "--viewhistory" , QObject::tr("View History") , "", "", 0, application.applicationDirPath()));
tasks.append(JumpListItem(application.applicationFilePath(), "--uploadlast" , application.translate("JumpList", "Upload Last") , "", "", 0, application.applicationDirPath()));
tasks.append(JumpListItem(application.applicationFilePath(), "--viewhistory" , application.translate("JumpList", "View History") , "", "", 0, application.applicationDirPath()));
tasks.append(JumpListItem());
tasks.append(JumpListItem(application.applicationFilePath(), "--folder" , QObject::tr("Go to Folder") , "", "", 0, application.applicationDirPath()));
tasks.append(JumpListItem(application.applicationFilePath(), "--folder" , application.translate("JumpList", "Go to Folder") , "", "", 0, application.applicationDirPath()));

jumpList.Begin();
jumpList.AddUserTasks(tasks);
Expand Down
12 changes: 10 additions & 2 deletions tools/qtimgur.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <QNetworkRequest>
#include <QXmlStreamReader>

QtImgur::QtImgur(const QString &APIKey, QObject *parent) : QObject(parent), mAPIKey(APIKey)
QtImgur::QtImgur(const QString &APIKey, QObject *parent) : QObject(parent), mAPIKey(APIKey), directUrl(false)
{
mNetworkManager = new QNetworkAccessManager(this);

Expand Down Expand Up @@ -122,8 +122,16 @@ void QtImgur::reply(QNetworkReply *reply)
}

QXmlStreamReader reader(reply->readAll());

QString url_option = "imgur_page";

if (directUrl)
url_option = "original";

QString url;
QString deleteHash;


bool hasError = false;

while (!reader.atEnd()) {
Expand All @@ -138,7 +146,7 @@ void QtImgur::reply(QNetworkReply *reply)
deleteHash = reader.readElementText();
}

if (reader.name() == "imgur_page") {
if (reader.name() == url_option) {
url = reader.readElementText();
}
}
Expand Down
1 change: 1 addition & 0 deletions tools/qtimgur.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class QtImgur: public QObject {
};

QtImgur(const QString &APIKey, QObject *parent);
bool directUrl;

public slots:
void cancelAll();
Expand Down
3 changes: 3 additions & 0 deletions tools/uploader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include <QList>
#include <QPair>
#include <QSettings>

Uploader* Uploader::mInstance = 0;

Expand Down Expand Up @@ -89,6 +90,8 @@ void Uploader::upload(const QString &fileName)
return;
}

mImgur->directUrl = ScreenshotManager::instance()->settings()->value("options/uploadDirectLink", false).toBool();

// Cancel on duplicate
for (int i = 0; i < mScreenshots.size(); ++i) {
if (mScreenshots.at(i).first == fileName) {
Expand Down
Binary file modified translations/dutch.qm
Binary file not shown.
Loading

0 comments on commit b4c2386

Please sign in to comment.