From 4b182e733fd3235d8599945c5d332491c0a06e56 Mon Sep 17 00:00:00 2001 From: Ivan Ilin Date: Wed, 18 Apr 2012 14:14:47 +0300 Subject: [PATCH] linux gcc fixes --- src/board/UBFeaturesController.cpp | 4 +-- src/board/UBFeaturesController.h | 28 ++++++++--------- src/gui/UBFeaturesWidget.cpp | 37 +++++++++++++--------- src/gui/UBFeaturesWidget.h | 49 +++++++++++++++--------------- 4 files changed, 62 insertions(+), 56 deletions(-) diff --git a/src/board/UBFeaturesController.cpp b/src/board/UBFeaturesController.cpp index 2175d94f..a2346abb 100644 --- a/src/board/UBFeaturesController.cpp +++ b/src/board/UBFeaturesController.cpp @@ -243,9 +243,9 @@ UBFeature UBFeaturesController::copyItemToFolder( const QUrl &url, const UBFeatu QPixmap thumb = thumbnailForFile( newFullPath ); - UBFeatureElementType type = UBFeatureElementType::FEATURE_ITEM; + UBFeatureElementType type = FEATURE_ITEM; if ( UBFileSystemUtils::mimeTypeFromFileName( newFullPath ).contains("application") ) - type = UBFeatureElementType::FEATURE_INTERACTIVE; + type = FEATURE_INTERACTIVE; UBFeature newElement( destVirtualPath, thumb, name, newFullPath, type ); return newElement; } diff --git a/src/board/UBFeaturesController.h b/src/board/UBFeaturesController.h index e08eff53..5d6544d9 100644 --- a/src/board/UBFeaturesController.h +++ b/src/board/UBFeaturesController.h @@ -22,24 +22,22 @@ enum UBFeatureElementType class UBFeature { public: - UBFeature(){}; + UBFeature() {;} UBFeature(const UBFeature &f); - UBFeature(const QString &url, const QPixmap &icon, const QString &name, const QString &realPath, UBFeatureElementType type = FEATURE_CATEGORY); - virtual ~UBFeature(){}; - QString getName() const { return mName; }; - QPixmap getThumbnail() const { - return mThumbnail; - }; - QString getUrl() const { return virtualPath; }; + UBFeature(const QString &url, const QPixmap &icon, const QString &name, const QString &realPath, UBFeatureElementType type = FEATURE_CATEGORY); + virtual ~UBFeature() {;} + QString getName() const { return mName; } + QPixmap getThumbnail() const {return mThumbnail;} + QString getUrl() const { return virtualPath; } //QString getPath() const { return mPath; }; - QString getFullPath() const { return mPath; }; - UBFeatureElementType getType() const { return elementType; } ; + QString getFullPath() const { return mPath; } + UBFeatureElementType getType() const { return elementType; } private: QString virtualPath; - QString mPath; QPixmap mThumbnail; QString mName; - UBFeatureElementType elementType; + QString mPath; + UBFeatureElementType elementType; }; Q_DECLARE_METATYPE( UBFeature ) @@ -51,9 +49,9 @@ public: UBFeaturesController(QWidget *parentWidget); virtual ~UBFeaturesController(); - QVector * getFeatures()const { return featuresList; }; + QVector * getFeatures()const { return featuresList; } - QString getRootPath()const { return rootPath; }; + QString getRootPath()const { return rootPath; } void addItemToPage(const UBFeature &item); static QPixmap thumbnailForFile( const QString &path ); @@ -97,4 +95,4 @@ private: -#endif \ No newline at end of file +#endif diff --git a/src/gui/UBFeaturesWidget.cpp b/src/gui/UBFeaturesWidget.cpp index 12215fcd..b2848cce 100644 --- a/src/gui/UBFeaturesWidget.cpp +++ b/src/gui/UBFeaturesWidget.cpp @@ -123,7 +123,7 @@ void UBFeaturesWidget::currentSelected(const QModelIndex ¤t) QString path = model->data(current, Qt::UserRole).toString(); eUBLibElementType type = (eUBLibElementType)model->data(current, Qt::UserRole + 1).toInt();*/ UBFeature feature = model->data(current, Qt::UserRole + 1).value(); - if ( feature.getType() == UBFeatureElementType::FEATURE_FOLDER || feature.getType() == UBFeatureElementType::FEATURE_CATEGORY) + if ( feature.getType() == FEATURE_FOLDER || feature.getType() == FEATURE_CATEGORY) { QString newPath = feature.getUrl() + "/" + feature.getName(); //pathViewer->addPathElement( feature.getThumbnail(), newPath ); @@ -453,16 +453,18 @@ QMimeData* UBFeaturesModel::mimeData(const QModelIndexList &indexes) const bool UBFeaturesModel::dropMimeData(const QMimeData *mimeData, Qt::DropAction action, int row, int column, const QModelIndex &parent) { - if ( !mimeData->hasUrls() ) + Q_UNUSED(row) + + if ( !mimeData->hasUrls() ) return false; if ( action == Qt::IgnoreAction ) return true; if ( column > 0 ) return false; - int endRow; + int endRow = 0; - if ( !parent.isValid() ) + if ( !parent.isValid() ) { return false; /*if (row < 0) @@ -526,11 +528,11 @@ Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const if ( index.isValid() ) { UBFeature item = index.data( Qt::UserRole + 1 ).value(); - if ( item.getType() == UBFeatureElementType::FEATURE_INTERACTIVE || - item.getType() == UBFeatureElementType::FEATURE_ITEM ) + if ( item.getType() == FEATURE_INTERACTIVE || + item.getType() == FEATURE_ITEM ) return Qt::ItemIsDragEnabled | defaultFlags; - if ( item.getType() == UBFeatureElementType::FEATURE_FOLDER || - item.getType() == UBFeatureElementType::FEATURE_CATEGORY && item.getFullPath() != "") + if ( item.getType() == FEATURE_FOLDER || + (item.getType() == FEATURE_CATEGORY && item.getFullPath() != "")) return defaultFlags | Qt::ItemIsDropEnabled; else return defaultFlags; } @@ -569,8 +571,8 @@ bool UBFeaturesSearchProxyModel::filterAcceptsRow( int sourceRow, const QModelIn eUBLibElementType type = (eUBLibElementType)sourceModel()->data(index, Qt::UserRole + 1).toInt();*/ UBFeature feature = sourceModel()->data(index, Qt::UserRole + 1).value(); - bool isFile = feature.getType() == UBFeatureElementType::FEATURE_INTERACTIVE || - feature.getType() == UBFeatureElementType::FEATURE_ITEM; + bool isFile = feature.getType() == FEATURE_INTERACTIVE || + feature.getType() == FEATURE_ITEM; return isFile && filterRegExp().exactMatch( feature.getName() ); } @@ -582,8 +584,8 @@ bool UBFeaturesPathProxyModel::filterAcceptsRow( int sourceRow, const QModelInde eUBLibElementType type = (eUBLibElementType)sourceModel()->data(index, Qt::UserRole + 1).toInt();*/ UBFeature feature = sourceModel()->data(index, Qt::UserRole + 1).value(); - bool isFolder = feature.getType() == UBFeatureElementType::FEATURE_CATEGORY || - feature.getType() == UBFeatureElementType::FEATURE_FOLDER; + bool isFolder = feature.getType() == FEATURE_CATEGORY || + feature.getType() == FEATURE_FOLDER; QString virtualFullPath = feature.getUrl() + "/" + feature.getName(); return isFolder && path.startsWith( virtualFullPath ); @@ -591,7 +593,9 @@ bool UBFeaturesPathProxyModel::filterAcceptsRow( int sourceRow, const QModelInde QString UBFeaturesItemDelegate::displayText ( const QVariant & value, const QLocale & locale ) const { - QString text = value.toString(); + Q_UNUSED(locale) + + QString text = value.toString(); if (listView) { const QFontMetrics fm = listView->fontMetrics(); @@ -614,7 +618,10 @@ UBFeaturesPathItemDelegate::UBFeaturesPathItemDelegate(QWidget *parent) : QStyle QString UBFeaturesPathItemDelegate::displayText ( const QVariant & value, const QLocale & locale ) const { - return ""; + Q_UNUSED(value) + Q_UNUSED(locale) + + return QString(); } void UBFeaturesPathItemDelegate::paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const @@ -635,4 +642,4 @@ UBFeaturesPathItemDelegate::~UBFeaturesPathItemDelegate() delete arrowPixmap; arrowPixmap = NULL; } -} \ No newline at end of file +} diff --git a/src/gui/UBFeaturesWidget.h b/src/gui/UBFeaturesWidget.h index d4e881c6..c4cca921 100644 --- a/src/gui/UBFeaturesWidget.h +++ b/src/gui/UBFeaturesWidget.h @@ -86,7 +86,7 @@ class UBFeaturesListView : public QListView Q_OBJECT public: UBFeaturesListView( QWidget* parent=0, const char* name="UBFeaturesListView" ); - virtual ~UBFeaturesListView() {}; + virtual ~UBFeaturesListView() {;} protected: virtual void dropEvent( QDropEvent *event ); }; @@ -96,7 +96,7 @@ class UBFeaturesPathViewer : public QGraphicsView Q_OBJECT public: UBFeaturesPathViewer(const QPixmap &root, const QString &rootPath, QGraphicsScene *sc, QWidget* parent=0, const char* name="UBFeaturesPathViewer"); - virtual ~UBFeaturesPathViewer() {} ; + virtual ~UBFeaturesPathViewer() {;} void addPathElement(const QPixmap &p, const QString &s); void truncatePath(int number); private: @@ -110,21 +110,22 @@ class UBFolderWidget : public QLabel { Q_OBJECT public: - UBFolderWidget( QWidget * parent = 0, Qt::WindowFlags f = 0 ) : QLabel( parent, f ) {}; - virtual ~UBFolderWidget() {}; - virtual QString getPath()const { return path; }; - virtual void setPath( const QString &p ) { path = p; }; + UBFolderWidget( QWidget * parent = 0, Qt::WindowFlags f = 0 ) : QLabel( parent, f ) {;} + virtual ~UBFolderWidget() {;} + virtual QString getPath()const { return path;} + virtual void setPath( const QString &p ) { path = p;} signals: void clicked(const QString &); protected: - virtual void mouseReleaseEvent ( QMouseEvent * ev ) + virtual void mouseReleaseEvent ( QMouseEvent * ev ) { - emit clicked(path); - }; + Q_UNUSED(ev) + emit clicked(path); + } virtual void mousePressEvent ( QMouseEvent * ev ) { ev->accept(); - }; + } private: QString path; }; @@ -179,8 +180,8 @@ class UBFeaturesModel : public QAbstractListModel { Q_OBJECT public: - UBFeaturesModel( QObject *parent = 0 ) { }; - virtual ~UBFeaturesModel(){}; + UBFeaturesModel( QObject *parent = 0 ) : QAbstractListModel(parent) {;} + virtual ~UBFeaturesModel(){;} QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; QMimeData *mimeData( const QModelIndexList &indexes ) const; @@ -190,9 +191,9 @@ public: bool dropMimeData(const QMimeData *mimeData, Qt::DropAction action, int row, int column, const QModelIndex &parent); bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); bool removeRow(int row, const QModelIndex &parent = QModelIndex()); - Qt::DropActions supportedDropActions() const { return Qt::MoveAction | Qt::CopyAction; }; + Qt::DropActions supportedDropActions() const { return Qt::MoveAction | Qt::CopyAction; } - void setFeaturesList( QVector *flist ) { featuresList = flist; }; + void setFeaturesList( QVector *flist ) { featuresList = flist; } private: QVector *featuresList; }; @@ -201,8 +202,8 @@ class UBFeaturesProxyModel : public QSortFilterProxyModel { Q_OBJECT public: - UBFeaturesProxyModel(QObject *parent = 0) { QSortFilterProxyModel::QSortFilterProxyModel(parent); }; - virtual ~UBFeaturesProxyModel() {}; + UBFeaturesProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent) {;} + virtual ~UBFeaturesProxyModel() {} protected: virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const; }; @@ -211,8 +212,8 @@ class UBFeaturesSearchProxyModel : public QSortFilterProxyModel { Q_OBJECT public: - UBFeaturesSearchProxyModel(QObject *parent = 0) { QSortFilterProxyModel::QSortFilterProxyModel(parent); }; - virtual ~UBFeaturesSearchProxyModel() {}; + UBFeaturesSearchProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent) {;} + virtual ~UBFeaturesSearchProxyModel() {} protected: virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const; }; @@ -221,9 +222,9 @@ class UBFeaturesPathProxyModel : public QSortFilterProxyModel { Q_OBJECT public: - UBFeaturesPathProxyModel(QObject *parent = 0) { QSortFilterProxyModel::QSortFilterProxyModel(parent); }; - virtual ~UBFeaturesPathProxyModel() {}; - void setPath( const QString &p ) { path = p; }; + UBFeaturesPathProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent) {;} + virtual ~UBFeaturesPathProxyModel() {} + void setPath( const QString &p ) { path = p; } protected: virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const; private: @@ -234,8 +235,8 @@ class UBFeaturesItemDelegate : public QStyledItemDelegate { Q_OBJECT public: - UBFeaturesItemDelegate(QWidget *parent = 0, const QListView *lw = 0) : QStyledItemDelegate(parent) { listView = lw; }; - ~UBFeaturesItemDelegate() {}; + UBFeaturesItemDelegate(QWidget *parent = 0, const QListView *lw = 0) : QStyledItemDelegate(parent) { listView = lw; } + ~UBFeaturesItemDelegate() {} //UBFeaturesItemDelegate(const QListView *lw = 0) { listView = lw; }; //void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; //QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; @@ -256,4 +257,4 @@ private: QPixmap *arrowPixmap; }; -#endif // UBFEATURESWIDGET_H \ No newline at end of file +#endif // UBFEATURESWIDGET_H