diff --git a/mainwindow.cc b/mainwindow.cc index c4b91908..a392a616 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -445,7 +445,6 @@ MainWindow::MainWindow( Config::Class & cfg_ ): closeCurrentTabAction.setShortcutContext( Qt::WidgetWithChildrenShortcut ); closeCurrentTabAction.setShortcut( QKeySequence( "Ctrl+W" ) ); closeCurrentTabAction.setText( tr("Close current tab") ); - closeCurrentTabAction.setIcon( QIcon(":/icons/closetab-hover.png") ); connect( &closeCurrentTabAction, SIGNAL( triggered() ), this, SLOT( closeCurrentTab() ) ); @@ -1226,13 +1225,11 @@ void MainWindow::applyQtStyleSheet( QString const & displayStyle, QString const css += macCssFile.readAll(); #endif - if ( displayStyle.size() ) - { - // Load an additional stylesheet - QFile builtInCssFile( QString( ":/qt-style-st-%1.css" ).arg( displayStyle ) ); - if ( builtInCssFile.open( QFile::ReadOnly ) ) - css += builtInCssFile.readAll(); - } +#if defined(Q_OS_WIN) + QFile winCssFile( ":/qt-style-win.css" ); + winCssFile.open( QFile::ReadOnly ); + css += winCssFile.readAll(); +#endif // Try loading a style sheet if there's one QFile cssFile( Config::getUserQtCssFileName() ); diff --git a/qt-style-macos.css b/qt-style-macos.css index 80ba54b2..e69de29b 100644 --- a/qt-style-macos.css +++ b/qt-style-macos.css @@ -1,32 +0,0 @@ -#navToolbar #translateLine -{ - margin-top: 1px; -} - -#navToolbar GroupComboBox -{ - margin-bottom: 1px; - margin-top: 0px; - padding: 2px 18px 2px 4px; -} - -#navToolbar GroupComboBox::drop-down { - padding-right: 2px; - border-right: 1px solid darkgray; -} - -ScanPopup #translateLine -{ - padding: 3px 3px 3px 3px; -} - -ScanPopup GroupComboBox -{ - margin: 2px 0px 4px 1px; - padding: 1px 18px 1px 4px; -} - -ScanPopup GroupComboBox::drop-down { - padding-right: 2px; - border-right: 1px solid darkgray; -} diff --git a/qt-style-st-babylon.css b/qt-style-st-babylon.css deleted file mode 100644 index 6368f32a..00000000 --- a/qt-style-st-babylon.css +++ /dev/null @@ -1,10 +0,0 @@ -MainWindow #translateLine, ScanPopup #translateLine, MainWindow #searchPane #wordList, MainWindow #dictsPane #dictsList, -MainWindow #historyPane #historyList, MainWindow #favoritesPane #favoritesTree -{ - -} - -MainWindow #searchPane #translateLine -{ - font-weight: bold; -} diff --git a/qt-style-st-classic.css b/qt-style-st-classic.css deleted file mode 100644 index 8d7a196e..00000000 --- a/qt-style-st-classic.css +++ /dev/null @@ -1,143 +0,0 @@ -MainWindow #translateLine, ScanPopup #translateLine, MainWindow #wordList, MainWindow #dictsPane #dictsList, MainWindow #historyPane #historyList, MainWindow #favoritesPane #favoritesTree -{ - background: #fefdeb; - color: black; -} - -MainWindow #translateLine[noResults="true"], -ScanPopup #translateLine[noResults="true"] -{ - background: #febb7d; -} - -#navToolbar #menuButton::menu-indicator { - image: none; -} - -#navToolbar #translateLine -{ - border: 1px solid gray; - border-radius: 3px; - padding: 1px 3px 2px 3px; - border-top-left-radius: 0px; - border-bottom-left-radius: 0px; - margin-left: 0px; -} - -#navToolbar GroupComboBox -{ - margin-right: 0px; - border: 1px solid gray; - border-right: 1px transparent; - border-radius: 3px; - border-top-right-radius: 0px; - border-bottom-right-radius: 0px; - padding: 2px 4px 2px 4px; -} - -#navToolbar GroupComboBox:on { - padding: 3px 3px 1px 5px; -} - -#navToolbar GroupComboBox::drop-down { - subcontrol-origin: padding; - subcontrol-position: top right; - width: 15px; - border-left: 1px solid darkgray; - border-right: 1px transparent; -} - -#navToolbar GroupComboBox::down-arrow { - image: url(:/icons/1downarrow.svg); - max-height: 100%; -} - -QTabBar::close-button { - image: url(:/icons/closetab.svg) -} -QTabBar::close-button:hover { - image: url(:/icons/closetab-hover.png) -} - - -ArticleView #searchText[noResults="true"] -{ - background: #febb7d; -} - -MainStatusBar #text -{ - border-top-right-radius: 3px; - border-top: 1px solid palette(dark); - border-right: 1px solid palette(dark); - background: palette(window); - padding: 2px; -} - -MainStatusBar #icon -{ - border-top: 1px solid palette(dark); - background: palette(window); - padding: 2px; - padding-left: 4px; - padding-right: 0px; -} - -ScanPopup #translateLine -{ - margin: 0px; - padding: 1px 3px 1px 3px; - border: 1px solid gray; - border-radius: 3px; - border-top-left-radius: 0px; - border-bottom-left-radius: 0px; -} - -ScanPopup GroupComboBox -{ - margin: 0px 0px 0px 1px; - padding: 1px 4px 1px 4px; - border: 1px solid gray; - border-right: 1px transparent; - border-radius: 3px; - border-top-right-radius: 0px; - border-bottom-right-radius: 0px; -} - -ScanPopup GroupComboBox:on { - padding: 3px 3px 1px 5px; -} - -ScanPopup GroupComboBox::drop-down { - subcontrol-origin: padding; - subcontrol-position: top right; - width: 15px; - border-left: 1px solid darkgray; - border-right: 1px transparent; -} - -ScanPopup GroupComboBox::down-arrow { - image: url(:/icons/1downarrow.svg); - max-height: 100%; -} - -.ScanPopup #outerFrame -{ - border: 1px solid palette(dark); -} - -.ScanPopup MainStatusBar #text -{ - border-bottom: 1px solid palette(dark); -} - -.ScanPopup MainStatusBar[hasImage="false"] #text -{ - border-left: 1px solid palette(dark); -} - -.ScanPopup MainStatusBar #icon -{ - border-left: 1px solid palette(dark); - border-bottom: 1px solid palette(dark); -} diff --git a/qt-style-st-lingoes-blue.css b/qt-style-st-lingoes-blue.css deleted file mode 100644 index 4a454919..00000000 --- a/qt-style-st-lingoes-blue.css +++ /dev/null @@ -1,76 +0,0 @@ -MainWindow { - background-color: #CFDDF0; -} - -MainWindow #menubar { - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, - stop:0 #F0F6FF, stop:0.5 #D2E0F5, stop:0.9 #DCEBFF, stop:1 #F0F6FF); -} - -MainWindow #menubar::item { - padding: 2px 8px; - background: transparent; -} - -MainWindow #menubar::item:selected { /* when selected using mouse or keyboard */ - background: #839EC7; -} - -MainWindow #menubar::item:pressed { - background: #728AAD; -} - -MainWindow #translateLine, ScanPopup #translateLine, MainWindow #wordList { - background-color: #fff; -} - -MainWindow #centralWidget QTabBar::tab { - border: 1px solid #667B9B; - border-bottom-color: #667B9B; - border-top-left-radius: 4px; - border-top-right-radius: 4px; - padding: 1px 3px; - margin-left: 1px; - margin-top: 2px; - margin-bottom: 2px; - background-color: #CFDDF0; - color: darkslategray; -} - -MainWindow #centralWidget QTabBar::tab:selected { - background-color: #839EC7; - color: #fff; - border-bottom-style: none; -} - -MainWindow #dictsPane #dictsList { - background: #EAF0F8; - color: darkblue; -} - -ArticleView #searchFrame QMenu {background-color: none} -ArticleView QMenu {background-color: none} - -QMainWindow::separator { - width: 1px; /* when vertical */ - height: 1px; /* when horizontal */ -} - -#dictsPaneTitleBar { - margin: 2px; -} - -/* Colored header for the History Pane */ -#historyPaneTitleBar { - margin: 2px; -} - -ScanPopup #outerFrame -{ - background-color: #CEDDEF; -} - -ScanPopup #dictionaryBar -{ - background: #CEDDEF; -} diff --git a/qt-style-st-lingoes.css b/qt-style-st-lingoes.css deleted file mode 100644 index e68e6ced..00000000 --- a/qt-style-st-lingoes.css +++ /dev/null @@ -1,5 +0,0 @@ -MainWindow #translateLine, ScanPopup #translateLine, MainWindow #wordList, MainWindow #dictsPane #dictsList, MainWindow #historyPane #historyList, MainWindow #favoritesPane #favoritesTree -{ - background: #fefdeb; - color: black; -} \ No newline at end of file diff --git a/qt-style-st-lingvo.css b/qt-style-st-lingvo.css deleted file mode 100644 index 3decae50..00000000 --- a/qt-style-st-lingvo.css +++ /dev/null @@ -1,6 +0,0 @@ -MainWindow #translateLine, ScanPopup #translateLine, MainWindow #wordList, MainWindow #dictsPane #dictsList, -MainWindow #historyPane #historyList, MainWindow #favoritesPane #favoritesTree -{ - background: white; - color: black; -} diff --git a/qt-style-st-modern.css b/qt-style-st-modern.css deleted file mode 100644 index 81dea89c..00000000 --- a/qt-style-st-modern.css +++ /dev/null @@ -1,63 +0,0 @@ -MainWindow #translateLine, ScanPopup #translateLine, MainWindow #wordList, MainWindow #dictsPane #dictsList, -MainWindow #historyPane #historyList, MainWindow #favoritesPane #favoritesTree -{ - -} - -/* WARNING: hides all separators! */ -#navToolbar::separator { - width: 0px; -} - -/* Another way to hide specific separators */ -#navToolbar #beforeOptionsSeparator, #navToolbar #beforeScanPopupSeparator, #navToolbar #afterScanPopupSeparator, #navToolbar #separatorBeforeZoom, #navToolbar #separatorBeforeSave { - background: rgba(0,0,0,0%); - width: 0px; - margin: -3px; -} - -/* Hide various buttons in the toolbar: */ -#navToolbar #menuButtonXX, #navToolbar #soundButtonXX, #navToolbar #backButtonXX, #navToolbar #forwardButtonXX, #navToolbar #zoomInButtonXX, #navToolbar #zoomOutButtonXX, #navToolbar #zoomBaseButtonXX, #navToolbar #saveArticleButton, #navToolbar #printButton { - width: 0px; - height: 0px; - margin: -3px; -} - -/* remove the main toolbar handle */ -#navToolbar::handle, #dictionaryBar::handle { - image: none; -} - -#navToolbar #scanPopupButton { - margin-left: 5px; -} - -/* Colored header for the "Found in Dictionaries:" pane */ -#dictsPaneTitleBar { - margin: 2px; -} - -/* Colored header for the History Pane */ -#historyPaneTitleBar { - margin: 2px; -} - -/* Thin separators between the main UI and sidebars */ -QMainWindow::separator { - width: 1px; /* when vertical */ - height: 1px; /* when horizontal */ -} - -ScanPopup #goBackButtonAA, -/* ScanPopup #queryError, */ -ScanPopup #goForwardButtonAA, -ScanPopup #wordListButtonXX, -ScanPopup #pronounceButtonAA, -ScanPopup #sendWordButtonXX -/* ScanPopup #showDictionaryBar, */ -/* ScanPopup #pinButton */ -{ - width: 0px; - height: 0px; - margin: -4px; -} diff --git a/qt-style-win.css b/qt-style-win.css new file mode 100644 index 00000000..a1acc05a --- /dev/null +++ b/qt-style-win.css @@ -0,0 +1,6 @@ +QTabBar::close-button { + image: url(:/icons/closetab.svg) +} +QTabBar::close-button:hover { + image: url(:/icons/closetab-hover.png) +} \ No newline at end of file diff --git a/qt-style.css b/qt-style.css index 9cf529f1..4b1c87ff 100644 --- a/qt-style.css +++ b/qt-style.css @@ -1,140 +1,107 @@ -MainWindow #translateLine, ScanPopup #translateLine, MainWindow #wordList, MainWindow #dictsPane #dictsList, MainWindow #historyPane #historyList, MainWindow #favoritesPane #favoritesTree -{ +MainWindow #translateLine, ScanPopup #translateLine, MainWindow #wordList, MainWindow #dictsPane #dictsList, MainWindow #historyPane #historyList, MainWindow #favoritesPane #favoritesTree { } -MainWindow #translateLine[noResults="true"], -ScanPopup #translateLine[noResults="true"] { +#translateLine { + color: palette(Text); /* ensure the text is inverse of the background, and also placehold text is grey */ +} + +#translateLine[noResults="true"] { background: #febb7d; } #navToolbar #menuButton::menu-indicator { - image: none; + image: none; } -#navToolbar #translateLine -{ - border: 1px solid gray; - border-radius: 3px; - padding: 1px 3px 2px 3px; - border-top-left-radius: 0px; - border-bottom-left-radius: 0px; - margin-left: 0px; +#navToolbar #translateLine { + border: 1px solid gray; + border-radius: 3px; + padding: 1px 3px 2px 3px; + border-top-left-radius: 0; + border-bottom-left-radius: 0; + margin-left: 0; } -#navToolbar GroupComboBox -{ - margin-right: 0px; - border: 1px solid gray; - border-right: 1px transparent; - border-radius: 3px; - border-top-right-radius: 0px; - border-bottom-right-radius: 0px; - padding: 2px 4px 2px 4px; +GroupComboBox { + margin-right: 0; + border: 1px solid gray; + border-right: 1px transparent; + border-radius: 3px; + border-top-right-radius: 0; + border-bottom-right-radius: 0; + padding: 2px 4px 2px 4px; + + background: palette(window); /* Distinguish the combobox from the translate line by make it darker*/ + color: palette(Text); } -#navToolbar GroupComboBox:on { - padding: 3px 3px 1px 5px; +GroupComboBox:on { + padding: 3px 3px 1px 5px; } -#navToolbar GroupComboBox::drop-down { - subcontrol-origin: padding; - subcontrol-position: top right; - width: 15px; - border-left: 1px solid darkgray; - border-right: 1px transparent; +GroupComboBox::drop-down { + subcontrol-origin: padding; + subcontrol-position: top right; + width: 15px; + border-left: 1px solid darkgray; + border-right: 1px transparent; + + /* Hack: For unknown reason, if the padding right is unset, the drop-down won't show full content */ + padding-right: 4px; + border-right: 1px solid darkgray; + /* Hack: end*/ + } -#navToolbar GroupComboBox::down-arrow { +GroupComboBox::down-arrow { image: url(:/icons/1downarrow.svg); max-height: 100%; } -QTabBar::close-button { - image: url(:/icons/closetab.svg) + +ArticleView #searchText[noResults="true"] { + background: #febb7d; } -QTabBar::close-button:hover { - image: url(:/icons/closetab-hover.png) + +MainStatusBar #text { + border-top-right-radius: 3px; + border-top: 1px solid palette(dark); + border-right: 1px solid palette(dark); + background: palette(window); + padding: 2px; +} + +MainStatusBar #icon { + border-top: 1px solid palette(dark); + background: palette(window); + padding: 2px; + padding-left: 4px; + padding-right: 0; +} + +ScanPopup #translateLine { + margin: 0; + padding: 1px 3px 1px 3px; + border: 1px solid gray; + border-radius: 3px; + border-top-left-radius: 0; + border-bottom-left-radius: 0; } -ArticleView #searchText[noResults="true"] -{ - background: #febb7d; +.ScanPopup #outerFrame { + border: 1px solid palette(dark); } -MainStatusBar #text -{ - border-top-right-radius: 3px; - border-top: 1px solid palette(dark); - border-right: 1px solid palette(dark); - background: palette(window); - padding: 2px; +.ScanPopup MainStatusBar #text { + border-bottom: 1px solid palette(dark); } -MainStatusBar #icon -{ - border-top: 1px solid palette(dark); - background: palette(window); - padding: 2px; - padding-left: 4px; - padding-right: 0px; +.ScanPopup MainStatusBar[hasImage="false"] #text { + border-left: 1px solid palette(dark); } -ScanPopup #translateLine -{ - margin: 0px; - padding: 1px 3px 1px 3px; - border: 1px solid gray; - border-radius: 3px; - border-top-left-radius: 0px; - border-bottom-left-radius: 0px; -} - -ScanPopup GroupComboBox -{ - margin: 0px 0px 0px 1px; - padding: 1px 4px 1px 4px; - border: 1px solid gray; - border-right: 1px transparent; - border-radius: 3px; - border-top-right-radius: 0px; - border-bottom-right-radius: 0px; -} - -ScanPopup GroupComboBox:on { - padding: 3px 3px 1px 5px; -} - -ScanPopup GroupComboBox::drop-down { - subcontrol-origin: padding; - subcontrol-position: top right; - width: 15px; - border-left: 1px solid darkgray; - border-right: 1px transparent; -} - -ScanPopup GroupComboBox::down-arrow { - image: url(:/icons/1downarrow.svg); - max-height: 100%; -} - -.ScanPopup #outerFrame -{ - border: 1px solid palette(dark); -} - -.ScanPopup MainStatusBar #text -{ - border-bottom: 1px solid palette(dark); -} - -.ScanPopup MainStatusBar[hasImage="false"] #text -{ - border-left: 1px solid palette(dark); -} - -.ScanPopup MainStatusBar #icon -{ - border-left: 1px solid palette(dark); - border-bottom: 1px solid palette(dark); +.ScanPopup MainStatusBar #icon { + border-left: 1px solid palette(dark); + border-bottom: 1px solid palette(dark); } diff --git a/resources.qrc b/resources.qrc index 3fedf64c..91bd81e3 100644 --- a/resources.qrc +++ b/resources.qrc @@ -18,7 +18,6 @@ icons/icon32_hunspell.png icons/icon32_wiki.png icons/wiktionary.png - qt-style-st-lingvo.css article-style-st-lingvo.css icons/icon_dsl_native.png icons/forvo.png @@ -31,16 +30,14 @@ icons/expand_opt.png icons/collapse_opt.png article-style-st-babylon.css - qt-style-st-babylon.css icons/menu_button.svg icons/clear.png article-style-st-modern.css - qt-style-st-modern.css article-style-st-lingoes.css icons/icon32_lingoes.png article-style-st-lingoes-blue.css - qt-style-st-lingoes-blue.css qt-style-macos.css + qt-style-win.css icons/mdict.png icons/downarrow.png icons/blank.png @@ -100,9 +97,7 @@ icons/wizard-selected.svg icons/mdict-bg.png article-style-st-classic.css - qt-style-st-classic.css icons/old-arrow.png icons/old-downarrow.png - qt-style-st-lingoes.css diff --git a/sonar-project.properties b/sonar-project.properties index 4bf63e55..0318ffc8 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,4 +1,4 @@ -sonar.projectKey=xiaoyifang_goldendict +sonar.projectKey=goldendict sonar.organization=xiaoyifang # This is the name and version displayed in the SonarCloud UI.