Commit 15b91930 authored by Michael Reeves's avatar Michael Reeves

Use Q_OS* fixes detection of 64bit windows

parent 9bc7258b
......@@ -69,11 +69,7 @@ T minMaxLimiter( T d, T minimum, T maximum )
inline int getAtomic(QAtomicInt& ai)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
return ai.load();
#else
return ai;
#endif
}
class QFont;
......
......@@ -14,7 +14,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#ifdef _WIN32
#ifdef Q_OS_WIN
#include <qt_windows.h>
#endif
......@@ -586,7 +586,7 @@ static QString getArguments(QString cmd, QString& program, QStringList& args)
{
program = args[0];
args.pop_front();
#ifdef WIN32
#ifdef Q_OS_WIN
if(program == "sed")
{
QString prg = QCoreApplication::applicationDirPath() + "/bin/sed.exe"; // in subdir bin
......@@ -657,7 +657,7 @@ QStringList SourceData::readAndPreprocess(QTextCodec* pEncoding, bool bAutoDetec
if(faIn.exists()) // fileInSize > 0 )
{
#if defined(_WIN32)
#if defined(Q_OS_WIN)
QString catCmd = "type";
fileNameIn1.replace('/', "\\");
#else
......@@ -1496,7 +1496,7 @@ void calcDiff3LineListUsingBC(
printf("\n");*/
}
#ifdef _WIN32
#ifdef Q_OS_WIN
using ::equal;
#endif
......
......@@ -76,7 +76,7 @@ class DiffTextWindowData
m_bMyUpdate = false;
m_bSelectionInProgress = false;
m_pTextCodec = nullptr;
#if defined(_WIN32)
#if defined(Q_OS_WIN)
m_eLineEndStyle = eLineEndStyleDos;
#else
m_eLineEndStyle = eLineEndStyleUnix;
......@@ -1054,11 +1054,8 @@ void DiffTextWindowData::writeLine(
}
if(!bWrapLine || wrapLineLength > 0)
{
#if defined(__APPLE__) && (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
Qt::PenStyle wrapLinePenStyle = Qt::DashLine; // Qt::DotLine doesn't work on Mac (Qt4.8.6).
#else
Qt::PenStyle wrapLinePenStyle = Qt::DotLine;
#endif
p.setPen(QPen(m_pOptions->m_fgColor, 0, bWrapLine ? wrapLinePenStyle : Qt::SolidLine));
p.drawLine(xOffset + 1, yOffset, xOffset + 1, yOffset + fontHeight - 1);
p.setPen(QPen(m_pOptions->m_fgColor, 0, Qt::SolidLine));
......@@ -1387,7 +1384,7 @@ QString DiffTextWindow::getSelection()
if(d->m_selection.within(line, size) &&
!(d->m_bWordWrap && it + 1 < vectorSize && d3l == d->m_diff3WrapLineVector[it + 1].pD3L))
{
#if defined(_WIN32)
#if defined(Q_OS_WIN)
selectionString += '\r';
#endif
selectionString += '\n';
......
......@@ -14,7 +14,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#ifdef _WIN32
#ifdef Q_OS_WIN
#include <qt_windows.h>
#endif
......@@ -2276,7 +2276,7 @@ void DirectoryMergeWindow::contextMenuEvent(QContextMenuEvent* e)
m.addAction(d->m_pDirCompareExplicit);
m.addAction(d->m_pDirMergeExplicit);
#ifndef _WIN32
#ifndef Q_OS_WIN
m.exec(p);
#else
void showShellContextMenu(const QString&, QPoint, QWidget*, QMenu*);
......@@ -3145,7 +3145,7 @@ bool DirectoryMergeWindow::Data::copyFLD(const QString& srcName, const QString&
if(fi.isSymLink() && ((fi.isDir() && !m_bFollowDirLinks) || (!fi.isDir() && !m_bFollowFileLinks)))
{
m_pStatusInfo->addText(i18n("copyLink( %1 -> %2 )", srcName, destName));
#if defined(_WIN32)
#if defined(Q_OS_WIN)
// What are links?
#else
if(m_bSimulatedMergeStarted)
......@@ -3348,7 +3348,7 @@ static void addListViewItem(QTreeWidget* pListView, const QString& dir,
new QTreeWidgetItem(
pListView,
QStringList() << dir << QString(fi->isDir() ? i18n("Dir") : i18n("File")) + (fi->isSymLink() ? "-Link" : "") << QString::number(fi->size()) << QString(fi->isReadable() ? "r" : " ") + (fi->isWritable() ? "w" : " ")
#ifdef _WIN32
#ifdef Q_OS_WIN
/*Future: Use GetFileAttributes()*/
<<
#else
......
......@@ -31,7 +31,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#ifdef _WIN32
#ifdef Q_OS_WIN
#include <io.h>
#include <process.h>
#include <sys/utime.h>
......@@ -227,7 +227,7 @@ void FileAccess::setFile(const QFileInfo& fi, FileAccess* pParent)
d()->m_name = fi.fileName();
if(m_bSymLink)
{
#ifdef _WIN32
#ifdef Q_OS_WIN
d()->m_linkTarget = fi.readLink();
#else
// TODO: Update for Qt5.
......@@ -768,7 +768,7 @@ bool FileAccess::writeFile(const void* pSrcBuffer, unsigned long length)
return false;
}
f.close();
#ifndef _WIN32
#ifndef Q_OS_WIN
if(isExecutable()) // value is true if the old file was executable
{
// Preserve attributes
......@@ -861,7 +861,7 @@ bool FileAccess::removeDir(const QString& dirName)
return fh.rmDir(dirName);
}
#if defined(_WIN32)
#if defined(Q_OS_WIN)
bool FileAccess::symLink(const QString& /*linkTarget*/, const QString& /*linkLocation*/)
{
return false;
......@@ -1284,7 +1284,7 @@ bool FileAccessJobHandler::copyFile(const QString& dest)
destFile.close();
// Update the times of the destFile
#ifdef _WIN32
#ifdef Q_OS_WIN
struct _stat srcFileStatus;
int statResult = ::_stat(srcName.toLocal8Bit().constData(), &srcFileStatus);
if(statResult == 0)
......@@ -1563,7 +1563,7 @@ bool FileAccessJobHandler::listDir(t_DirectoryList* pDirList, bool bRecursive, b
m_bSuccess = QDir::setCurrent(m_pFileAccess->absoluteFilePath());
if(m_bSuccess)
{
#ifndef _WIN32
#ifndef Q_OS_WIN
m_bSuccess = true;
QDir dir(".");
......@@ -1685,7 +1685,7 @@ bool FileAccessJobHandler::listDir(t_DirectoryList* pDirList, bool bRecursive, b
{
cvsIgnoreList.init(*m_pFileAccess, cvsIgnoreExists(pDirList));
}
#if defined(_WIN32)
#if defined(Q_OS_WIN)
bool bCaseSensitive = false;
#else
bool bCaseSensitive = true;
......
......@@ -196,7 +196,7 @@ KDiff3App::KDiff3App(QWidget* pParent, const char* /*name*/, KDiff3Part* pKDiff3
pVBoxLayout->addWidget(pTextEdit);
pDialog->resize(600, 400);
pDialog->exec();
#if !defined(_WIN32)
#if !defined(Q_OS_WIN)
// A windows program has no console
printf("%s\n", title.toLatin1().constData());
printf("%s\n", s.toLatin1().constData());
......
......@@ -18,7 +18,7 @@
// http://www.codeproject.com/Articles/4025/Use-Shell-ContextMenu-in-your-applications
//
//////////////////////////////////////////////////////////////////////
#ifdef _WIN32
#ifdef Q_OS_WIN
#include <qt_windows.h>
#include <windows.h>
......
......@@ -58,7 +58,7 @@ static QString s_homepage;
static KAboutData* s_pAboutData;
#ifdef _WIN32
#ifdef Q_OS_WIN
#include <process.h>
#include <windows.h>
#include <shellapi.h>
......@@ -66,7 +66,7 @@ static KAboutData* s_pAboutData;
static void showHelp()
{
#if defined(_WIN32)
#if defined(Q_OS_WIN)
QString exePath = QCoreApplication::applicationDirPath();
QFileInfo helpFile( exePath + "\\doc\\en\\index.html" );
......@@ -118,12 +118,12 @@ static void showHelp()
QString getTranslationDir(const QString& locale)
{
#if defined(_WIN32)
#if defined(Q_OS_WIN)
QUNUSED(locale);
QString exePath;
exePath = QCoreApplication::applicationDirPath();
return exePath+"/translations";
#elif defined(__APPLE__)
#elif defined(Q_OS_MAC)
QUNUSED(locale);
QString exePath = QCoreApplication::applicationDirPath();
......@@ -419,7 +419,7 @@ QString KStandardDirs::findResource(const QString& resource, const QString& /*ap
{
if (resource=="config")
{
#if defined(_WIN32)
#if defined(Q_OS_WIN)
QString exePath = QCoreApplication::applicationDirPath();
QString configPath = exePath + "/.kdiff3rc"; // This is useful for portable installations (e.g. on USB-Stick)
if ( QFile::exists( configPath ) )
......@@ -981,7 +981,7 @@ KApplication::KApplication()
: QApplication( s_argc,s_argv )
{
kapp = this;
#if ! ( defined(_WIN32) )
#if ! ( defined(Q_OS_WIN) )
parseOptions();
#endif
}
......@@ -1100,7 +1100,7 @@ void KApplication::parseOptions()
}
s += "\n"+i18n("For more documentation, see the help-menu or the subdirectory doc.")+"\n";
#if defined(_WIN32)
#if defined(Q_OS_WIN)
// A windows program has no console
if ( 0==QMessageBox::information(0, i18n("KDiff3-Usage"), s, i18n("Ignore"),i18n("Exit") ) )
continue;
......
......@@ -36,7 +36,7 @@
//#include <QClipboard>
#include <vector>
#ifdef _WIN32
#ifdef Q_OS_WIN
#include <process.h>
#include <qt_windows.h>
#endif
......@@ -86,7 +86,7 @@ void initialiseCmdLineArgs(QCommandLineParser* cmdLineParser)
}
}
#ifdef _WIN32
#ifdef Q_OS_WIN
// This command checks the comm
static bool isOptionUsed(const QString& s, int argc, char* argv[])
{
......@@ -179,7 +179,7 @@ int main(int argc, char* argv[])
QString errorMessage = cmdLineParser->errorText();
QString helpText = cmdLineParser->helpText();
QMessageBox::warning(nullptr, aboutData.displayName(), "<html><head/><body><h2>" + errorMessage + "</h2><pre>" + helpText + "</pre></body></html>");
#if !defined(_WIN32)
#if !defined(Q_OS_WIN)
fputs(qPrintable(errorMessage), stderr);
fputs("\n\n", stderr);
fputs(qPrintable(helpText + "\n"), stderr);
......@@ -191,14 +191,14 @@ int main(int argc, char* argv[])
if(cmdLineParser->isSet(QStringLiteral("version"))) {
QMessageBox::information(nullptr, aboutData.displayName(),
aboutData.displayName() + ' ' + aboutData.version());
#if !defined(_WIN32)
#if !defined(Q_OS_WIN)
printf("%s %s\n", appName.constData(), appVersion.constData());
#endif
exit(0);
}
if(cmdLineParser->isSet(QStringLiteral("help"))) {
QMessageBox::warning(nullptr, aboutData.displayName(), "<html><head/><body><pre>" + cmdLineParser->helpText() + "</pre></body></html>");
#if !defined(_WIN32)
#if !defined(Q_OS_WIN)
fputs(qPrintable(cmdLineParser->helpText()), stdout);
#endif
exit(0);
......
......@@ -2270,7 +2270,7 @@ void MergeResultWindow::keyPressEvent(QKeyEvent* e)
bool bCtrl = (e->QInputEvent::modifiers() & Qt::ControlModifier) != 0;
bool bShift = (e->QInputEvent::modifiers() & Qt::ShiftModifier) != 0;
#ifdef _WIN32
#ifdef Q_OS_WIN
bool bAlt = (e->QInputEvent::modifiers() & Qt::AltModifier) != 0;
if(bCtrl && bAlt) {
bCtrl = false;
......@@ -2705,7 +2705,7 @@ QString MergeResultWindow::getSelection()
if(m_selection.within(line, outPos))
{
#ifdef _WIN32
#ifdef Q_OS_WIN
selectionString += '\r';
#endif
selectionString += '\n';
......
......@@ -1258,7 +1258,7 @@ void OptionDialog::setupDirectoryMergePage(void)
OptionCheckBox* pFindHidden = new OptionCheckBox(i18n("Find hidden files and directories"), true, "FindHidden", &m_options.m_bDmFindHidden, page, this);
gbox->addWidget(pFindHidden, line, 0, 1, 2);
#if defined(_WIN32)
#if defined(Q_OS_WIN)
pFindHidden->setToolTip(i18n("Finds files and directories with the hidden attribute."));
#else
pFindHidden->setToolTip(i18n("Finds files and directories starting with '.'."));
......@@ -1285,7 +1285,7 @@ void OptionDialog::setupDirectoryMergePage(void)
// "Files and directories without change will not appear in the list."));
//++line;
#if defined(_WIN32)
#if defined(Q_OS_WIN)
bool bCaseSensitiveFilenameComparison = false;
#else
bool bCaseSensitiveFilenameComparison = true;
......@@ -1559,7 +1559,7 @@ void OptionDialog::setupRegionalPage(void)
pLanguage->addItem("Auto"); // Must not translate, won't work otherwise!
pLanguage->addItem("en_orig");
#if !defined(_WIN32) && !defined(__APPLE__)
#if !defined(Q_OS_WIN) && !defined(Q_OS_MAC)
// Read directory: Find all kdiff3_*.qm-files and insert the found files here
QDir localeDir("/usr/share/locale"); // See also kreplacements.cpp: getTranslationDir()
QStringList dirList = localeDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
......@@ -1686,7 +1686,7 @@ void OptionDialog::setupRegionalPage(void)
topLayout->addStretch(10);
}
#ifdef _WIN32
#ifdef Q_OS_WIN
#include "ccInstHelper.cpp"
#endif
......@@ -1724,7 +1724,7 @@ void OptionDialog::setupIntegrationPage(void)
"For those who are used to using the Escape key."));
++line;
#ifdef _WIN32
#ifdef Q_OS_WIN
QPushButton* pIntegrateWithClearCase = new QPushButton(i18n("Integrate with ClearCase"), page);
gbox->addWidget(pIntegrateWithClearCase, line, 0);
pIntegrateWithClearCase->setToolTip(i18n(
......@@ -1749,7 +1749,7 @@ void OptionDialog::setupIntegrationPage(void)
void OptionDialog::slotIntegrateWithClearCase()
{
#ifdef _WIN32
#ifdef Q_OS_WIN
char kdiff3CommandPath[1000];
GetModuleFileNameA(0, kdiff3CommandPath, sizeof(kdiff3CommandPath) - 1);
integrateWithClearCase("install", kdiff3CommandPath);
......@@ -1758,7 +1758,7 @@ void OptionDialog::slotIntegrateWithClearCase()
void OptionDialog::slotRemoveClearCaseIntegration()
{
#ifdef _WIN32
#ifdef Q_OS_WIN
char kdiff3CommandPath[1000];
GetModuleFileNameA(0, kdiff3CommandPath, sizeof(kdiff3CommandPath) - 1);
integrateWithClearCase("uninstall", kdiff3CommandPath);
......@@ -1826,7 +1826,7 @@ void OptionDialog::slotApply(void)
emit applyDone();
#ifdef _WIN32
#ifdef Q_OS_WIN
QString locale = m_options.m_language;
if(locale == "Auto" || locale.isEmpty())
locale = QLocale::system().name().left(2);
......
......@@ -18,7 +18,7 @@
#include <QtGui>
#include <QtWidgets/QtWidgets>
#ifdef _WIN32
#ifdef Q_OS_WIN
#include <qt_windows.h>
#endif
......@@ -54,7 +54,7 @@
#include "kdiff3.h"
#include "optiondialog.h"
#include "progress.h"
#ifdef _WIN32
#ifdef Q_OS_WIN
#include <windows.h>
#else
#include <kshortcutsdialog.h>
......
......@@ -184,7 +184,7 @@ OpenDialog::OpenDialog(
setFixedHeight(sh.height());
m_bInputFileNameChanged = false;
#ifdef _WIN32
#ifdef Q_OS_WIN
m_pLineA->lineEdit()->installEventFilter(this);
m_pLineB->lineEdit()->installEventFilter(this);
m_pLineC->lineEdit()->installEventFilter(this);
......
......@@ -3,7 +3,7 @@
#include <QtCore>
#include <QtGui>
#include <QtWidgets/QtWidgets>
#ifdef _WIN32
#ifdef Q_OS_WIN
#include <qt_windows.h>
#endif
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment