Skip to content

Commit

Permalink
chore: Update UI translations and retranslate widgets
Browse files Browse the repository at this point in the history
Signed-off-by: xiaoming <[email protected]>
  • Loading branch information
QQxiaoming committed Jul 24, 2024
1 parent 127e773 commit 4b06a51
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 12 deletions.
1 change: 1 addition & 0 deletions lib/ptyqt/ptyqt.pri
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ win32:{
win32-msvc*{
HEADERS += $$PWD/conptyprocess.h
SOURCES += $$PWD/conptyprocess.cpp
LIBS += -lAdvapi32
}

LIBS += -lwsock32 -lws2_32 -lcrypt32 -liphlpapi -lnetapi32 -lversion -lwinmm -luserenv
Expand Down
4 changes: 4 additions & 0 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3265,6 +3265,8 @@ void CentralWidget::menuAndToolBarConnectSignals(void) {
startTftpSeverWindow->retranslateUi();
pluginInfoWindow->retranslateUi();
pluginViewerWidget->retranslateUi();
notifictionWidget->retranslateUi();
statusBarWidget->retranslateUi();
foreach(MainWidgetGroup *mainWidgetGroup, mainWidgetGroupList) {
mainWidgetGroup->sessionTab->retranslateUi();
mainWidgetGroup->commandWidget->retranslateUi();
Expand Down Expand Up @@ -3296,6 +3298,7 @@ void CentralWidget::menuAndToolBarConnectSignals(void) {
foreach(SessionsWindow *sessionsWindow, sessionList) {
sessionsWindow->reTranslateUi();
}
statusBarWidget->retranslateUi();
globalOptionsWindow->switchTheme();
GlobalSetting settings;
settings.setValue("Global/Startup/dark_theme","false");
Expand All @@ -3313,6 +3316,7 @@ void CentralWidget::menuAndToolBarConnectSignals(void) {
foreach(SessionsWindow *sessionsWindow, sessionList) {
sessionsWindow->reTranslateUi();
}
statusBarWidget->retranslateUi();
globalOptionsWindow->switchTheme();
GlobalSetting settings;
settings.setValue("Global/Startup/dark_theme","true");
Expand Down
4 changes: 4 additions & 0 deletions src/notifictionwidget/notifictionwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,7 @@ void NotifictionWidget::clearNotifiction(void){
ui->listWidget->setVisible(false);
}
}

void NotifictionWidget::retranslateUi() {
ui->retranslateUi(this);
}
1 change: 1 addition & 0 deletions src/notifictionwidget/notifictionwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class NotifictionWidget : public QWidget
bool removeNotifiction(int32_t index);
bool isEmpty(void);
void clearNotifiction(void);
void retranslateUi(void);

signals:
void notifictionChanged(uint32_t count);
Expand Down
4 changes: 4 additions & 0 deletions src/sessionswindow/sessionswindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,10 @@ int SessionsWindow::startLocalShellSession(const QString &command, ShellType sTp
if(forceUTF8) {
envs.append("LC_CTYPE=UTF-8");
}
QFileInfo fileInfo(workingDirectory);
if(!fileInfo.exists() || !fileInfo.isDir()) {
workingDirectory = QDir::homePath();
}
bool ret = localShell->startProcess(shellPath, args, workingDirectory, envs, term->screenColumnsCount(), term->screenLinesCount());
if(!ret) {
state = Error;
Expand Down
31 changes: 19 additions & 12 deletions src/statusbarwidget/statusbarwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,6 @@ StatusBarWidget::StatusBarWidget(QWidget *parent)
ui->horizontalLayout->addWidget(statusBarSpeedRx);
ui->horizontalLayout->addWidget(statusBarNotifiction);

statusBarCursorInfo->setToolTip(tr("Current Cursor"));
statusBarType->setToolTip(tr("Session Type"));
statusBarTransTx->setToolTip(tr("Upload Total"));
statusBarTransRx->setToolTip(tr("Download Total"));
statusBarSpeedTx->setToolTip(tr("Upload Speed"));
statusBarSpeedRx->setToolTip(tr("Download Speed"));

statusBarCursorInfo->setVisible(false);
statusBarType->setVisible(false);
statusBarTransTx->setVisible(false);
Expand All @@ -67,11 +60,7 @@ StatusBarWidget::StatusBarWidget(QWidget *parent)
statusBarSpeedTx->setEnabled(false);
statusBarSpeedRx->setEnabled(false);

statusBarTransTx->setIcon(QFontIcon::icon(QChar(0xf0ee)));
statusBarTransRx->setIcon(QFontIcon::icon(QChar(0xf0ed)));
statusBarSpeedTx->setIcon(QFontIcon::icon(QChar(0xf0aa)));
statusBarSpeedRx->setIcon(QFontIcon::icon(QChar(0xf0ab)));
statusBarNotifiction->setIcon(QFontIcon::icon(QChar(0xf0a2)));
retranslateUi();

statusBarCursorInfo->setPopupMode(QToolButton::InstantPopup);
statusBarCursorInfo->setAutoRaise(true);
Expand Down Expand Up @@ -259,3 +248,21 @@ void StatusBarWidget::contextMenuEvent(QContextMenuEvent *event) {
}
menu->popup(pos);
}

void StatusBarWidget::retranslateUi()
{
statusBarCursorInfo->setToolTip(tr("Current Cursor"));
statusBarType->setToolTip(tr("Session Type"));
statusBarTransTx->setToolTip(tr("Upload Total"));
statusBarTransRx->setToolTip(tr("Download Total"));
statusBarSpeedTx->setToolTip(tr("Upload Speed"));
statusBarSpeedRx->setToolTip(tr("Download Speed"));

statusBarTransTx->setIcon(QFontIcon::icon(QChar(0xf0ee)));
statusBarTransRx->setIcon(QFontIcon::icon(QChar(0xf0ed)));
statusBarSpeedTx->setIcon(QFontIcon::icon(QChar(0xf0aa)));
statusBarSpeedRx->setIcon(QFontIcon::icon(QChar(0xf0ab)));
statusBarNotifiction->setIcon(QFontIcon::icon(QChar(0xf0a2)));

ui->retranslateUi(this);
}
1 change: 1 addition & 0 deletions src/statusbarwidget/statusbarwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class StatusBarWidget : public QWidget
void setTransInfo(bool enable, int64_t tx = -1, int64_t rx = -1);
void setSpeedInfo(bool enable, qreal tx = -1.0, qreal rx = -1.0);
void setNotifiction(bool enable);
void retranslateUi(void);

StatusBarToolButton *statusBarCursorInfo;
StatusBarToolButton *statusBarType;
Expand Down

0 comments on commit 4b06a51

Please sign in to comment.