forked from Ivasoft/DSView
update the app data directory get mode,fix switch language bug at macos
This commit is contained in:
@@ -38,8 +38,6 @@
|
||||
#include "config.h"
|
||||
#include "pv/appcontrol.h"
|
||||
|
||||
char DS_RES_PATH[256];
|
||||
|
||||
void usage()
|
||||
{
|
||||
fprintf(stdout,
|
||||
@@ -53,6 +51,8 @@ void usage()
|
||||
"\n", DS_BIN_NAME, DS_DESCRIPTION);
|
||||
}
|
||||
|
||||
char DS_RES_PATH[256] = {0};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int ret = 0;
|
||||
@@ -142,24 +142,12 @@ int main(int argc, char *argv[])
|
||||
if (argcFinal - optind > 1) {
|
||||
fprintf(stderr, "Only one file can be openened.\n");
|
||||
return 1;
|
||||
} else if (argcFinal - optind == 1)
|
||||
} else if (argcFinal - optind == 1){
|
||||
open_file = argvFinal[argcFinal - 1];
|
||||
|
||||
QDir dir(QCoreApplication::applicationDirPath());
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
if (dir.cd("..") &&
|
||||
dir.cd("share") &&
|
||||
dir.cd("DSView") &&
|
||||
dir.cd("res")) {
|
||||
// the path command like: cd ../share/DSView/res
|
||||
QString res_dir = dir.absolutePath() + "/";
|
||||
strcpy(DS_RES_PATH, res_dir.toUtf8().data());
|
||||
} else {
|
||||
qDebug() << "DSView run ERROR: config files don't exist.";
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
QString path = GetAppDataDir();
|
||||
strcpy(DS_RES_PATH, path.toUtf8().data());
|
||||
|
||||
//#ifdef Q_OS_DARWIN
|
||||
//#endif
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "devicemanager.h"
|
||||
#include "sigsession.h"
|
||||
#include "dsvdef.h"
|
||||
#include "config/appconfig.h"
|
||||
|
||||
AppControl::AppControl()
|
||||
{
|
||||
@@ -71,23 +72,14 @@ bool AppControl::Init()
|
||||
{
|
||||
m_error = "DSView run ERROR: libsigrok init failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// const char *decoderScriptDir = "/home/lala/tmpdir/any";
|
||||
//const char * decoderScriptDir = NULL;
|
||||
|
||||
char decoderScriptDir[256] = {0};
|
||||
QDir dir(QCoreApplication::applicationDirPath());
|
||||
#ifdef Q_OS_LINUX
|
||||
dir.cd("../share/DSView/decoders");
|
||||
#else
|
||||
dir.cd("decoders");
|
||||
#endif
|
||||
|
||||
strcpy(decoderScriptDir, dir.absolutePath().toUtf8().data());
|
||||
}
|
||||
|
||||
QString dir = GetAppDataDir() + "/decoders";
|
||||
char path[256] = {0};
|
||||
strcpy(path, dir.toUtf8().data());
|
||||
|
||||
// Initialise libsigrokdecode
|
||||
if (srd_init(decoderScriptDir) != SRD_OK)
|
||||
if (srd_init(path) != SRD_OK)
|
||||
{
|
||||
m_error = "ERROR: libsigrokdecode init failed.";
|
||||
return false;
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
#include <QApplication>
|
||||
#include <QSettings>
|
||||
#include <QLocale>
|
||||
#include <QDir>
|
||||
#include <QDebug>
|
||||
#include <assert.h>
|
||||
|
||||
#define MAX_PROTOCOL_FORMAT_LIST 15
|
||||
|
||||
@@ -126,10 +129,14 @@ void _loadFrame(FrameOptions &o, QSettings &st){
|
||||
o.windowState = st.value("windowState", QByteArray()).toByteArray();
|
||||
st.endGroup();
|
||||
|
||||
if (o.language == -1){
|
||||
if (o.language == -1 || (o.language != LAN_CN && o.language != LAN_EN)){
|
||||
//get local language
|
||||
QLocale locale;
|
||||
o.language = locale.language();
|
||||
|
||||
if (QLocale::languageToString(locale.language()) == "Chinese")
|
||||
o.language = LAN_CN;
|
||||
else
|
||||
o.language = LAN_EN;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,3 +289,23 @@ QString GetIconPath()
|
||||
}
|
||||
return ":/icons/" + style;
|
||||
}
|
||||
|
||||
QString GetAppDataDir()
|
||||
{
|
||||
//applicationDirPath not end with '/'
|
||||
#ifdef Q_OS_LINUX
|
||||
QDir dir(QCoreApplication::applicationDirPath());
|
||||
if (dir.cd("..") && dir.cd("share") &&dir.cd("DSView"))
|
||||
{
|
||||
return dir.absolutePath();
|
||||
}
|
||||
qDebug() << "dir is not exists:" << QCoreApplication::applicationDirPath() + "/../share/DSView";
|
||||
assert(false);
|
||||
#else
|
||||
return QCoreApplication::applicationDirPath();
|
||||
#endif
|
||||
}
|
||||
|
||||
QString GetResourceDir(){
|
||||
return GetAppDataDir() + "/res";
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include <QString>
|
||||
#include <QByteArray>
|
||||
|
||||
#define LAN_CN 25
|
||||
#define LAN_EN 31
|
||||
|
||||
//--------------------api---
|
||||
|
||||
@@ -34,6 +36,10 @@ QString GetDirectoryName(QString path);
|
||||
|
||||
QString GetIconPath();
|
||||
|
||||
QString GetAppDataDir();
|
||||
|
||||
QString GetResourceDir();
|
||||
|
||||
//------------------class
|
||||
|
||||
class StringPair
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include "config/appconfig.h"
|
||||
|
||||
using std::list;
|
||||
using std::map;
|
||||
@@ -116,7 +117,7 @@ void DeviceManager::driver_scan(
|
||||
|
||||
// Check If DSL hardware driver
|
||||
if (strncmp(driver->name, "virtual", 7)) {
|
||||
QDir dir(DS_RES_PATH);
|
||||
QDir dir(GetResourceDir());
|
||||
if (!dir.exists())
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -76,13 +76,8 @@ About::About(QWidget *parent) :
|
||||
.arg("http://sigrok.org/");
|
||||
|
||||
QString changlogs = tr("<font size=16>Changelogs</font><br />");
|
||||
#ifndef Q_OS_LINUX
|
||||
QDir dir(QCoreApplication::applicationDirPath());
|
||||
#else
|
||||
QDir dir(DS_RES_PATH);
|
||||
dir.cdUp();
|
||||
#endif
|
||||
|
||||
QDir dir(GetAppDataDir());
|
||||
AppConfig &app = AppConfig::Instance();
|
||||
int lan = app._frameOptions.language;
|
||||
|
||||
|
||||
@@ -27,3 +27,8 @@ class IDlgCallback
|
||||
public:
|
||||
virtual void OnDlgResult(bool bYes)=0;
|
||||
};
|
||||
|
||||
class IMainForm{
|
||||
public:
|
||||
virtual void switchLanguage(int language)=0;
|
||||
};
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <QScreen>
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
|
||||
#include "dsvdef.h"
|
||||
#include "config/appconfig.h"
|
||||
@@ -449,12 +450,18 @@ void MainFrame::show_doc()
|
||||
dialogs::DSDialog dlg(this, true);
|
||||
dlg.setTitle(tr("Document"));
|
||||
|
||||
QString path = GetAppDataDir() + "/showDoc" + QString::number(lan)+ ".png";
|
||||
if (!QFile::exists(path)){
|
||||
path = ":/icons/showDoc"+QString::number(lan)+".png";
|
||||
}
|
||||
|
||||
QLabel tipsLabel;
|
||||
tipsLabel.setPixmap(QPixmap(":/icons/showDoc"+QString::number(lan)+".png"));
|
||||
tipsLabel.setPixmap(path);
|
||||
|
||||
QMessageBox msg;
|
||||
msg.setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint | Qt::WindowSystemMenuHint);
|
||||
msg.setContentsMargins(0, 0, 0, 0);
|
||||
connect(&msg, SIGNAL(buttonClicked(QAbstractButton*)), &dlg, SLOT(accept()));
|
||||
|
||||
QPushButton *noMoreButton = msg.addButton(tr("Not Show Again"), QMessageBox::ActionRole);
|
||||
msg.addButton(tr("Ignore"), QMessageBox::ActionRole);
|
||||
QPushButton *openButton = msg.addButton(tr("Open"), QMessageBox::ActionRole);
|
||||
@@ -465,6 +472,8 @@ void MainFrame::show_doc()
|
||||
layout.setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
dlg.layout()->addLayout(&layout);
|
||||
connect(&msg, SIGNAL(buttonClicked(QAbstractButton*)), &dlg, SLOT(accept()));
|
||||
|
||||
dlg.exec();
|
||||
|
||||
if (msg.clickedButton() == openButton) {
|
||||
|
||||
@@ -286,7 +286,6 @@ void MainWindow::setup_ui()
|
||||
connect(_file_bar, SIGNAL(sig_store_session(QString)), this, SLOT(on_store_session(QString)));
|
||||
|
||||
//logobar
|
||||
connect(_logo_bar, SIGNAL(sig_setLanguage(int)), this, SLOT(on_setLanguage(int)));
|
||||
connect(_logo_bar, SIGNAL(sig_open_doc()), this, SLOT(on_open_doc()));
|
||||
|
||||
|
||||
@@ -302,6 +301,8 @@ void MainWindow::setup_ui()
|
||||
connect(_sampling_bar, SIGNAL(sig_show_calibration()), _view, SLOT(show_calibration()));
|
||||
|
||||
connect(_dso_trigger_widget, SIGNAL(set_trig_pos(int)), _view, SLOT(set_trig_pos(int)));
|
||||
|
||||
_logo_bar->set_mainform_callback(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -397,12 +398,8 @@ void MainWindow::update_device_list()
|
||||
} else {
|
||||
_file_bar->set_settings_en(false);
|
||||
_logo_bar->dsl_connected(false);
|
||||
#ifdef Q_OS_LINUX
|
||||
QDir dir(DS_RES_PATH);
|
||||
#else
|
||||
QDir dir(QCoreApplication::applicationDirPath());
|
||||
assert(dir.cd("res"));
|
||||
#endif
|
||||
|
||||
QDir dir(GetResourceDir());
|
||||
if (dir.exists()) {
|
||||
QString str = dir.absolutePath() + "/";
|
||||
QString ses_name = str +
|
||||
@@ -1395,11 +1392,7 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void MainWindow::on_setLanguage(int language)
|
||||
{
|
||||
switchLanguage(language);
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::switchLanguage(int language)
|
||||
{
|
||||
@@ -1414,7 +1407,7 @@ void MainWindow::switchLanguage(int language)
|
||||
app.SaveFrame();
|
||||
}
|
||||
|
||||
if (language != QLocale::English)
|
||||
if (language == LAN_CN)
|
||||
{
|
||||
_qtTrans.load(":/qt_" + QString::number(language));
|
||||
qApp->installTranslator(&_qtTrans);
|
||||
@@ -1464,13 +1457,8 @@ void MainWindow::on_open_doc(){
|
||||
}
|
||||
|
||||
void MainWindow::openDoc()
|
||||
{
|
||||
#ifndef Q_OS_LINUX
|
||||
QDir dir(QCoreApplication::applicationDirPath());
|
||||
#else
|
||||
QDir dir(DS_RES_PATH);
|
||||
dir.cdUp();
|
||||
#endif
|
||||
{
|
||||
QDir dir(GetAppDataDir());
|
||||
AppConfig &app = AppConfig::Instance();
|
||||
int lan = app._frameOptions.language;
|
||||
QDesktopServices::openUrl(
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "dialogs/dsmessagebox.h"
|
||||
#include "interface/icallbacks.h"
|
||||
#include "eventobject.h"
|
||||
#include "interface/uicallback.h"
|
||||
|
||||
class QAction;
|
||||
class QMenuBar;
|
||||
@@ -72,7 +73,7 @@ using namespace pv::device;
|
||||
|
||||
//The mainwindow,referenced by MainFrame
|
||||
//TODO: create graph view,toolbar,and show device list
|
||||
class MainWindow : public QMainWindow, public ISessionCallback
|
||||
class MainWindow : public QMainWindow, public ISessionCallback, public IMainForm
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -83,8 +84,7 @@ public:
|
||||
explicit MainWindow(QWidget *parent = 0);
|
||||
|
||||
void openDoc();
|
||||
void switchLanguage(int language);
|
||||
|
||||
|
||||
private:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
||||
@@ -119,8 +119,7 @@ private slots:
|
||||
bool on_store_session(QString name);
|
||||
void device_detach_post();
|
||||
void device_changed(bool close);
|
||||
void on_device_selected();
|
||||
void on_setLanguage(int language);
|
||||
void on_device_selected();
|
||||
|
||||
void on_capture_state_changed(int state);
|
||||
void on_data_updated();
|
||||
@@ -139,6 +138,10 @@ private slots:
|
||||
signals:
|
||||
void prgRate(int progress);
|
||||
|
||||
//IMainForm
|
||||
public:
|
||||
void switchLanguage(int language);
|
||||
|
||||
//ISessionCallback
|
||||
public:
|
||||
void session_save();
|
||||
|
||||
@@ -20,20 +20,18 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QObject>
|
||||
#include <QLocale>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "deviceoptions.h"
|
||||
|
||||
#include <pv/prop/bool.h>
|
||||
#include <pv/prop/double.h>
|
||||
#include <pv/prop/enum.h>
|
||||
#include <pv/prop/int.h>
|
||||
#include <boost/bind.hpp>
|
||||
#include <QDebug>
|
||||
#include <QObject>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../bool.h"
|
||||
#include "../double.h"
|
||||
#include "../enum.h"
|
||||
#include "../int.h"
|
||||
#include "../config/appconfig.h"
|
||||
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
@@ -73,7 +71,7 @@ DeviceOptions::DeviceOptions(struct sr_dev_inst *sdi) :
|
||||
if (sr_config_get(_sdi->driver, _sdi, NULL, NULL, SR_CONF_LANGUAGE, &gvar_tmp) == SR_OK) {
|
||||
if (gvar_tmp != NULL) {
|
||||
int language = g_variant_get_int16(gvar_tmp);
|
||||
if (language == QLocale::Chinese)
|
||||
if (language == LAN_CN)
|
||||
label_char = info->label_cn;
|
||||
g_variant_unref(gvar_tmp);
|
||||
}
|
||||
|
||||
@@ -19,21 +19,20 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "probeoptions.h"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QObject>
|
||||
#include <QLocale>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "probeoptions.h"
|
||||
|
||||
#include <pv/prop/bool.h>
|
||||
#include <pv/prop/double.h>
|
||||
#include <pv/prop/enum.h>
|
||||
#include <pv/prop/int.h>
|
||||
|
||||
#include "../../config/appconfig.h"
|
||||
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
|
||||
@@ -74,7 +73,7 @@ ProbeOptions::ProbeOptions(struct sr_dev_inst *sdi,
|
||||
if (sr_config_get(_sdi->driver, _sdi, NULL, NULL, SR_CONF_LANGUAGE, &gvar_tmp) == SR_OK) {
|
||||
if (gvar_tmp != NULL) {
|
||||
int language = g_variant_get_int16(gvar_tmp);
|
||||
if (language == QLocale::Chinese)
|
||||
if (language == LAN_CN)
|
||||
label_char = info->label_cn;
|
||||
g_variant_unref(gvar_tmp);
|
||||
}
|
||||
|
||||
@@ -191,13 +191,8 @@ void FileBar::on_actionLoad_triggered()
|
||||
}
|
||||
|
||||
void FileBar::on_actionDefault_triggered()
|
||||
{
|
||||
#ifdef Q_OS_LINUX
|
||||
QDir dir(DS_RES_PATH);
|
||||
#else
|
||||
QDir dir(QCoreApplication::applicationDirPath());
|
||||
assert(dir.cd("res"));
|
||||
#endif
|
||||
{
|
||||
QDir dir(GetResourceDir());
|
||||
if (!dir.exists()) {
|
||||
MsgBox::Show(NULL, "Cannot find default session file for this device!", this);
|
||||
return;
|
||||
@@ -205,7 +200,7 @@ void FileBar::on_actionDefault_triggered()
|
||||
|
||||
QString driver_name = _session->get_device()->name();
|
||||
QString mode_name = QString::number(_session->get_device()->dev_inst()->mode);
|
||||
int language = QLocale::English;
|
||||
int language = LAN_EN;
|
||||
GVariant *gvar_tmp = _session->get_device()->get_config(NULL, NULL, SR_CONF_LANGUAGE);
|
||||
if (gvar_tmp != NULL) {
|
||||
language = g_variant_get_int16(gvar_tmp);
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
#include <QApplication>
|
||||
#include <assert.h>
|
||||
|
||||
#include "logobar.h"
|
||||
#include "../dialogs/about.h"
|
||||
@@ -43,6 +44,8 @@ LogoBar::LogoBar(SigSession *session, QWidget *parent) :
|
||||
_session(session),
|
||||
_logo_button(this)
|
||||
{
|
||||
_mainForm = NULL;
|
||||
|
||||
setMovable(false);
|
||||
setContentsMargins(0,0,0,0);
|
||||
|
||||
@@ -118,7 +121,7 @@ void LogoBar::retranslateUi()
|
||||
_issue->setText(tr("&Bug Report"));
|
||||
|
||||
AppConfig &app = AppConfig::Instance();
|
||||
if (app._frameOptions.language == QLocale::Chinese)
|
||||
if (app._frameOptions.language == LAN_CN)
|
||||
_language->setIcon(QIcon(":/icons/Chinese.svg"));
|
||||
else
|
||||
_language->setIcon(QIcon(":/icons/English.svg"));
|
||||
@@ -170,14 +173,17 @@ void LogoBar::on_actionEn_triggered()
|
||||
{
|
||||
_language->setIcon(QIcon::fromTheme("file",
|
||||
QIcon(":/icons/English.svg")));
|
||||
sig_setLanguage(QLocale::English);
|
||||
|
||||
assert(_mainForm);
|
||||
_mainForm->switchLanguage(LAN_EN);
|
||||
}
|
||||
|
||||
void LogoBar::on_actionCn_triggered()
|
||||
{
|
||||
_language->setIcon(QIcon::fromTheme("file",
|
||||
QIcon(":/icons/Chinese.svg")));
|
||||
sig_setLanguage(QLocale::Chinese);
|
||||
assert(_mainForm);
|
||||
_mainForm->switchLanguage(LAN_CN);
|
||||
}
|
||||
|
||||
void LogoBar::on_actionAbout_triggered()
|
||||
@@ -187,22 +193,15 @@ void LogoBar::on_actionAbout_triggered()
|
||||
}
|
||||
|
||||
void LogoBar::on_actionManual_triggered()
|
||||
{
|
||||
#ifndef Q_OS_LINUX
|
||||
QDir dir(QCoreApplication::applicationDirPath());
|
||||
#else
|
||||
QDir dir(DS_RES_PATH);
|
||||
dir.cdUp();
|
||||
#endif
|
||||
QDesktopServices::openUrl(
|
||||
QUrl("file:///"+dir.absolutePath() + "/ug.pdf"));
|
||||
{
|
||||
QDir dir(GetAppDataDir());
|
||||
QDesktopServices::openUrl( QUrl("file:///"+dir.absolutePath() + "/ug.pdf"));
|
||||
}
|
||||
|
||||
void LogoBar::on_actionIssue_triggered()
|
||||
{
|
||||
QDir dir(QCoreApplication::applicationDirPath());
|
||||
QDesktopServices::openUrl(
|
||||
QUrl(QLatin1String("https://github.com/DreamSourceLab/DSView/issues")));
|
||||
QDir dir(GetAppDataDir());
|
||||
QDesktopServices::openUrl(QUrl(QLatin1String("https://github.com/DreamSourceLab/DSView/issues")));
|
||||
}
|
||||
|
||||
void LogoBar::enable_toggle(bool enable)
|
||||
|
||||
@@ -27,10 +27,11 @@
|
||||
#include <QToolButton>
|
||||
#include <QAction>
|
||||
#include <QMenu>
|
||||
#include <libsigrok4DSL/libsigrok.h>
|
||||
|
||||
#include "../sigsession.h"
|
||||
#include "../interface/uicallback.h"
|
||||
|
||||
#include <libsigrok4DSL/libsigrok.h>
|
||||
|
||||
namespace pv {
|
||||
namespace toolbars {
|
||||
@@ -49,6 +50,10 @@ public:
|
||||
//show the hardware device conneted status with logo picture
|
||||
void dsl_connected(bool conn);
|
||||
|
||||
inline void set_mainform_callback(IMainForm *callback){
|
||||
_mainForm = callback;
|
||||
}
|
||||
|
||||
private:
|
||||
void changeEvent(QEvent *event);
|
||||
void retranslateUi();
|
||||
@@ -59,10 +64,7 @@ private:
|
||||
void show_session_error(
|
||||
const QString text, const QString info_text);
|
||||
|
||||
signals:
|
||||
//post event message to set language, MainWindow class receive it
|
||||
void sig_setLanguage(int language);
|
||||
|
||||
signals:
|
||||
//post event message to open user help document, MainWindow class receive it
|
||||
void sig_open_doc();
|
||||
|
||||
@@ -89,6 +91,7 @@ private:
|
||||
QAction *_about;
|
||||
QAction *_manual;
|
||||
QAction *_issue;
|
||||
IMainForm *_mainForm;
|
||||
};
|
||||
|
||||
} // namespace toolbars
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DSCOMBOBOX_H
|
||||
#define DSCOMBOBOX_H
|
||||
|
||||
@@ -43,4 +42,6 @@ private:
|
||||
int _contentWidth;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // DSCOMBOBOX_H
|
||||
|
||||
@@ -113,7 +113,7 @@ void DevMode::set_device()
|
||||
|
||||
QAction *action = new QAction(this);
|
||||
action->setIcon(QIcon(iconPath+"square-"+icon_name));
|
||||
if (lan == QLocale::Chinese)
|
||||
if (lan == LAN_CN)
|
||||
action->setText(mode->name_cn);
|
||||
else
|
||||
action->setText(mode->name);
|
||||
@@ -124,7 +124,7 @@ void DevMode::set_device()
|
||||
if (dev_inst->dev_inst()->mode == _mode_list[action]->mode) {
|
||||
QString icon_fname = iconPath + icon_name;
|
||||
_mode_btn->setIcon(QIcon(icon_fname));
|
||||
if (lan== QLocale::Chinese)
|
||||
if (lan== LAN_CN)
|
||||
_mode_btn->setText(mode->name_cn);
|
||||
else
|
||||
_mode_btn->setText(mode->name);
|
||||
@@ -180,7 +180,7 @@ void DevMode::on_mode_change()
|
||||
QString icon_fname = iconPath + "/" + QString::fromLocal8Bit((*i).second->icon);
|
||||
|
||||
_mode_btn->setIcon(QIcon(icon_fname));
|
||||
if (lan == QLocale::Chinese)
|
||||
if (lan == LAN_CN)
|
||||
_mode_btn->setText((*i).second->name_cn);
|
||||
else
|
||||
_mode_btn->setText((*i).second->name);
|
||||
|
||||
Reference in New Issue
Block a user