mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 00:14:06 +00:00
opt: let qt handle the language direction (#709)
* opt: let qt handle the language direction
* 🎨 apply clang-format changes
* action: modify auto clang format action
---------
Co-authored-by: xiaoyifang <xiaoyifang@users.noreply.github.com>
This commit is contained in:
parent
1e328e0727
commit
d08d5fe576
5
.github/workflows/auto clang format.yml
vendored
5
.github/workflows/auto clang format.yml
vendored
|
@ -28,10 +28,7 @@ jobs:
|
||||||
- name: ubuntu install clang-format
|
- name: ubuntu install clang-format
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get install git lsb-release wget software-properties-common
|
sudo apt-get install git lsb-release wget software-properties-common
|
||||||
wget https://apt.llvm.org/llvm.sh
|
wget -qO - https://apt.llvm.org/llvm.sh| sudo bash
|
||||||
chmod +x llvm.sh
|
|
||||||
sudo ./llvm.sh
|
|
||||||
rm -f llvm.sh
|
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y clang-format
|
sudo apt-get install -y clang-format
|
||||||
git-clang-format --style=file HEAD^
|
git-clang-format --style=file HEAD^
|
||||||
|
|
|
@ -221,17 +221,13 @@ std::string ArticleMaker::makeNotFoundBody( QString const & word,
|
||||||
{
|
{
|
||||||
string result( "<div class=\"gdnotfound\"><p>" );
|
string result( "<div class=\"gdnotfound\"><p>" );
|
||||||
|
|
||||||
QString str( word );
|
|
||||||
if( str.isRightToLeft() )
|
|
||||||
{
|
|
||||||
str.insert( 0, (ushort)0x202E ); // RLE, Right-to-Left Embedding
|
|
||||||
str.append( (ushort)0x202C ); // PDF, POP DIRECTIONAL FORMATTING
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( word.size() )
|
if ( word.size() )
|
||||||
result += tr( "No translation for <b>%1</b> was found in group <b>%2</b>." ).
|
result += tr( "No translation for <b dir=\"%3\">%1</b> was found in group <b>%2</b>." )
|
||||||
arg( QString::fromUtf8( Html::escape( str.toUtf8().data() ).c_str() ), QString::fromUtf8( Html::escape( group.toUtf8().data() ).c_str() ) ).
|
.arg( QString::fromUtf8( Html::escape( word.toUtf8().data() ).c_str() ),
|
||||||
toUtf8().data();
|
QString::fromUtf8( Html::escape( group.toUtf8().data() ).c_str() ),
|
||||||
|
word.isRightToLeft() ? "rtl" : "ltr" )
|
||||||
|
.toUtf8()
|
||||||
|
.data();
|
||||||
else
|
else
|
||||||
result += tr( "No translation was found in group <b>%1</b>." ).
|
result += tr( "No translation was found in group <b>%1</b>." ).
|
||||||
arg( QString::fromUtf8( Html::escape( group.toUtf8().data() ).c_str() ) ).
|
arg( QString::fromUtf8( Html::escape( group.toUtf8().data() ).c_str() ) ).
|
||||||
|
|
|
@ -1789,12 +1789,6 @@ void ArticleView::contextMenuRequested( QPoint const & pos )
|
||||||
// We don't prompt for selections larger or equal to 60 chars, since
|
// We don't prompt for selections larger or equal to 60 chars, since
|
||||||
// it ruins the menu and it's hardly a single word anyway.
|
// it ruins the menu and it's hardly a single word anyway.
|
||||||
|
|
||||||
if( text.isRightToLeft() )
|
|
||||||
{
|
|
||||||
text.insert( 0, (ushort)0x202E ); // RLE, Right-to-Left Embedding
|
|
||||||
text.append( (ushort)0x202C ); // PDF, POP DIRECTIONAL FORMATTING
|
|
||||||
}
|
|
||||||
|
|
||||||
lookupSelection = new QAction( tr( "&Look up \"%1\"" ).
|
lookupSelection = new QAction( tr( "&Look up \"%1\"" ).
|
||||||
arg( text ),
|
arg( text ),
|
||||||
&menu );
|
&menu );
|
||||||
|
|
|
@ -1844,12 +1844,6 @@ void MainWindow::titleChanged( ArticleView * view, QString const & title )
|
||||||
}
|
}
|
||||||
escaped.replace( "&", "&&" );
|
escaped.replace( "&", "&&" );
|
||||||
|
|
||||||
if( escaped.isRightToLeft() )
|
|
||||||
{
|
|
||||||
escaped.insert( 0, (ushort)0x202E ); // RLE, Right-to-Left Embedding
|
|
||||||
escaped.append( (ushort)0x202C ); // PDF, POP DIRECTIONAL FORMATTING
|
|
||||||
}
|
|
||||||
|
|
||||||
int index = ui.tabWidget->indexOf( view );
|
int index = ui.tabWidget->indexOf( view );
|
||||||
if( !escaped.isEmpty() )
|
if( !escaped.isEmpty() )
|
||||||
ui.tabWidget->setTabText( index, escaped );
|
ui.tabWidget->setTabText( index, escaped );
|
||||||
|
@ -1883,13 +1877,7 @@ void MainWindow::updateWindowTitle()
|
||||||
if ( view )
|
if ( view )
|
||||||
{
|
{
|
||||||
QString str = view->getTitle();
|
QString str = view->getTitle();
|
||||||
if( !str.isEmpty() )
|
if ( !str.isEmpty() ) {
|
||||||
{
|
|
||||||
if( str.isRightToLeft() )
|
|
||||||
{
|
|
||||||
str.insert( 0, (ushort)0x202E ); // RLE, Right-to-Left Embedding
|
|
||||||
str.append( (ushort)0x202C ); // PDF, POP DIRECTIONAL FORMATTING
|
|
||||||
}
|
|
||||||
if( !blockUpdateWindowTitle )
|
if( !blockUpdateWindowTitle )
|
||||||
setWindowTitle( tr( "%1 - %2" ).arg( str, "GoldenDict-ng" ) );
|
setWindowTitle( tr( "%1 - %2" ).arg( str, "GoldenDict-ng" ) );
|
||||||
blockUpdateWindowTitle = false;
|
blockUpdateWindowTitle = false;
|
||||||
|
@ -4423,10 +4411,6 @@ QString MainWindow::unescapeTabHeader(QString const & header )
|
||||||
|
|
||||||
QString escaped = header;
|
QString escaped = header;
|
||||||
escaped.replace( "&&", "&" );
|
escaped.replace( "&&", "&" );
|
||||||
if( escaped.startsWith( QChar( 0x202E ) ) )
|
|
||||||
escaped = escaped.mid( 1 );
|
|
||||||
if( escaped.endsWith( QChar( 0x202C ) ) )
|
|
||||||
escaped.chop( 1 );
|
|
||||||
|
|
||||||
return escaped;
|
return escaped;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue