Skip to content

Commit

Permalink
fix: fail in linux and mac
Browse files Browse the repository at this point in the history
  • Loading branch information
XMuli committed Apr 17, 2023
1 parent da5ff1e commit c0735b7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
<file>resources/tool_para/line_width/line_width_3.svg</file>
<file>resources/tool_para/arrows/arrow_4.svg</file>
<file>resources/tool/pin.svg</file>
<file>resources/Logo.png</file>
<file>resources/tool_para/serialnumber/ellipse_fill.svg</file>
<file>resources/tool_para/serialnumber/letters.svg</file>
<file>resources/tool_para/serialnumber/numbers.svg</file>
Expand All @@ -37,6 +36,7 @@
<file>resources/tool_para/text/outline.svg</file>
<file>resources/tool/custompath.svg</file>
<file>resources/border_style/light_blue/boardPoint.svg</file>
<file>resources/Logo.png</file>
<file>resources/Logo.svg</file>
</qresource>
</RCC>
18 changes: 15 additions & 3 deletions src/preference/prefmanage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ PrefManage::~PrefManage()

void PrefManage::initUIGeneral()
{
m_lanuages = { {"en_US", "English"}
,{"zh_CN", "简体中文"}
,{"zh_TW", "繁體中文"}};
m_lanuages = { std::make_pair("en_US", "English")
,std::make_pair("zh_CN", "简体中文")
,std::make_pair("zh_TW", "繁體中文")};

const auto it = m_lanuages.find(DATAMAID->paraValue("lanuage").value<QString>());
const QString strLanuage = (it != m_lanuages.end()) ? it->second : m_lanuages.at("en_US");
Expand Down Expand Up @@ -405,6 +405,9 @@ void PrefManage::on_cbLanuage_currentTextChanged(const QString &language)
const QString strLanuage = btn->itemData(btn->currentIndex()).toString();
DATAMAID->setParaValue("lanuage", strLanuage);

auto t = DATAMAID->paraValue("font").value<QString>();


QTranslator trans;
QString qmPath(qApp->applicationDirPath());
#if defined(Q_OS_MAC)
Expand All @@ -416,6 +419,15 @@ void PrefManage::on_cbLanuage_currentTextChanged(const QString &language)
qApp->installTranslator(&trans);

ui->retranslateUi(this);
ui->btnFont->setText(DATAMAID->paraValue("font").value<QString>()); // fix: 切换后文本空白; 没有 tr 放于 retranslateUi 后

QString bit;
if (_BIT_ARCH == 4) bit = "x86";
else if (_BIT_ARCH == 8) bit = "x64";
ui->labVersion->setText(QString("%1-Beta %2 (%3)")
.arg(_PROJECT_VERSION)
.arg(bit)
.arg(_VERSION_BUILD_TIME));
}


Expand Down
5 changes: 4 additions & 1 deletion src/preference/prefmanage.ui
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
<number>4</number>
<number>0</number>
</property>
<widget class="QWidget" name="tabGeneral">
<attribute name="title">
Expand Down Expand Up @@ -1136,6 +1136,9 @@
<property name="text">
<string>simple and beautiful cross-platform screenshot software.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
Expand Down
7 changes: 6 additions & 1 deletion src/screen/tray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,11 @@ void Tray::onPreference(bool checked)

m_pPref->setVisible(true);
m_pPref->adjustSize();

#ifdef Q_OS_WIN
m_pPref->setFixedSize(m_pPref->size());
#endif

}

void Tray::onKeySequenceChanged(const QKeySequence& keySequence)
Expand Down Expand Up @@ -246,7 +250,8 @@ void Tray::onNotificHotkeyRegisteredFail(std::map<const QString, const QString>
QString msg;
for (const auto& it: map) {
msg += (it.first + ": " + it.second + "\n");
msg.left(msg.lastIndexOf('\n'));
auto t = msg.lastIndexOf('\n');
msg.left(t);
}

m_trayIcon->showMessage(title, msg, QIcon(":/resources/Logo.png"), 6000);
Expand Down

0 comments on commit c0735b7

Please sign in to comment.