The porting guide for Qt5 requires that Q_OS_ be used instead

of Q_WS_ in Qt4 projects
See:
http://qt-project.org/doc/qt-5.0/qtdoc/portingguide.html

svn path=/trunk/; revision=49013
This commit is contained in:
Jörg Mayer 2013-04-24 11:07:25 +00:00
parent 2616e09140
commit 9db6d700cd
17 changed files with 66 additions and 66 deletions

View File

@ -26,11 +26,11 @@
#include "packet_range_group_box.h"
#include "capture_file_dialog.h"
#ifdef Q_WS_WIN
#ifdef Q_OS_WIN
#include <windows.h>
#include "packet-range.h"
#include "ui/win32/file_dlg_win32.h"
#else // Q_WS_WIN
#else // Q_OS_WIN
#include <errno.h>
#include "file.h"
@ -50,11 +50,11 @@
#include <QFileInfo>
#include <QMessageBox>
#include <QSpacerItem>
#endif // Q_WS_WIN
#endif // Q_OS_WIN
#include <QPushButton>
#ifdef Q_WS_WIN
#ifdef Q_OS_WIN
// All of these routines are required by file_dlg_win32.c.
// We don't yet have a good place for them so we'll add them as stubs here.
@ -89,13 +89,13 @@ extern void menu_name_resolution_changed(void) {
} // extern "C"
// End stub routines
#endif // Q_WS_WIN
#endif // Q_OS_WIN
CaptureFileDialog::CaptureFileDialog(QWidget *parent, capture_file *cf, QString &display_filter) :
QFileDialog(parent),
cap_file_(cf),
display_filter_(display_filter),
#if !defined(Q_WS_WIN)
#if !defined(Q_OS_WIN)
default_ft_(-1),
save_bt_(NULL),
help_topic_(TOPIC_ACTION_NONE)
@ -103,7 +103,7 @@ CaptureFileDialog::CaptureFileDialog(QWidget *parent, capture_file *cf, QString
file_type_(-1)
#endif
{
#if !defined(Q_WS_WIN)
#if !defined(Q_OS_WIN)
// Add extra widgets
// http://qt-project.org/faq/answer/how_can_i_add_widgets_to_my_qfiledialog_instance
setOption(QFileDialog::DontUseNativeDialog, true);
@ -120,21 +120,21 @@ CaptureFileDialog::CaptureFileDialog(QWidget *parent, capture_file *cf, QString
h_box->addLayout(&left_v_box_);
h_box->addLayout(&right_v_box_);
#else // Q_WS_WIN
#else // Q_OS_WIN
merge_type_ = 0;
#endif // Q_WS_WIN
#endif // Q_OS_WIN
}
check_savability_t CaptureFileDialog::checkSaveAsWithComments(QWidget *
#if defined(Q_WS_WIN)
#if defined(Q_OS_WIN)
parent
#endif
, capture_file *cf, int file_type) {
#if defined(Q_WS_WIN)
#if defined(Q_OS_WIN)
if (!parent || !cf)
return CANCELLED;
return win32_check_save_as_with_comments(parent->effectiveWinId(), cf, file_type);
#else // Q_WS_WIN
#else // Q_OS_WIN
guint32 comment_types;
QMessageBox msg_dialog;
int response;
@ -209,7 +209,7 @@ check_savability_t CaptureFileDialog::checkSaveAsWithComments(QWidget *
break;
}
return CANCELLED;
#endif // Q_WS_WIN
#endif // Q_OS_WIN
}
@ -222,7 +222,7 @@ int CaptureFileDialog::exec() {
// Windows
#ifdef Q_WS_WIN
#ifdef Q_OS_WIN
int CaptureFileDialog::selectedFileType() {
return file_type_;
}
@ -297,7 +297,7 @@ int CaptureFileDialog::mergeType() {
return merge_type_;
}
#else // not Q_WS_WINDOWS
#else // not Q_OS_WINDOWS
QString CaptureFileDialog::fileType(int ft, bool extension_globs)
{
QString filter;
@ -789,7 +789,7 @@ void CaptureFileDialog::on_buttonBox_helpRequested()
if (help_topic_ != TOPIC_ACTION_NONE) wsApp->helpTopicAction(help_topic_);
}
#endif // Q_WS_WINDOWS
#endif // Q_OS_WINDOWS
/*
* Editor modelines

View File

@ -28,7 +28,7 @@
#include "display_filter_edit.h"
#include "packet_range_group_box.h"
#include "ui/help_url.h"
#endif // Q_WS_WIN
#endif // Q_OS_WIN
#include "packet_list_record.h"
#include "cfile.h"
@ -72,9 +72,9 @@ class CaptureFileDialog : public QFileDialog
public:
explicit CaptureFileDialog(QWidget *parent = NULL, capture_file *cf = NULL, QString &display_filter = *new QString());
static check_savability_t checkSaveAsWithComments(QWidget *
#if defined(Q_WS_WIN)
#if defined(Q_OS_WIN)
parent
#endif // Q_WS_WIN
#endif // Q_OS_WIN
, capture_file *cf, int file_type);
int mergeType();
@ -85,7 +85,7 @@ private:
capture_file *cap_file_;
QString &display_filter_;
#if !defined(Q_WS_WIN)
#if !defined(Q_OS_WIN)
void addMergeControls(QVBoxLayout &v_box);
void addDisplayFilterEdit();
void addPreview(QVBoxLayout &v_box);
@ -131,11 +131,11 @@ private:
QPushButton *save_bt_;
topic_action_e help_topic_;
#else // Q_WS_WIN
#else // Q_OS_WIN
int file_type_;
int merge_type_;
gboolean compressed_;
#endif // Q_WS_WIN
#endif // Q_OS_WIN
signals:
@ -148,10 +148,10 @@ public slots:
int merge(QString &file_name);
private slots:
#if !defined(Q_WS_WIN)
#if !defined(Q_OS_WIN)
void preview(const QString & path);
void on_buttonBox_helpRequested();
#endif // Q_WS_WIN
#endif // Q_OS_WIN
};
#endif // CAPTURE_FILE_DIALOG_H

View File

@ -47,7 +47,7 @@ DisplayFilterCombo::DisplayFilterCombo(QWidget *parent) :
cur_display_filter_combo = this;
setStyleSheet(
"QComboBox {"
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
" border: 1px solid gray;"
#else
" border: 1px solid palette(shadow);"

View File

@ -40,7 +40,7 @@
// win
// default
#if defined(Q_WS_MAC) && 0
#if defined(Q_OS_MAC) && 0
// http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSImage_Class/Reference/Reference.html
// http://www.virtualbox.org/svn/vbox/trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaSpecialControls.mm
@ -114,7 +114,7 @@ DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, bool plain) :
bookmark_button_->setStyleSheet(QString(
"QToolButton { /* all types of tool button */"
" border 0 0 0 0;"
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
" border-right: %1px solid gray;"
#else
" border-right: %1px solid palette(shadow);"

View File

@ -23,11 +23,11 @@
#include "export_dissection_dialog.h"
#ifdef Q_WS_WIN
#ifdef Q_OS_WIN
#include <windows.h>
#include "packet-range.h"
#include "ui/win32/file_dlg_win32.h"
#else // Q_WS_WIN
#else // Q_OS_WIN
#include "print.h"
#include "ui/alert_box.h"
@ -43,17 +43,17 @@
#include <QGridLayout>
#include <QPushButton>
#endif // Q_WS_WIN
#endif // Q_OS_WIN
ExportDissectionDialog::ExportDissectionDialog(QWidget *parent, capture_file *cap_file, export_type_e export_type):
QFileDialog(parent),
export_type_(export_type),
cap_file_(cap_file)
#if !defined(Q_WS_WIN)
#if !defined(Q_OS_WIN)
, save_bt_(NULL)
#endif /* Q_WS_WIN */
#endif /* Q_OS_WIN */
{
#if !defined(Q_WS_WIN)
#if !defined(Q_OS_WIN)
QDialogButtonBox *button_box = findChild<QDialogButtonBox *>();
QGridLayout *fd_grid = qobject_cast<QGridLayout*>(layout());
QHBoxLayout *h_box = new QHBoxLayout();
@ -112,8 +112,8 @@ ExportDissectionDialog::ExportDissectionDialog(QWidget *parent, capture_file *ca
// Grow the dialog to account for the extra widgets.
resize(width(), height() + (packet_range_group_box_.height() * 2 / 3));
#else // Q_WS_WIN
#endif // Q_WS_WIN
#else // Q_OS_WIN
#endif // Q_OS_WIN
}
ExportDissectionDialog::~ExportDissectionDialog()
@ -122,7 +122,7 @@ ExportDissectionDialog::~ExportDissectionDialog()
int ExportDissectionDialog::exec()
{
#if !defined(Q_WS_WIN)
#if !defined(Q_OS_WIN)
int retval;
if (!cap_file_) return QDialog::Rejected;
@ -200,13 +200,13 @@ int ExportDissectionDialog::exec()
}
return retval;
#else // Q_WS_WIN
#else // Q_OS_WIN
win32_export_file(parentWidget()->effectiveWinId(), cap_file_, export_type_);
return QDialog::Accepted;
#endif // Q_WS_WIN
#endif // Q_OS_WIN
}
#ifndef Q_WS_WIN
#ifndef Q_OS_WIN
void ExportDissectionDialog::exportTypeChanged(QString name_filter)
{
export_type_ = export_type_map_.value(name_filter);
@ -243,7 +243,7 @@ void ExportDissectionDialog::on_buttonBox_helpRequested()
{
wsApp->helpTopicAction(HELP_EXPORT_FILE_DIALOG);
}
#endif // Q_WS_WIN
#endif // Q_OS_WIN
/*
* Editor modelines

View File

@ -33,10 +33,10 @@
#include "ui/file_dialog.h"
#ifndef Q_WS_WIN
#ifndef Q_OS_WIN
#include "packet_range_group_box.h"
#include "packet_format_group_box.h"
#endif // Q_WS_WIN
#endif // Q_OS_WIN
#include <QFileDialog>
#include <QMap>
@ -53,16 +53,16 @@ public slots:
int exec();
private slots:
#ifndef Q_WS_WIN
#ifndef Q_OS_WIN
void exportTypeChanged(QString name_filter);
void checkValidity();
void on_buttonBox_helpRequested();
#endif // Q_WS_WIN
#endif // Q_OS_WIN
private:
export_type_e export_type_;
capture_file *cap_file_;
#ifndef Q_WS_WIN
#ifndef Q_OS_WIN
print_args_t print_args_;
QMap<QString, export_type_e> export_type_map_;
@ -71,7 +71,7 @@ private:
PacketFormatGroupBox packet_format_group_box_;
QPushButton *save_bt_;
#endif // Q_WS_WIN
#endif // Q_OS_WIN
};
#endif // EXPORT_DISSECTION_DIALOG_H

View File

@ -77,7 +77,7 @@ ExportObjectDialog::ExportObjectDialog(QWidget *parent, capture_file *cf, Object
eo_ui_->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose, true);
#if defined(Q_WS_MAC)
#if defined(Q_OS_MAC)
eo_ui_->progressLabel->setAttribute(Qt::WA_MacSmallSize, true);
eo_ui_->progressBar->setAttribute(Qt::WA_MacSmallSize, true);
#endif

View File

@ -62,7 +62,7 @@ ImportTextDialog::ImportTextDialog(QWidget *parent) :
ok_button_ = ti_ui_->buttonBox->button(QDialogButtonBox::Ok);
ok_button_->setEnabled(false);
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
// The grid layout squishes each line edit otherwise.
int le_height = ti_ui_->textFileLineEdit->sizeHint().height();
ti_ui_->ethertypeLineEdit->setMinimumHeight(le_height);

View File

@ -36,7 +36,7 @@ const int num_flashes_ = 3;
LabelStack::LabelStack(QWidget *parent) :
QLabel(parent)
{
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
setAttribute(Qt::WA_MacSmallSize, true);
#endif
temporary_ctx_ = -1;

View File

@ -103,7 +103,7 @@ MainStatusBar::MainStatusBar(QWidget *parent) :
QHBoxLayout *info_progress_hb = new QHBoxLayout(info_progress);
QAction *action;
#if defined(Q_WS_WIN)
#if defined(Q_OS_WIN)
// Handles are the same color as widgets, at least on Windows 7.
splitter->setHandleWidth(3);
splitter->setStyleSheet(QString(
@ -112,7 +112,7 @@ MainStatusBar::MainStatusBar(QWidget *parent) :
" border-right: 1px solid palette(mid);"
"}"
));
#elif defined(Q_WS_MAC)
#elif defined(Q_OS_MAC)
expert_status_.setAttribute(Qt::WA_MacSmallSize, true);
#endif

View File

@ -38,7 +38,7 @@
#include <QWidget>
#include <QResizeEvent>
#ifndef Q_WS_MAC
#ifndef Q_OS_MAC
#include <QGraphicsBlurEffect>
#endif
@ -97,7 +97,7 @@ MainWelcome::MainWelcome(QWidget *parent) :
.arg(tango_aluminium_6, 6, 16, QChar('0')) // Hover foreground
);
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
recent_files_->setAttribute(Qt::WA_MacShowFocusRect, false);
welcome_ui_->taskList->setAttribute(Qt::WA_MacShowFocusRect, false);
welcome_ui_->interfaceTree->setAttribute(Qt::WA_MacShowFocusRect, false);
@ -142,7 +142,7 @@ MainWelcome::MainWelcome(QWidget *parent) :
task_list_->setCurrentRow(0);
#ifndef Q_WS_MAC
#ifndef Q_OS_MAC
// This crashes with Qt 4.8.3 on OS X.
QGraphicsBlurEffect *blur = new QGraphicsBlurEffect(welcome_ui_->childContainer);
blur->setBlurRadius(1.3);
@ -154,7 +154,7 @@ MainWelcome::MainWelcome(QWidget *parent) :
void MainWelcome::destroySplashOverlay()
{
#ifndef Q_WS_MAC
#ifndef Q_OS_MAC
welcome_ui_->childContainer->setGraphicsEffect(NULL);
#endif
delete splash_overlay_;

View File

@ -129,7 +129,7 @@ MainWindow::MainWindow(QWidget *parent) :
connect(main_ui_->searchFrame, SIGNAL(pushFilterSyntaxStatus(QString&)),
main_ui_->statusBar, SLOT(pushTemporaryStatus(QString&)));
#if defined(Q_WS_MAC)
#if defined(Q_OS_MAC)
foreach (QMenu *menu, main_ui_->menuBar->findChildren<QMenu*>()) {
foreach (QAction *act, menu->actions()) {
act->setIconVisibleInMenu(false);

View File

@ -337,7 +337,7 @@ void PreferencesDialog::showEvent(QShowEvent *evt)
int new_prefs_tree_width = pd_ui_->prefsTree->style()->subElementRect(QStyle::SE_TreeViewDisclosureItem, &style_opt).left();
QList<int> sizes = pd_ui_->splitter->sizes();
#ifdef Q_WS_WIN
#ifdef Q_OS_WIN
new_prefs_tree_width *= 2;
#endif
pd_ui_->prefsTree->resizeColumnToContents(0);

View File

@ -57,7 +57,7 @@ ProfileDialog::ProfileDialog(QWidget *parent) :
// XXX - Use NSImageNameAddTemplate and NSImageNameRemoveTemplate to set stock
// icons on OS X.
// Are there equivalent stock icons on Windows?
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
pd_ui_->newToolButton->setAttribute(Qt::WA_MacSmallSize, true);
pd_ui_->deleteToolButton->setAttribute(Qt::WA_MacSmallSize, true);
pd_ui_->copyToolButton->setAttribute(Qt::WA_MacSmallSize, true);

View File

@ -114,7 +114,7 @@ ProgressBar::ProgressBar(QWidget *parent) :
m_dlg.progressBar = this;
m_dlg.topLevelWindow = window();
//#ifdef Q_WS_MAC
//#ifdef Q_OS_MAC
// // https://bugreports.qt-project.org/browse/QTBUG-11569
// setAttribute(Qt::WA_MacSmallSize, true);
//#endif
@ -138,7 +138,7 @@ progdlg_t * ProgressBar::show(bool animate, bool terminate_is_stop, gboolean *st
setValue(value);
#ifndef Q_WS_MAC
#ifndef Q_OS_MAC
if (animate) {
QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect(this);
this->setGraphicsEffect(effect);

View File

@ -50,7 +50,7 @@ SearchFrame::SearchFrame(QWidget *parent) :
{
sf_ui_->setupUi(this);
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
foreach (QWidget *w, findChildren<QWidget *>()) {
w->setAttribute(Qt::WA_MacSmallSize, true);
}

View File

@ -53,7 +53,7 @@
#include <QTimer>
#include <QUrl>
#ifdef Q_WS_WIN
#ifdef Q_OS_WIN
#include <QDebug>
#include <QLibrary>
#endif
@ -331,11 +331,11 @@ void WiresharkApplication::setMonospaceFont(const char *font_string) {
int font_size_adjust = 0;
// Try to pick the latest, shiniest fixed-width font for our OS.
#if defined(Q_WS_WIN)
#if defined(Q_OS_WIN)
const char *default_font = win_default_font;
substitutes << win_alt_font << osx_default_font << osx_alt_font << x11_default_font << x11_alt_fonts << fallback_fonts;
font_size_adjust = 2;
#elif defined(Q_WS_MAC)
#elif defined(Q_OS_MAC)
const char *default_font = osx_default_font;
substitutes << osx_alt_font << win_default_font << win_alt_font << x11_default_font << x11_alt_fonts << fallback_fonts;
#else
@ -573,7 +573,7 @@ WiresharkApplication::WiresharkApplication(int &argc, char **argv) :
Q_INIT_RESOURCE(toolbar);
Q_INIT_RESOURCE(welcome);
#ifdef Q_WS_WIN
#ifdef Q_OS_WIN
/* RichEd20.DLL is needed for native file dialog filter entries. */
if (QLibrary::isLibrary("riched20.dll")) {
QLibrary riched20("riched20.dll");
@ -582,7 +582,7 @@ WiresharkApplication::WiresharkApplication(int &argc, char **argv) :
qDebug() << riched20.errorString();
}
}
#endif // Q_WS_WIN
#endif // Q_OS_WIN
setAttribute(Qt::AA_DontShowIconsInMenus, true);