From 83a82decdd28a4af8c6e439944a7d91576c56750 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 4 Jan 2011 10:29:54 +0100 Subject: [PATCH] Windows look'n'feel tweaks --- locale/lupdate.sh | 0 minitube.pro | 0 resources.qrc | 0 src/AboutView.cpp | 6 +++--- src/ListModel.cpp | 0 src/ListModel.h | 0 src/MainWindow.cpp | 14 ++++++++++++-- src/MainWindow.h | 0 src/SearchView.cpp | 6 +++--- src/constants.h | 0 src/downloaditem.cpp | 2 +- src/fontutils.cpp | 4 ++++ src/main.cpp | 11 +++++++++++ src/thlibrary/thblackbar.cpp | 2 +- src/video.cpp | 1 + 15 files changed, 36 insertions(+), 10 deletions(-) mode change 100755 => 100644 locale/lupdate.sh mode change 100755 => 100644 minitube.pro mode change 100755 => 100644 resources.qrc mode change 100755 => 100644 src/ListModel.cpp mode change 100755 => 100644 src/ListModel.h mode change 100755 => 100644 src/MainWindow.cpp mode change 100755 => 100644 src/MainWindow.h mode change 100755 => 100644 src/constants.h mode change 100755 => 100644 src/main.cpp diff --git a/locale/lupdate.sh b/locale/lupdate.sh old mode 100755 new mode 100644 diff --git a/minitube.pro b/minitube.pro old mode 100755 new mode 100644 diff --git a/resources.qrc b/resources.qrc old mode 100755 new mode 100644 diff --git a/src/AboutView.cpp b/src/AboutView.cpp index 1a0ec17..9342f91 100644 --- a/src/AboutView.cpp +++ b/src/AboutView.cpp @@ -21,7 +21,7 @@ AboutView::AboutView(QWidget *parent) : QWidget(parent) { "

" + tr("There's life outside the browser!") + "

" "

" + tr("Version %1").arg(Constants::VERSION) + "

" + QString("

%1

").arg(Constants::WEBSITE) + -#if !defined(APP_MAC) && !defined(Q_WS_WIN) +#if !defined(APP_MAC) && !defined(APP_WIN) "

" + tr("%1 is Free Software but its development takes precious time.").arg(Constants::APP_NAME) + "
" + tr("Please donate to support the continued development of %2.") .arg(QString(Constants::WEBSITE).append("#donate"), Constants::APP_NAME) + "

" @@ -30,7 +30,7 @@ AboutView::AboutView(QWidget *parent) : QWidget(parent) { .arg(QString("%1").arg(Constants::EMAIL)) + "

" "

" - + tr("Icon designed by %1.").arg("Sebastian Kraft") + + tr("Icon designed by %1.").arg("David Nel") + "
" + tr("Compact mode contributed by %1.").arg("Stefan Brück") + "
" + tr("HTTP proxy support contributed by %1.").arg("Kiwamu Okabe") + "

" @@ -62,7 +62,7 @@ AboutView::AboutView(QWidget *parent) : QWidget(parent) { "Changtai Liang (zh_CN), " "Veta Branislav (mkd_MKD)" ) + "

" -#if !defined(APP_MAC) && !defined(Q_WS_WIN) +#if !defined(APP_MAC) && !defined(APP_WIN) "

" + tr("Released under the GNU General Public License") .arg("http://www.gnu.org/licenses/gpl.html") + "

" #endif diff --git a/src/ListModel.cpp b/src/ListModel.cpp old mode 100755 new mode 100644 diff --git a/src/ListModel.h b/src/ListModel.h old mode 100755 new mode 100644 diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp old mode 100755 new mode 100644 index c4c00b0..d5130ef --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -359,7 +359,9 @@ void MainWindow::createMenus() { helpMenu = menuBar()->addMenu(tr("&Help")); helpMenu->addAction(siteAct); +#if !defined(APP_MAC) && !defined(APP_WIN) helpMenu->addAction(donateAct); +#endif helpMenu->addAction(aboutAct); } @@ -370,13 +372,21 @@ void MainWindow::createToolBars() { mainToolBar = new QToolBar(this); #if QT_VERSION < 0x040600 | defined(APP_MAC) mainToolBar->setToolButtonStyle(Qt::ToolButtonIconOnly); +#elif defined(APP_WIN) + mainToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); + mainToolBar->setStyleSheet( + "QToolBar {" + "background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #fff, stop:1 #ccc);" + "border: 0;" + "border-bottom: 1px solid #a0afc3;" + "}"); #else mainToolBar->setToolButtonStyle(Qt::ToolButtonFollowStyle); #endif mainToolBar->setFloatable(false); mainToolBar->setMovable(false); -#ifdef APP_MAC +#if defined(APP_MAC) | defined(APP_WIN) mainToolBar->setIconSize(QSize(32, 32)); #endif @@ -447,7 +457,7 @@ void MainWindow::createStatusBar() { // remove ugly borders on OSX // also remove excessive spacing - statusBar()->setStyleSheet("::item{border:0 solid} QToolBar {padding:0;spacing:0;margin:0}"); + statusBar()->setStyleSheet("::item{border:0 solid} QToolBar {padding:0;spacing:0;margin:0;border:0}"); QToolBar *toolBar = new QToolBar(this); toolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); diff --git a/src/MainWindow.h b/src/MainWindow.h old mode 100755 new mode 100644 diff --git a/src/SearchView.cpp b/src/SearchView.cpp index eda7d87..0e6deb3 100644 --- a/src/SearchView.cpp +++ b/src/SearchView.cpp @@ -14,7 +14,7 @@ SearchView::SearchView(QWidget *parent) : QWidget(parent) { QFont biggerFont = FontUtils::big(); QFont smallerFont = FontUtils::smallBold(); -#ifdef APP_MAC +#if defined(APP_MAC) | defined(APP_WIN) // speedup painting since we'll paint the whole background // by ourselves anyway in paintEvent() setAttribute(Qt::WA_OpaquePaintEvent); @@ -115,7 +115,7 @@ SearchView::SearchView(QWidget *parent) : QWidget(parent) { recentKeywordsLayout->setSpacing(5); recentKeywordsLayout->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); recentKeywordsLabel = new QLabel(tr("Recent keywords").toUpper(), this); -#ifdef APP_MAC +#if defined(APP_MAC) | defined(APP_WIN) QPalette palette = recentKeywordsLabel->palette(); palette.setColor(QPalette::WindowText, QColor(0x65, 0x71, 0x80)); recentKeywordsLabel->setPalette(palette); @@ -244,7 +244,7 @@ void SearchView::gotNewVersion(QString version) { } void SearchView::paintEvent(QPaintEvent * /*event*/) { -#ifdef APP_MAC +#if defined(APP_MAC) | defined(APP_WIN) QBrush brush; if (window()->isActiveWindow()) { brush = QBrush(QColor(0xdd, 0xe4, 0xeb)); diff --git a/src/constants.h b/src/constants.h old mode 100755 new mode 100644 diff --git a/src/downloaditem.cpp b/src/downloaditem.cpp index 1219fb4..dd5b278 100644 --- a/src/downloaditem.cpp +++ b/src/downloaditem.cpp @@ -90,7 +90,7 @@ void DownloadItem::tryAgain() { void DownloadItem::downloadReadyRead() { if (!m_file.isOpen()) { - if (!m_file.open(QIODevice::WriteOnly)) { + if (!m_file.open(QIODevice::ReadWrite)) { qDebug() << QString("Error opening output file: %1").arg(m_file.errorString()); stop(); emit statusChanged(); diff --git a/src/fontutils.cpp b/src/fontutils.cpp index 05384b8..c5300b6 100644 --- a/src/fontutils.cpp +++ b/src/fontutils.cpp @@ -1,11 +1,14 @@ #include "fontutils.h" +static const int MIN_PIXEL_SIZE = 11; + const QFont FontUtils::small() { static QFont font; static bool initialized = false; if (!initialized) { initialized = true; font.setPointSize(font.pointSize()*.85); + if (font.pixelSize() < MIN_PIXEL_SIZE) font.setPixelSize(MIN_PIXEL_SIZE); } return font; } @@ -17,6 +20,7 @@ const QFont FontUtils::smallBold() { initialized = true; font.setPointSize(font.pointSize()*.85); font.setBold(true); + if (font.pixelSize() < MIN_PIXEL_SIZE) font.setPixelSize(MIN_PIXEL_SIZE); } return font; } diff --git a/src/main.cpp b/src/main.cpp old mode 100755 new mode 100644 index ddb24a8..6f0385f --- a/src/main.cpp +++ b/src/main.cpp @@ -5,6 +5,9 @@ #ifdef APP_MAC // #include "local/mac/mac_startup.h" #endif +#ifdef APP_WIN +#include "local/win/qtwin.h" +#endif int main(int argc, char **argv) { @@ -66,6 +69,14 @@ int main(int argc, char **argv) { mainWin.setWindowIcon(appIcon); #endif +#ifdef APP_WIN + if (QtWin::isCompositionEnabled()) { + QtWin::extendFrameIntoClientArea(&mainWin); + mainWin.setContentsMargins(0, 0, 0, 0); + } + app.setFont(QFont("Segoe UI", 9)); +#endif + mainWin.show(); app.setActivationWindow(&mainWin, true); diff --git a/src/thlibrary/thblackbar.cpp b/src/thlibrary/thblackbar.cpp index 4101be0..6ea1b89 100644 --- a/src/thlibrary/thblackbar.cpp +++ b/src/thlibrary/thblackbar.cpp @@ -244,7 +244,7 @@ void THBlackBar::drawButton ( QPainter *painter, painter->fillRect(0, 0, width, mh, QBrush(gradient)); painter->fillRect(0, mh, width, mh, color); -#ifdef APP_MAC +#if defined(APP_MAC) | defined(APP_WIN) painter->drawRect(-1, -1, width+1, height); #else painter->drawRect(0, 0, width, height); diff --git a/src/video.cpp b/src/video.cpp index 7b7a803..d0eb7c0 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -148,6 +148,7 @@ void Video::gotVideoInfo(QByteArray data) { QString url = formatUrl.mid(separator + 1); if (format == definitionCode) { + qDebug() << "Found format" << definitionCode; QUrl videoUrl = QUrl::fromEncoded(url.toUtf8(), QUrl::StrictMode); m_streamUrl = videoUrl; emit gotStreamUrl(videoUrl); -- 2.39.5