• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqtwindows誰得cocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

Commit MetaInfo

Revision0b9c3e826a9f9ea67f18e4156ca9991de64757aa (tree)
Zeit2014-04-03 16:38:27
Autorjakago <jakago777@gmai...>
Commiterjakago

Log Message

Qt5への対応(Q_WS関連)

Ändern Zusammenfassung

Diff

--- a/CaptureStream.pro
+++ b/CaptureStream.pro
@@ -25,7 +25,8 @@ HEADERS += mainwindow.h \
2525 scrambledialog.h \
2626 utility.h \
2727 mp3.h \
28- urldownloader.h
28+ urldownloader.h \
29+ qt4qt5.h
2930 FORMS += mainwindow.ui \
3031 customizedialog.ui \
3132 messagewindow.ui \
--- a/downloadthread.cpp
+++ b/downloadthread.cpp
@@ -28,6 +28,7 @@
2828 #include "urldownloader.h"
2929 #include "utility.h"
3030 #include "mp3.h"
31+#include "qt4qt5.h"
3132
3233 #include <QCheckBox>
3334 #include <QDir>
@@ -47,7 +48,7 @@
4748 //#include <QtCrypto>
4849 #include <QTemporaryFile>
4950
50-#ifdef Q_WS_WIN
51+#ifdef QT4_QT5_WIN
5152 #define TimeOut " -m 10000 "
5253 #else
5354 #define TimeOut " -m 10 "
@@ -127,7 +128,7 @@ bool DownloadThread::checkExecutable( QString path ) {
127128
128129 bool DownloadThread::isFfmpegAvailable( QString& path ) {
129130 path = Utility::applicationBundlePath() + "ffmpeg";
130-#ifdef Q_WS_WIN
131+#ifdef QT4_QT5_WIN
131132 path += ".exe";
132133 #endif
133134 return checkExecutable( path );
@@ -182,7 +183,7 @@ void DownloadThread::downloadENews( bool re_read ) {
182183 QString flv_app( "flv9/_definst_/" );
183184 QString flv_service_prefix_20090330( re_read ? "mp3:e-news-flv/" : "e-news-flv/" );
184185 QString flv_service_prefix_20090728( re_read ? "mp3:e-news-flv/" : "e-news/data/" );
185-#ifdef Q_WS_WIN
186+#ifdef QT4_QT5_WIN
186187 QString null( "nul" );
187188 #else
188189 QString null( "/dev/null" );
@@ -318,7 +319,7 @@ void DownloadThread::downloadShower() {
318319 QString flv_host = "flv.nhk.or.jp";
319320 QString flv_app = "ondemand/flv/";
320321 QString flv_service_prefix( "worldwave/common/movie/" );
321-#ifdef Q_WS_WIN
322+#ifdef QT4_QT5_WIN
322323 QString null( "nul" );
323324 #else
324325 QString null( "/dev/null" );
@@ -518,7 +519,7 @@ bool DownloadThread::captureStream( QString kouza, QString hdate, QString file )
518519 QString extension = ui->comboBox_extension->currentText();
519520 outFileName = outBasename + "." + extension;
520521
521-#ifdef Q_WS_WIN
522+#ifdef QT4_QT5_WIN
522523 QString null( "nul" );
523524 #else
524525 QString null( "/dev/null" );
@@ -540,7 +541,7 @@ bool DownloadThread::captureStream( QString kouza, QString hdate, QString file )
540541
541542 Q_ASSERT( ffmpegHash.contains( extension ) );
542543 QString dstPath;
543-#ifdef Q_WS_WIN
544+#ifdef QT4_QT5_WIN
544545 if ( true ) {
545546 QTemporaryFile file;
546547 if ( file.open() ) {
@@ -590,7 +591,7 @@ bool DownloadThread::captureStream( QString kouza, QString hdate, QString file )
590591 QFile::remove( dstPath );
591592 return false;
592593 } else {
593-#ifdef Q_WS_WIN
594+#ifdef QT4_QT5_WIN
594595 QFile::rename( dstPath, outputDir + outFileName );
595596 #endif
596597 return true;
--- a/main.cpp
+++ b/main.cpp
@@ -20,6 +20,7 @@
2020
2121 #include "mainwindow.h"
2222 #include "utility.h"
23+#include "qt4qt5.h"
2324
2425 #include <QtGui/QApplication>
2526 #include <stdio.h>
@@ -27,7 +28,7 @@
2728 int main(int argc, char *argv[])
2829 {
2930 #if defined(QT_NO_DEBUG)
30-#ifdef Q_WS_WIN
31+#ifdef QT4_QT5_WIN
3132 const char* null = "nul";
3233 #else
3334 const char* null = "/dev/null";
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -24,6 +24,7 @@
2424 #include "customizedialog.h"
2525 #include "scrambledialog.h"
2626 #include "utility.h"
27+#include "qt4qt5.h"
2728
2829 #include <QMessageBox>
2930 #include <QByteArray>
@@ -82,7 +83,7 @@ MainWindow::MainWindow( QWidget *parent )
8283 settings( ReadMode );
8384 this->setWindowTitle( this->windowTitle() + version() );
8485
85-#ifdef Q_WS_MAC // Macのウィンドウにはメニューが出ないので縦方向に縮める
86+#ifdef QT4_QT5_MAC // Macのウィンドウにはメニューが出ないので縦方向に縮める
8687 setMaximumHeight( maximumHeight() - menuBar()->height() );
8788 setMinimumHeight( maximumHeight() - menuBar()->height() );
8889 QRect rect = geometry();
@@ -90,7 +91,7 @@ MainWindow::MainWindow( QWidget *parent )
9091 rect.moveTop( rect.top() + menuBar()->height() ); // 4.6.3だとこれがないとウィンドウタイトルがメニューバーに隠れる
9192 setGeometry( rect );
9293 #endif
93-#ifdef Q_WS_X11 // Linuxでは高さが足りなくなるので縦方向に伸ばしておく
94+#ifdef Q_OS_LINUX // Linuxでは高さが足りなくなるので縦方向に伸ばしておく
9495 setMaximumHeight( maximumHeight() + X11_WINDOW_VERTICAL_INCREMENT );
9596 setMinimumHeight( maximumHeight() + X11_WINDOW_VERTICAL_INCREMENT );
9697 QRect rect = geometry();
@@ -98,7 +99,7 @@ MainWindow::MainWindow( QWidget *parent )
9899 setGeometry( rect );
99100 #endif
100101
101-#if !defined( Q_WS_MAC ) && !defined( Q_WS_WIN )
102+#if !defined( QT4_QT5_MAC ) && !defined( QT4_QT5_WIN )
102103 QPoint bottomLeft = geometry().bottomLeft();
103104 bottomLeft += QPoint( 0, menuBar()->height() + statusBar()->height() + 3 );
104105 messagewindow.move( bottomLeft );
@@ -206,7 +207,7 @@ void MainWindow::settings( enum ReadWriteMode mode ) {
206207
207208 if ( mode == ReadMode ) { // 設定読み込み
208209 QVariant saved;
209-#if defined( Q_WS_MAC ) || defined( Q_WS_WIN ) // X11では正しく憶えられないので位置をリストアしない
210+#if defined( QT4_QT5_MAC ) || defined( QT4_QT5_WIN ) // X11では正しく憶えられないので位置をリストアしない
210211 saved = settings.value( SETTING_GEOMETRY );
211212 if ( saved.type() == QVariant::Invalid )
212213 move( 70, 22 );
@@ -239,7 +240,7 @@ void MainWindow::settings( enum ReadWriteMode mode ) {
239240 textComboBoxes[i].comboBox->setCurrentIndex( textComboBoxes[i].comboBox->findText( extension ) );
240241 }
241242 } else { // 設定書き出し
242-#if defined( Q_WS_MAC ) || defined( Q_WS_WIN )
243+#if defined( QT4_QT5_MAC ) || defined( QT4_QT5_WIN )
243244 settings.setValue( SETTING_GEOMETRY, saveGeometry() );
244245 #endif
245246 if ( outputDirSpecified )
--- a/messagewindow.cpp
+++ b/messagewindow.cpp
@@ -22,6 +22,7 @@
2222 #include "ui_messagewindow.h"
2323 #include "mainwindow.h"
2424 #include "utility.h"
25+#include "qt4qt5.h"
2526
2627 #include <QtGui>
2728 #include <QTextCursor>
@@ -102,7 +103,7 @@ void MessageWindow::clearText() {
102103 }
103104
104105 void MessageWindow::settings( bool write ) {
105-#if defined( Q_WS_MAC ) || defined( Q_WS_WIN )
106+#if defined( QT4_QT5_MAC ) || defined( QT4_QT5_WIN )
106107 QSettings settings( Utility::applicationBundlePath() + INI_FILE, QSettings::IniFormat );
107108 settings.beginGroup( SETTING_GROUP );
108109
--- /dev/null
+++ b/qt4qt5.h
@@ -0,0 +1,12 @@
1+#ifndef QT4QT5_H
2+#define QT4QT5_H
3+
4+#if (QT_VERSION < 0x050000 && defined(Q_WS_WIN)||(QT_VERSION >= 0x050000 && defined(Q_OS_WIN)))
5+#define QT4_QT5_WIN
6+#endif
7+
8+#if (QT_VERSION < 0x050000 && defined(Q_WS_MAC)||(QT_VERSION >= 0x050000 && defined(Q_OS_MACX)))
9+#define QT4_QT5_MAC
10+#endif
11+
12+#endif // QT4QT5_H
--- a/utility.cpp
+++ b/utility.cpp
@@ -21,6 +21,7 @@
2121 #include "utility.h"
2222 #include "urldownloader.h"
2323 #include "mainwindow.h"
24+#include "qt4qt5.h"
2425
2526 #include <QUrl>
2627 #include <QRegExp>
@@ -57,7 +58,7 @@ namespace {
5758 // Macの場合はアプリケーションバンドル、それ以外はアプリケーションが含まれるディレクトリを返す
5859 QString Utility::applicationBundlePath() {
5960 QString result = QCoreApplication::applicationDirPath();
60-#ifdef Q_WS_MAC
61+#ifdef QT4_QT5_MAC
6162 result = QDir::cleanPath( result + UPUPUP );
6263 #endif
6364 result += QDir::separator();