From 1c419de932a666e5920a2500c734c00cd13eb623 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Thu, 5 Sep 2019 01:20:18 +0800 Subject: [PATCH] [feature] i18n --- fu.pro | 22 + i18n/fu.en_us.ts | 977 +++++++++++++++++++++++++++++++- i18n/fu.zh_cn.ts | 990 ++++++++++++++++++++++++++++++++- src/application.cpp | 18 + src/configdialog.cpp | 34 ++ src/configdialog.h | 2 + src/configdialog.ui | 19 +- src/core/settingservice.cpp | 22 +- src/core/settingservice.h | 3 + src/core/uploadservice.cpp | 2 +- src/historywindow.ui | 15 - src/main.cpp | 6 - src/protocols/ftpprotocol.cpp | 2 +- src/protocols/sftpprotocol.cpp | 2 +- src/upgradedialog.cpp | 3 + src/uploaddialog.cpp | 3 + 16 files changed, 2082 insertions(+), 38 deletions(-) diff --git a/fu.pro b/fu.pro index 5fb2142..61e303f 100644 --- a/fu.pro +++ b/fu.pro @@ -111,6 +111,24 @@ TRANSLATIONS = \ i18n/fu.zh_cn.ts \ i18n/fu.en_us.ts +TRANSLATIONS_FILES = +LANGS = +qtPrepareTool(LRELEASE, lrelease) +for(tsfile, TRANSLATIONS) { + qmfile = $$shadowed($$tsfile) + qmfile ~= s,.ts$,.qm, + qmdir = $$dirname(qmfile) + LANGS = $$LANGS,$$basename(qmfile) + !exists($$qmdir) { + mkpath($$qmdir)|error("Aborting.") + } + command = $$LRELEASE -removeidentical $$tsfile -qm $$qmfile + system($$command)|error("Failed to run: $$command") + TRANSLATIONS_FILES += $$qmfile +} + +DEFINES += LANGS=\\\"$${LANGS}\\\" +message($$LANGS) CONFIG(release, debug|release) { BUILD = release } @@ -133,6 +151,10 @@ win32 { dlls.path = $$DESTDIR dlls.files = $$DEPSDIR/bin/*.dll INSTALLS += dlls + + langs.path = $$DESTDIR/i18n + langs.files = $$qmdir/*.qm + INSTALLS += langs } unix { diff --git a/i18n/fu.en_us.ts b/i18n/fu.en_us.ts index d1e1647..bc3d5ce 100644 --- a/i18n/fu.en_us.ts +++ b/i18n/fu.en_us.ts @@ -2,21 +2,988 @@ - MainWindow + AboutDialog - + About - - &Exit + + <html><head/><body><p><a href="https://github.com/klesh/fu"><span style=" text-decoration: underline; color:#0000ff;">https://github.com/klesh/fu</span></a></p></body></html> + + + + + Version:beta + + + + + Close + + + + + Version: + + + + + Application + + + &History + + + + + &Config - + &About + + + &Exit + + + + + ConfigDialog + + + Configuration + + + + + Servers + + + + + + List + + + + + Double click to edit profile + + + + + + Add + + + + + + Delete + + + + + + Detail + + + + + + Name + + + + + hello + + + + + Protocol + + + + + settings + + + + + + Save + + + + + + + Cancel + + + + + Image + + + + + Compress image before uploading (Only for jpg/png) + + + + + Enable watermark + + + + + Chose Watermark Image ... + + + + + Position + + + + + ↖ + + + + + ↑ + + + + + ↗ + + + + + ← + + + + + ※ + + + + + → + + + + + ↙ + + + + + ↓ + + + + + ↘ + + + + + Output Formats + + + + + Template + + + + + <html><head/><body><p>i.e.</p><p><span style=" font-weight:600;">&lt;img src=&quot;%1&quot; alt=&quot;%2&quot;&gt;</span></p><p>%1 will be replaced with &quot;Protocol Output&quot; (normally a URL)</p><p>%2 will be replaced with the Description</p></body></html> + + + + + Tags + + + + + &Add + + + + + &Delete + + + + + Backup/Restore + + + + + <html><head/><body><p>fu stores all data in a single <span style=" font-weight:600;">data.db</span> file, to Backup/Restore, just Copy/Restore this file while fu is not running</p></body></html> + + + + + Open Data Directory + + + + + Language + + + + + + Ok + + + + + Please enter the name of server + + + + + new server + + + + + Select an image file as watermark + + + + + Images (*.png *.gif *.jpg) + + + + + Please enter the name of output format + + + + + Please enter the template of output format + + + + + new format + + + + + No tag is selected! + + + + + Are you sure to delete all selected tags? + + + + + Restart needed + + + + + In order to switch language, you need to restart this program. + + + + + ErrorMessage + + + Fatal Error + + + + + A critical error has occurred! Please report this issue along with following detail if you don't know what is going on. + + + + + Go to issue website + + + + + Notice + + + + + Warning + + + + + FtpProtocol + + + Proxy + + + + + socks5://localhost:1080 + + + + + Host + + + + + FTP server host name + + + + + Please enter server host name + + + + + Port + + + + + Please enter port number + + + + + User name + + + + + Please enter login user name + + + + + Password + + + + + Please enter login password + + + + + Root path + + + + + Root path on remote server, will not be part of output url + + + + + Folder + + + + + %1 for Year, %2 for Month, %3 for Day Of Month, part of output url + + + + + Output Url + + + + + %1 for {Folder}/{File name} + + + + + FTP + + + + + HistoryWindow + + + History + + + + + Filtering + + + + + By Date + + + + + From + + + + + To + + + + + By Servers + + + + + By Tags + + + + + By Image + + + + + N/A + + + + + Paste + + + + + Apply + + + + + Delete Selected + + + + + Clean All + + + + + Refresh + + + + + Deselect All + + + + + Confirmation + + + + + Are you sure you want to delete all history PERMANENTLY? + + + + + Are you sure you want to delete all selected clips? + + + + + Are you sure you want to delete this clip? + + + + + Copy as %1 + + + + + &Edit + + + + + &Delete this + + + + + ImgurProtocol + + + Proxy + + + + + socks5://localhost:1080 + + + + + Client ID + + + + + Obtain from https://imgur.com/account/settings/apps + + + + + Please enter your imgur.com Client ID + + + + + LocalStorageProtocol + + + Root path + + + + + Root path on local machine, will not be part of output url + + + + + Folder + + + + + %1 for Year, %2 for Month, %3 for Day Of Month, part of output url + + + + + Output Url + + + + + %1 for {Folder}/{File name} + + + + + Local Storage + + + + + MigrationV0 + + + Raw + + + + + Markdown Link + + + + + Markdown Image + + + + + HTML Link + + + + + HTML Image + + + + + PathPicker + + + Browse + + + + + PreviewBox + + + Uploaded to: + + + + + QiniuProtocol + + + Proxy + + + + + socks5://localhost:1080 + + + + + Region endpoint + + + + + https://developer.qiniu.com/kodo/manual/1671/region-endpoint + + + + + Please enter your Region Endpoint url + + + + + AccessKey + + + + + + Obtain from https://portal.qiniu.com/user/key + + + + + Please enter your qiniu AccessKey + + + + + SecretKey + + + + + Please enter your qiniu SecretKey + + + + + Bucket + + + + + Please enter your qiniu Bucket name + + + + + Domain + + + + + Bucket domain + + + + + Please enter your qiniu Bucket domain + + + + + Prefix Path + + + + + qiniu.com + + + + + SftpProtocol + + + Proxy + + + + + socks5://localhost:1080 + + + + + Host + + + + + Please enter server host name + + + + + SFTP server host name + + + + + Port + + + + + Please enter port number + + + + + Username + + + + + Please enter login user name + + + + + Password + + + + + Please enter login password + + + + + Private Key + + + + + Key Password + + + + + Public Key + + + + + Root path + + + + + Root path on remote server, will not be part of output url + + + + + Folder + + + + + %1 for Year, %2 for Month, %3 for Day Of Month, part of output url + + + + + Output Url + + + + + %1 for {Folder}/{File name} + + + + + SFTP + + + + + ThumbnailLabel + + + Loading + + + + + UpgradeDialog + + + Upgrade + + + + + fu has to take some steps to setup the database in order to run properly. Press OK to start or Cancel to quit. + + + + + Step: 1/3 + + + + + Ok + + + + + Cancel + + + + + Step + + + + + UploadDialog + + + Upload + + + + + Tags + + + + + Description + + + + + Upload to + + + + + Ok + + + + + Cancel + + + + + Don't output + + + + + UploadService + + + Upload %1 to %2 failed: %3 + + + + + File exists + + + + + File %1 already exists on Server %2. What would you like to do? + + + + + Auto rename + + + + + Overwrite + + + + + Skip + + + + + Apply to all + + + + + File upload completed. +%1 succeeded, %2 failed and %3 skipped + + + + + UploadThread + + + Failed to open file %1 + + + + + Error + + diff --git a/i18n/fu.zh_cn.ts b/i18n/fu.zh_cn.ts index 5063ffe..a6bf3f6 100644 --- a/i18n/fu.zh_cn.ts +++ b/i18n/fu.zh_cn.ts @@ -2,21 +2,999 @@ - MainWindow + AboutDialog - + About 关于 - - &Quit - 退出(&Q) + + <html><head/><body><p><a href="https://github.com/klesh/fu"><span style=" text-decoration: underline; color:#0000ff;">https://github.com/klesh/fu</span></a></p></body></html> + - + + Version:beta + + + + + Close + 关闭 + + + + Version: + 版本: + + + + Application + + + &History + 历史记录(&H) + + + + &Config + 配置(&C) + + + &About 关于(&A) + + + &Exit + 退出(&E) + + + + ConfigDialog + + + Configuration + 配置 + + + + Servers + 服务器 + + + + + List + 列表 + + + + Double click to edit profile + 双击进行资料编辑 + + + + + Add + 添加 + + + + + Delete + 删除 + + + + + Detail + 明细 + + + + + Name + 名称 + + + + hello + 您好 + + + + Protocol + 协议 + + + + settings + 设置 + + + + + Save + 保存 + + + + + + Cancel + 取消 + + + + Image + 图像 + + + + Compress image before uploading (Only for jpg/png) + 上传前对图像进行压缩 + + + + Enable watermark + 启用水印 + + + + Chose Watermark Image ... + 选择水印图片 + + + + Position + 位置 + + + + ↖ + + + + + ↑ + + + + + ↗ + + + + + ← + + + + + ※ + + + + + → + + + + + ↙ + + + + + ↓ + + + + + ↘ + + + + + Output Formats + 输出格式 + + + + Template + 模板 + + + + <html><head/><body><p>i.e.</p><p><span style=" font-weight:600;">&lt;img src=&quot;%1&quot; alt=&quot;%2&quot;&gt;</span></p><p>%1 will be replaced with &quot;Protocol Output&quot; (normally a URL)</p><p>%2 will be replaced with the Description</p></body></html> + <html><head/><body><p>i.e.</p><p><span style=" font-weight:600;">&lt;img src=&quot;%1&quot; alt=&quot;%2&quot;&gt;</span></p><p>%1 将会被替换为协议输出的文本&quot; (normally a URL)</p><p>%2 将会被替换为描述信息</p></body></html> + + + + Tags + 标签 + + + + &Add + 添加(&A) + + + + &Delete + 删除(&D) + + + + Backup/Restore + 备份/恢复 + + + + <html><head/><body><p>fu stores all data in a single <span style=" font-weight:600;">data.db</span> file, to Backup/Restore, just Copy/Restore this file while fu is not running</p></body></html> + <html><head/><body><p>fu 将所有信息存储至 <span style=" font-weight:600;">data.db</span> 文件。 在关闭程序的时候对该文件进行操作即可</p></body></html> + + + + Open Data Directory + 打开数据目录 + + + + Language + 语言 + + + + + Ok + 确认 + + + + Please enter the name of server + 请输入服务器的名称 + + + + new server + 新建的服务器 + + + + Select an image file as watermark + 请选择一个图片文件作为水印 + + + + Images (*.png *.gif *.jpg) + 图像文件 (*.png *.gif *.jpg) + + + + Please enter the name of output format + 请输入输出格式的名称 + + + + Please enter the template of output format + 请输出输出格式的模板 + + + + new format + 新建的格式 + + + + No tag is selected! + 未选择任何标签 + + + + Are you sure to delete all selected tags? + 您确认要删除所选的标签吗? + + + + Restart needed + 需要重启 + + + + In order to switch language, you need to restart this program. + 为了切换语言,您需要重新启动本程序 + + + + ErrorMessage + + + Fatal Error + 严重错误 + + + + A critical error has occurred! Please report this issue along with following detail if you don't know what is going on. + 程序运行过程中发生严重错误! 请向开发者反馈您所遇到的情况,并附上下面列出的详细信息。 + + + + Go to issue website + 转到反馈网站 + + + + Notice + 注意 + + + + Warning + 警告 + + + + FtpProtocol + + + Proxy + 代理 + + + + socks5://localhost:1080 + + + + + Host + 主机 + + + + FTP server host name + FTP服务器的主机名 + + + + Please enter server host name + 请输入服务器的主机名 + + + + Port + 端口 + + + + Please enter port number + 请输入端口号 + + + + User name + 用户 + + + + Please enter login user name + 请输入用户名 + + + + Password + 密码 + + + + Please enter login password + 请输入登录密码 + + + + Root path + 根路径 + + + + Root path on remote server, will not be part of output url + 远程服务器上存储的根路径, 此部分不会出现在“输出网址”中 + + + + Folder + 文件夹 + + + + %1 for Year, %2 for Month, %3 for Day Of Month, part of output url + %1 代表年,%2代表月,%3代表日 + + + + Output Url + 输出网址 + + + + %1 for {Folder}/{File name} + %1 将被替换成 {文件夹}/{文件名} + + + + FTP + + + + + HistoryWindow + + + History + 历史纪录 + + + + Filtering + 过滤 + + + + By Date + 按日期 + + + + From + + + + + To + + + + + By Servers + 按服务器 + + + + By Tags + 按标签 + + + + By Image + 按图片 + + + + N/A + + + + + Paste + 粘贴 + + + + Apply + 应用 + + + + Delete Selected + 删除所选 + + + + Clean All + 清除所有 + + + + Refresh + 刷新 + + + + Deselect All + 全部不选 + + + + Confirmation + 确认 + + + + Are you sure you want to delete all history PERMANENTLY? + 您确定要永久地删除全部历史纪录吗? + + + + Are you sure you want to delete all selected clips? + 您确认要删除所有选中的纪录吗? + + + + Are you sure you want to delete this clip? + 您确定要删除这条纪录吗? + + + + Copy as %1 + 复制为%1 + + + + &Edit + 编辑(&E) + + + + &Delete this + 删除本纪录(&D) + + + + ImgurProtocol + + + Proxy + 代理 + + + + socks5://localhost:1080 + + + + + Client ID + + + + + Obtain from https://imgur.com/account/settings/apps + 可在 https://imgur.com/account/settings/apps 上取得 + + + + Please enter your imgur.com Client ID + 请输入您在 imgur.com 上的 Client ID + + + + LocalStorageProtocol + + + Root path + 根路径 + + + + Root path on local machine, will not be part of output url + 本地存储的根路径, 此部分不会出现在“输出网址”中 + + + + Folder + 文件夹 + + + + %1 for Year, %2 for Month, %3 for Day Of Month, part of output url + %1 代表年,%2代表月,%3代表日 + + + + Output Url + 输出网址 + + + + %1 for {Folder}/{File name} + %1 将被替换成 {文件夹}/{文件名} + + + + Local Storage + 本地存储 + + + + MigrationV0 + + + Raw + 原始输出 + + + + Markdown Link + Markdown 链接 + + + + Markdown Image + Markdown 图片 + + + + HTML Link + HTML 链接 + + + + HTML Image + HTML 图片标签 + + + + PathPicker + + + Browse + 浏览 + + + + PreviewBox + + + Uploaded to: + 上传至: + + + + QPlatformTheme + + Ok + 确认 + + + Cancel + 取消 + + + + QiniuProtocol + + + Proxy + 代理 + + + + socks5://localhost:1080 + + + + + Region endpoint + 上传域名 + + + + https://developer.qiniu.com/kodo/manual/1671/region-endpoint + + + + + Please enter your Region Endpoint url + 请输入存储区域的上传域名 + + + + AccessKey + + + + + + Obtain from https://portal.qiniu.com/user/key + 可从 https://portal.qiniu.com/user/key 获得 + + + + Please enter your qiniu AccessKey + 请输入您的七牛 AccessKey + + + + SecretKey + + + + + Please enter your qiniu SecretKey + 请输入您的七牛 SecretKey + + + + Bucket + 存储空间 + + + + Please enter your qiniu Bucket name + 请输入您的七牛存储空间名 + + + + Domain + 存储域名 + + + + Bucket domain + 存储空间的域名 + + + + Please enter your qiniu Bucket domain + 请输入您的七牛存储空间域名 + + + + Prefix Path + 前缀路径 + + + + qiniu.com + 七牛 + + + + SftpProtocol + + + Proxy + 代理 + + + + socks5://localhost:1080 + + + + + Host + 主机 + + + + Please enter server host name + 请输入服务器的主机名 + + + + SFTP server host name + SFTP服务器的主机名 + + + + Port + 端口 + + + + Please enter port number + 请输入端口号 + + + + Username + 用户 + + + + Please enter login user name + 请输入用户名 + + + + Password + 密码 + + + + Please enter login password + 请输入登录密码 + + + + Private Key + 私钥 + + + + Key Password + 私钥密码 + + + + Public Key + 公钥 + + + + Root path + 根路径 + + + + Root path on remote server, will not be part of output url + 远程服务器上存储的根路径, 此部分不会出现在“输出网址”中 + + + + Folder + 文件夹 + + + + %1 for Year, %2 for Month, %3 for Day Of Month, part of output url + %1 代表年,%2代表月,%3代表日 + + + + Output Url + 输出网址 + + + + %1 for {Folder}/{File name} + %1 将被替换成 {文件夹}/{文件名} + + + + SFTP + + + + + ThumbnailLabel + + + Loading + 加载中 + + + + UpgradeDialog + + + Upgrade + 升级 + + + + fu has to take some steps to setup the database in order to run properly. Press OK to start or Cancel to quit. + 升级应用需要对数据库进行配置和更新,请点击 确认 按钮进行更新操作或 取消 按钮退出程序 + + + + Step: 1/3 + + + + + Ok + 确认 + + + + Cancel + 取消 + + + + Step + 步骤 + + + + UploadDialog + + + Upload + 上传 + + + + Tags + 标签 + + + + Description + 描述信息 + + + + Upload to + 上传至 + + + + Ok + 确认 + + + + Cancel + 取消 + + + + Don't output + 不输出 + + + + UploadService + + + Upload %1 to %2 failed: %3 + 上传 %1 至 %2 失败: %3 + + + + File exists + 文件已存在 + + + + File %1 already exists on Server %2. What would you like to do? + 文件 %1 已经存在服务 %2 上, 您希望如何处理? + + + + Auto rename + 自动重名 + + + + Overwrite + 覆盖 + + + + Skip + 跳过 + + + + Apply to all + 后面全部如此操作 + + + + File upload completed. +%1 succeeded, %2 failed and %3 skipped + 文件上传完成, %1 个成功, %2 个失败 和 %3 个跳过 + + + + UploadThread + + + Failed to open file %1 + 无法打开文件 %1 + + + + Error + 错误 + diff --git a/src/application.cpp b/src/application.cpp index 547715b..bc33bc9 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -123,6 +123,24 @@ bool Application::prepare(const QString &dbPath) _clipService = new ClipService(); _uploadService = new UploadService(); + auto lang = _settingService->lang(); + + // setup i18n + qDebug() << "lang" << lang; + if (!lang.isEmpty()) { + QTranslator *qTranslator = new QTranslator(this); + qDebug() << "lang" << QString("fu.%1.qm").arg(lang); + qTranslator->load(QString("fu.%1.qm").arg(lang), "./i18n"); + installTranslator(qTranslator); + } + +#ifdef Q_OS_WIN + auto f = font(); + f.setFamily("Microsoft YaHei"); + f.setPointSize(9); + setFont(f); +#endif + // upgrade checking if (showUpgradeWindow() == QDialog::Rejected) return false; diff --git a/src/configdialog.cpp b/src/configdialog.cpp index 9912e76..09aacb0 100644 --- a/src/configdialog.cpp +++ b/src/configdialog.cpp @@ -14,6 +14,7 @@ #define TAB_OUTPUT_FORMATS 2 #define TAB_TAGS 3 #define TAB_BACKUP_RESTORE 4 +#define TAB_LANG 5 ConfigDialog::ConfigDialog() : @@ -58,6 +59,8 @@ ConfigDialog::ConfigDialog() : connect(ui->btnOpenDataDir, SIGNAL(clicked()), this, SLOT(bakOpenDataDir())); + connect(ui->btnSaveLang, SIGNAL(clicked()), this, SLOT(langSaveLang())); + ui->tabs->setCurrentIndex(0); // load all protocols @@ -65,6 +68,17 @@ ConfigDialog::ConfigDialog() : ui->cbbProtocol->addItem(protocol->getTitle(), protocol->getName()); } + // load all langs + auto langs = QString(LANGS); + for (auto lang : langs.split(",")) { + if (lang.isEmpty()) continue; + lang = lang.mid(3, lang.size() - 6); + QLocale locale(lang); + auto listItem = new QListWidgetItem(locale.nativeLanguageName(), ui->lstLangs); + auto langName = locale.name().toLower(); + listItem->setData(Qt::UserRole, langName); + } + reloadTab(TAB_SERVERS); } @@ -133,6 +147,16 @@ void ConfigDialog::reloadTab(int id) } break; } + case TAB_LANG: + { + auto currLang = APP->settingService()->lang(); + for(int i = 0; i < ui->lstLangs->count(); ++i) + { + QListWidgetItem* listItem = ui->lstLangs->item(i); + listItem->setSelected(listItem->data(Qt::UserRole).toString() == currLang); + //Do stuff! + } + } } } @@ -504,3 +528,13 @@ void ConfigDialog::highlightWidget(QWidget *widget, const QString hint) widget->setFocus(); QToolTip::showText(widget->mapToGlobal(QPoint()), hint); } + +void ConfigDialog::langSaveLang() +{ + QString lang; + if (ui->lstLangs->selectedItems().size()) { + lang = ui->lstLangs->selectedItems()[0]->data(Qt::UserRole).toString(); + } + APP->settingService()->setLang(lang); + QMessageBox::information(this, tr("Restart needed"), tr("In order to switch language, you need to restart this program.")); +} diff --git a/src/configdialog.h b/src/configdialog.h index 513dbba..c0e3155 100644 --- a/src/configdialog.h +++ b/src/configdialog.h @@ -48,6 +48,8 @@ private slots: void bakOpenDataDir(); void highlightWidget(QWidget*, const QString); + void langSaveLang(); + private: Ui::ConfigDialog *ui; }; diff --git a/src/configdialog.ui b/src/configdialog.ui index 41e6567..918d679 100644 --- a/src/configdialog.ui +++ b/src/configdialog.ui @@ -23,7 +23,7 @@ - 0 + 5 @@ -710,6 +710,23 @@ + + + Language + + + + + + + + + Ok + + + + + diff --git a/src/core/settingservice.cpp b/src/core/settingservice.cpp index 355c6a6..5ff35df 100644 --- a/src/core/settingservice.cpp +++ b/src/core/settingservice.cpp @@ -9,8 +9,10 @@ QVariant SettingService::get(const QString &settingKey) query.prepare("SELECT settingValue FROM settings WHERE settingKey=:settingKey"); query.bindValue(":settingKey", settingKey); assert(query.exec()); - assert(query.next()); - return query.value(0); + if (query.next()) { + return query.value(0); + } + return QString(); } void SettingService::set(const QString &settingKey, const QString &settingValue) @@ -20,6 +22,12 @@ void SettingService::set(const QString &settingKey, const QString &settingValue) query.bindValue(":settingKey", settingKey); query.bindValue(":settingValue", settingValue); assert(query.exec()); + if (query.numRowsAffected() == 0) { + query.prepare("INSERT INTO settings (settingKey, settingValue) VALUES (:settingKey, :settingValue)"); + query.bindValue(":settingKey", settingKey); + query.bindValue(":settingValue", settingValue); + query.exec(); + } } bool SettingService::imageCompressionEnabled() @@ -61,3 +69,13 @@ void SettingService::setImageWatermarkPosition(const QString &pos) { set("imageWatermarkPosition", pos); } + +QString SettingService::lang() +{ + return get("lang").toString(); +} + +void SettingService::setLang(const QString &lang) +{ + set("lang", lang); +} diff --git a/src/core/settingservice.h b/src/core/settingservice.h index 4290a9a..806a429 100644 --- a/src/core/settingservice.h +++ b/src/core/settingservice.h @@ -20,6 +20,9 @@ class SettingService QString imageWatermarkPosition(); void setImageWatermarkPosition(const QString &pos); + + QString lang(); + void setLang(const QString &lang); }; #endif // SETTINGSERVICE_H diff --git a/src/core/uploadservice.cpp b/src/core/uploadservice.cpp index 5935a56..2b132a1 100644 --- a/src/core/uploadservice.cpp +++ b/src/core/uploadservice.cpp @@ -17,7 +17,7 @@ inline void query2upload(QSqlQuery &query, Upload &upload) { upload.url = query.value(rec.indexOf("output")).toString(); upload.createdAt = query.value(rec.indexOf("createdAt")).toDateTime(); auto serverNameIdx = rec.indexOf("serverName"); - if (!~serverNameIdx) upload.serverName = query.value(serverNameIdx).toString(); + if (serverNameIdx > -1) upload.serverName = query.value(serverNameIdx).toString(); } diff --git a/src/historywindow.ui b/src/historywindow.ui index 368a931..5d82700 100644 --- a/src/historywindow.ui +++ b/src/historywindow.ui @@ -348,21 +348,6 @@ - - - - :/icons/x.svg:/icons/x.svg - - - Delete - - - Delete selected clips - - - Del - - diff --git a/src/main.cpp b/src/main.cpp index 26f3309..cabfc01 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -12,11 +12,6 @@ int main(int argc, char *argv[]) { Application app(argc, argv); - // setup i18n - QTranslator qTranslator(&app); - qTranslator.load(QLocale::system(), "fu", ".", app.applicationDirPath().append("/i18n")); - app.installTranslator(&qTranslator); - // application info QApplication::setApplicationName("fu"); QApplication::setApplicationVersion(APP_VERSION); @@ -31,7 +26,6 @@ int main(int argc, char *argv[]) QString defaultDbPath = dataDir.filePath("data.db"); QCommandLineOption dbPathOption("p", app.tr("sqlite database file path"), "path", defaultDbPath); parser.addOption(dbPathOption); - parser.process(app); if (!app.prepare(parser.value(dbPathOption))) diff --git a/src/protocols/ftpprotocol.cpp b/src/protocols/ftpprotocol.cpp index fcf8d23..52aedd4 100644 --- a/src/protocols/ftpprotocol.cpp +++ b/src/protocols/ftpprotocol.cpp @@ -4,7 +4,7 @@ FtpProtocol::FtpProtocol() { _settingInfos.append({"proxy", tr("Proxy"), tr("socks5://localhost:1080"), Text, false, "", ""}); - _settingInfos.append({"host", tr("Host"), tr("FTP server host name"), Text, true, tr("Please pick a storage location"), ""}); + _settingInfos.append({"host", tr("Host"), tr("FTP server host name"), Text, true, tr("Please enter server host name"), ""}); _settingInfos.append({"port", tr("Port"), tr(""), Integer, true, tr("Please enter port number"), 21}); _settingInfos.append({"user", tr("User name"), tr(""), Text, true, tr("Please enter login user name"), ""}); _settingInfos.append({"pass", tr("Password"), tr(""), Text, true, tr("Please enter login password"), ""}); diff --git a/src/protocols/sftpprotocol.cpp b/src/protocols/sftpprotocol.cpp index ffca514..4eddb61 100644 --- a/src/protocols/sftpprotocol.cpp +++ b/src/protocols/sftpprotocol.cpp @@ -4,7 +4,7 @@ SftpProtocol::SftpProtocol() { _settingInfos.append({"proxy", tr("Proxy"), tr("socks5://localhost:1080"), Text, false, "", ""}); - _settingInfos.append({"host", tr("Host"), tr("FTP server host name"), Text, true, tr("Please pick a storage location"), ""}); + _settingInfos.append({"host", tr("Host"), tr("SFTP server host name"), Text, true, tr("Please enter server host name"), ""}); _settingInfos.append({"port", tr("Port"), tr(""), Integer, true, tr("Please enter port number"), 22}); _settingInfos.append({"user", tr("Username"), tr(""), Text, true, tr("Please enter login user name"), ""}); _settingInfos.append({"pass", tr("Password"), tr(""), Text, true, tr("Please enter login password"), ""}); diff --git a/src/upgradedialog.cpp b/src/upgradedialog.cpp index da1ed2d..84ffcd5 100644 --- a/src/upgradedialog.cpp +++ b/src/upgradedialog.cpp @@ -1,12 +1,15 @@ #include "application.h" #include "upgradedialog.h" #include "ui_upgradedialog.h" +#include UpgradeDialog::UpgradeDialog() : QDialog(), ui(new Ui::UpgradeDialog) { ui->setupUi(this); + ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Ok")); + ui->buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Cancel")); setAttribute(Qt::WA_DeleteOnClose); connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(startUpgrading())); diff --git a/src/uploaddialog.cpp b/src/uploaddialog.cpp index 8782878..7b2a2a7 100644 --- a/src/uploaddialog.cpp +++ b/src/uploaddialog.cpp @@ -48,11 +48,14 @@ QComboBox::drop-down { \ } \ " ; + UploadDialog::UploadDialog(QWidget *parent, uint clipId) : QDialog(parent), ui(new Ui::UploadDialog) { ui->setupUi(this); + ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Ok")); + ui->buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Cancel")); _previewLayout = new FlowLayout(ui->sclPreview); auto uploadToLayout = new QVBoxLayout(ui->sclUploadTo);