mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-18 04:54:38 +03:00
RTL layout support
This commit is contained in:
@@ -119,9 +119,9 @@ namespace NekoRay {
|
||||
|
||||
QString ProxyEntity::DisplayLatency() const {
|
||||
if (latency < 0) {
|
||||
return QObject::tr("Unavailable");
|
||||
return UNICODE_LRO + QObject::tr("Unavailable");
|
||||
} else if (latency > 0) {
|
||||
return QString("%1 ms").arg(latency);
|
||||
return UNICODE_LRO + QString("%1 ms").arg(latency);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -29,12 +29,12 @@ namespace NekoRay::traffic {
|
||||
}
|
||||
|
||||
[[nodiscard]] QString DisplaySpeed() const {
|
||||
return QString("%1↑ %2↓").arg(ReadableSize(uplink_rate), ReadableSize(downlink_rate));
|
||||
return UNICODE_LRO + QString("%1↑ %2↓").arg(ReadableSize(uplink_rate), ReadableSize(downlink_rate));
|
||||
}
|
||||
|
||||
[[nodiscard]] QString DisplayTraffic() const {
|
||||
if (downlink + uplink == 0) return "";
|
||||
return QString("%1↑ %2↓").arg(ReadableSize(uplink), ReadableSize(downlink));
|
||||
return UNICODE_LRO + QString("%1↑ %2↓").arg(ReadableSize(uplink), ReadableSize(downlink));
|
||||
}
|
||||
};
|
||||
} // namespace NekoRay::traffic
|
||||
|
||||
@@ -25,6 +25,8 @@ inline std::function<void(QString, QString)> MW_dialog_message;
|
||||
|
||||
// String
|
||||
|
||||
inline const QString UNICODE_LRO = QString::fromUtf8(QByteArray::fromHex("E280AD"));
|
||||
|
||||
#define Int2String(num) QString::number(num)
|
||||
|
||||
inline QString SubStrBefore(QString str, const QString &sub) {
|
||||
|
||||
@@ -165,11 +165,14 @@ int main(int argc, char *argv[]) {
|
||||
locale = "zh_CN";
|
||||
break;
|
||||
case 3:
|
||||
locale = "fa_IR"; //farsi(iran)
|
||||
locale = "fa_IR"; // farsi(iran)
|
||||
break;
|
||||
default:
|
||||
locale = QLocale().name();
|
||||
}
|
||||
QGuiApplication::tr("QT_LAYOUT_DIRECTION");
|
||||
QLocale::setDefault(QLocale(locale));
|
||||
//
|
||||
QTranslator trans;
|
||||
if (trans.load(":/translations/" + locale + ".qm")) {
|
||||
QCoreApplication::installTranslator(&trans);
|
||||
|
||||
@@ -1216,6 +1216,13 @@ End: %2</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QGuiApplication</name>
|
||||
<message>
|
||||
<source>QT_LAYOUT_DIRECTION</source>
|
||||
<translation>RTL</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
@@ -1337,6 +1344,14 @@ Direct: %2</source>
|
||||
<source>Request with proxy but no profile started.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable VPN</source>
|
||||
<translation type="obsolete">فعال کردن vpn</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable System Proxy</source>
|
||||
<translation type="obsolete">پروکسی سیستم را فعال کنید</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Qv2ray::ui::widgets::AutoCompleteTextEdit</name>
|
||||
|
||||
@@ -1219,6 +1219,13 @@ Split by line.</source>
|
||||
<translation>删除 %1 ?</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QGuiApplication</name>
|
||||
<message>
|
||||
<source>QT_LAYOUT_DIRECTION</source>
|
||||
<translation>LTR</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
@@ -1351,6 +1358,14 @@ As of January 1, 2022, compatibility with MD5 authentication information will be
|
||||
<source>Clearing servers...</source>
|
||||
<translation>正在清理服务器...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable VPN</source>
|
||||
<translation type="obsolete">启用 VPN</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable System Proxy</source>
|
||||
<translation type="obsolete">启用系统代理</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Qv2ray::ui::widgets::AutoCompleteTextEdit</name>
|
||||
|
||||
@@ -43,6 +43,7 @@ QString ParseSubInfo(const QString &info) {
|
||||
|
||||
GroupItem::GroupItem(QWidget *parent, const QSharedPointer<NekoRay::Group> &ent, QListWidgetItem *item) : QWidget(parent), ui(new Ui::GroupItem) {
|
||||
ui->setupUi(this);
|
||||
this->setLayoutDirection(Qt::LeftToRight);
|
||||
|
||||
this->ent = ent;
|
||||
this->item = item;
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
ProxyItem::ProxyItem(QWidget *parent, const QSharedPointer<NekoRay::ProxyEntity> &ent, QListWidgetItem *item)
|
||||
: QWidget(parent), ui(new Ui::ProxyItem) {
|
||||
ui->setupUi(this);
|
||||
this->setLayoutDirection(Qt::LeftToRight);
|
||||
|
||||
this->item = item;
|
||||
this->ent = ent;
|
||||
if (ent == nullptr) return;
|
||||
|
||||
@@ -24,6 +24,12 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="name">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">名称</string>
|
||||
</property>
|
||||
@@ -48,6 +54,12 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="address">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: rgb(102, 102, 102);</string>
|
||||
</property>
|
||||
@@ -58,6 +70,12 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="test_result">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">测试结果</string>
|
||||
</property>
|
||||
@@ -72,6 +90,12 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="type">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: rgb(251, 114, 153);</string>
|
||||
</property>
|
||||
@@ -82,6 +106,12 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="traffic">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">流量</string>
|
||||
</property>
|
||||
|
||||
Reference in New Issue
Block a user