linux gcc fixes

preferencesAboutTextFull
Ivan Ilin 13 years ago
parent 14e326effe
commit 4b182e733f
  1. 4
      src/board/UBFeaturesController.cpp
  2. 28
      src/board/UBFeaturesController.h
  3. 37
      src/gui/UBFeaturesWidget.cpp
  4. 49
      src/gui/UBFeaturesWidget.h

@ -243,9 +243,9 @@ UBFeature UBFeaturesController::copyItemToFolder( const QUrl &url, const UBFeatu
QPixmap thumb = thumbnailForFile( newFullPath ); QPixmap thumb = thumbnailForFile( newFullPath );
UBFeatureElementType type = UBFeatureElementType::FEATURE_ITEM; UBFeatureElementType type = FEATURE_ITEM;
if ( UBFileSystemUtils::mimeTypeFromFileName( newFullPath ).contains("application") ) if ( UBFileSystemUtils::mimeTypeFromFileName( newFullPath ).contains("application") )
type = UBFeatureElementType::FEATURE_INTERACTIVE; type = FEATURE_INTERACTIVE;
UBFeature newElement( destVirtualPath, thumb, name, newFullPath, type ); UBFeature newElement( destVirtualPath, thumb, name, newFullPath, type );
return newElement; return newElement;
} }

@ -22,24 +22,22 @@ enum UBFeatureElementType
class UBFeature class UBFeature
{ {
public: public:
UBFeature(){}; UBFeature() {;}
UBFeature(const UBFeature &f); UBFeature(const UBFeature &f);
UBFeature(const QString &url, const QPixmap &icon, const QString &name, const QString &realPath, UBFeatureElementType type = FEATURE_CATEGORY); UBFeature(const QString &url, const QPixmap &icon, const QString &name, const QString &realPath, UBFeatureElementType type = FEATURE_CATEGORY);
virtual ~UBFeature(){}; virtual ~UBFeature() {;}
QString getName() const { return mName; }; QString getName() const { return mName; }
QPixmap getThumbnail() const { QPixmap getThumbnail() const {return mThumbnail;}
return mThumbnail; QString getUrl() const { return virtualPath; }
};
QString getUrl() const { return virtualPath; };
//QString getPath() const { return mPath; }; //QString getPath() const { return mPath; };
QString getFullPath() const { return mPath; }; QString getFullPath() const { return mPath; }
UBFeatureElementType getType() const { return elementType; } ; UBFeatureElementType getType() const { return elementType; }
private: private:
QString virtualPath; QString virtualPath;
QString mPath;
QPixmap mThumbnail; QPixmap mThumbnail;
QString mName; QString mName;
UBFeatureElementType elementType; QString mPath;
UBFeatureElementType elementType;
}; };
Q_DECLARE_METATYPE( UBFeature ) Q_DECLARE_METATYPE( UBFeature )
@ -51,9 +49,9 @@ public:
UBFeaturesController(QWidget *parentWidget); UBFeaturesController(QWidget *parentWidget);
virtual ~UBFeaturesController(); virtual ~UBFeaturesController();
QVector <UBFeature>* getFeatures()const { return featuresList; }; QVector <UBFeature>* getFeatures()const { return featuresList; }
QString getRootPath()const { return rootPath; }; QString getRootPath()const { return rootPath; }
void addItemToPage(const UBFeature &item); void addItemToPage(const UBFeature &item);
static QPixmap thumbnailForFile( const QString &path ); static QPixmap thumbnailForFile( const QString &path );
@ -97,4 +95,4 @@ private:
#endif #endif

@ -123,7 +123,7 @@ void UBFeaturesWidget::currentSelected(const QModelIndex &current)
QString path = model->data(current, Qt::UserRole).toString(); QString path = model->data(current, Qt::UserRole).toString();
eUBLibElementType type = (eUBLibElementType)model->data(current, Qt::UserRole + 1).toInt();*/ eUBLibElementType type = (eUBLibElementType)model->data(current, Qt::UserRole + 1).toInt();*/
UBFeature feature = model->data(current, Qt::UserRole + 1).value<UBFeature>(); UBFeature feature = model->data(current, Qt::UserRole + 1).value<UBFeature>();
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(); QString newPath = feature.getUrl() + "/" + feature.getName();
//pathViewer->addPathElement( feature.getThumbnail(), newPath ); //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) 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; return false;
if ( action == Qt::IgnoreAction ) if ( action == Qt::IgnoreAction )
return true; return true;
if ( column > 0 ) if ( column > 0 )
return false; return false;
int endRow; int endRow = 0;
if ( !parent.isValid() ) if ( !parent.isValid() )
{ {
return false; return false;
/*if (row < 0) /*if (row < 0)
@ -526,11 +528,11 @@ Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const
if ( index.isValid() ) if ( index.isValid() )
{ {
UBFeature item = index.data( Qt::UserRole + 1 ).value<UBFeature>(); UBFeature item = index.data( Qt::UserRole + 1 ).value<UBFeature>();
if ( item.getType() == UBFeatureElementType::FEATURE_INTERACTIVE || if ( item.getType() == FEATURE_INTERACTIVE ||
item.getType() == UBFeatureElementType::FEATURE_ITEM ) item.getType() == FEATURE_ITEM )
return Qt::ItemIsDragEnabled | defaultFlags; return Qt::ItemIsDragEnabled | defaultFlags;
if ( item.getType() == UBFeatureElementType::FEATURE_FOLDER || if ( item.getType() == FEATURE_FOLDER ||
item.getType() == UBFeatureElementType::FEATURE_CATEGORY && item.getFullPath() != "") (item.getType() == FEATURE_CATEGORY && item.getFullPath() != ""))
return defaultFlags | Qt::ItemIsDropEnabled; return defaultFlags | Qt::ItemIsDropEnabled;
else return defaultFlags; else return defaultFlags;
} }
@ -569,8 +571,8 @@ bool UBFeaturesSearchProxyModel::filterAcceptsRow( int sourceRow, const QModelIn
eUBLibElementType type = (eUBLibElementType)sourceModel()->data(index, Qt::UserRole + 1).toInt();*/ eUBLibElementType type = (eUBLibElementType)sourceModel()->data(index, Qt::UserRole + 1).toInt();*/
UBFeature feature = sourceModel()->data(index, Qt::UserRole + 1).value<UBFeature>(); UBFeature feature = sourceModel()->data(index, Qt::UserRole + 1).value<UBFeature>();
bool isFile = feature.getType() == UBFeatureElementType::FEATURE_INTERACTIVE || bool isFile = feature.getType() == FEATURE_INTERACTIVE ||
feature.getType() == UBFeatureElementType::FEATURE_ITEM; feature.getType() == FEATURE_ITEM;
return isFile && filterRegExp().exactMatch( feature.getName() ); 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();*/ eUBLibElementType type = (eUBLibElementType)sourceModel()->data(index, Qt::UserRole + 1).toInt();*/
UBFeature feature = sourceModel()->data(index, Qt::UserRole + 1).value<UBFeature>(); UBFeature feature = sourceModel()->data(index, Qt::UserRole + 1).value<UBFeature>();
bool isFolder = feature.getType() == UBFeatureElementType::FEATURE_CATEGORY || bool isFolder = feature.getType() == FEATURE_CATEGORY ||
feature.getType() == UBFeatureElementType::FEATURE_FOLDER; feature.getType() == FEATURE_FOLDER;
QString virtualFullPath = feature.getUrl() + "/" + feature.getName(); QString virtualFullPath = feature.getUrl() + "/" + feature.getName();
return isFolder && path.startsWith( virtualFullPath ); 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 UBFeaturesItemDelegate::displayText ( const QVariant & value, const QLocale & locale ) const
{ {
QString text = value.toString(); Q_UNUSED(locale)
QString text = value.toString();
if (listView) if (listView)
{ {
const QFontMetrics fm = listView->fontMetrics(); const QFontMetrics fm = listView->fontMetrics();
@ -614,7 +618,10 @@ UBFeaturesPathItemDelegate::UBFeaturesPathItemDelegate(QWidget *parent) : QStyle
QString UBFeaturesPathItemDelegate::displayText ( const QVariant & value, const QLocale & locale ) const 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 void UBFeaturesPathItemDelegate::paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
@ -635,4 +642,4 @@ UBFeaturesPathItemDelegate::~UBFeaturesPathItemDelegate()
delete arrowPixmap; delete arrowPixmap;
arrowPixmap = NULL; arrowPixmap = NULL;
} }
} }

@ -86,7 +86,7 @@ class UBFeaturesListView : public QListView
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesListView( QWidget* parent=0, const char* name="UBFeaturesListView" ); UBFeaturesListView( QWidget* parent=0, const char* name="UBFeaturesListView" );
virtual ~UBFeaturesListView() {}; virtual ~UBFeaturesListView() {;}
protected: protected:
virtual void dropEvent( QDropEvent *event ); virtual void dropEvent( QDropEvent *event );
}; };
@ -96,7 +96,7 @@ class UBFeaturesPathViewer : public QGraphicsView
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesPathViewer(const QPixmap &root, const QString &rootPath, QGraphicsScene *sc, QWidget* parent=0, const char* name="UBFeaturesPathViewer"); 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 addPathElement(const QPixmap &p, const QString &s);
void truncatePath(int number); void truncatePath(int number);
private: private:
@ -110,21 +110,22 @@ class UBFolderWidget : public QLabel
{ {
Q_OBJECT Q_OBJECT
public: public:
UBFolderWidget( QWidget * parent = 0, Qt::WindowFlags f = 0 ) : QLabel( parent, f ) {}; UBFolderWidget( QWidget * parent = 0, Qt::WindowFlags f = 0 ) : QLabel( parent, f ) {;}
virtual ~UBFolderWidget() {}; virtual ~UBFolderWidget() {;}
virtual QString getPath()const { return path; }; virtual QString getPath()const { return path;}
virtual void setPath( const QString &p ) { path = p; }; virtual void setPath( const QString &p ) { path = p;}
signals: signals:
void clicked(const QString &); void clicked(const QString &);
protected: 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 ) virtual void mousePressEvent ( QMouseEvent * ev )
{ {
ev->accept(); ev->accept();
}; }
private: private:
QString path; QString path;
}; };
@ -179,8 +180,8 @@ class UBFeaturesModel : public QAbstractListModel
{ {
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesModel( QObject *parent = 0 ) { }; UBFeaturesModel( QObject *parent = 0 ) : QAbstractListModel(parent) {;}
virtual ~UBFeaturesModel(){}; virtual ~UBFeaturesModel(){;}
QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
QMimeData *mimeData( const QModelIndexList &indexes ) 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 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 removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
bool removeRow(int row, 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 <UBFeature> *flist ) { featuresList = flist; }; void setFeaturesList( QVector <UBFeature> *flist ) { featuresList = flist; }
private: private:
QVector <UBFeature> *featuresList; QVector <UBFeature> *featuresList;
}; };
@ -201,8 +202,8 @@ class UBFeaturesProxyModel : public QSortFilterProxyModel
{ {
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesProxyModel(QObject *parent = 0) { QSortFilterProxyModel::QSortFilterProxyModel(parent); }; UBFeaturesProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent) {;}
virtual ~UBFeaturesProxyModel() {}; virtual ~UBFeaturesProxyModel() {}
protected: protected:
virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const; virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const;
}; };
@ -211,8 +212,8 @@ class UBFeaturesSearchProxyModel : public QSortFilterProxyModel
{ {
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesSearchProxyModel(QObject *parent = 0) { QSortFilterProxyModel::QSortFilterProxyModel(parent); }; UBFeaturesSearchProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent) {;}
virtual ~UBFeaturesSearchProxyModel() {}; virtual ~UBFeaturesSearchProxyModel() {}
protected: protected:
virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const; virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const;
}; };
@ -221,9 +222,9 @@ class UBFeaturesPathProxyModel : public QSortFilterProxyModel
{ {
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesPathProxyModel(QObject *parent = 0) { QSortFilterProxyModel::QSortFilterProxyModel(parent); }; UBFeaturesPathProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent) {;}
virtual ~UBFeaturesPathProxyModel() {}; virtual ~UBFeaturesPathProxyModel() {}
void setPath( const QString &p ) { path = p; }; void setPath( const QString &p ) { path = p; }
protected: protected:
virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const; virtual bool filterAcceptsRow ( int sourceRow, const QModelIndex & sourceParent ) const;
private: private:
@ -234,8 +235,8 @@ class UBFeaturesItemDelegate : public QStyledItemDelegate
{ {
Q_OBJECT Q_OBJECT
public: public:
UBFeaturesItemDelegate(QWidget *parent = 0, const QListView *lw = 0) : QStyledItemDelegate(parent) { listView = lw; }; UBFeaturesItemDelegate(QWidget *parent = 0, const QListView *lw = 0) : QStyledItemDelegate(parent) { listView = lw; }
~UBFeaturesItemDelegate() {}; ~UBFeaturesItemDelegate() {}
//UBFeaturesItemDelegate(const QListView *lw = 0) { listView = lw; }; //UBFeaturesItemDelegate(const QListView *lw = 0) { listView = lw; };
//void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; //void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
//QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; //QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
@ -256,4 +257,4 @@ private:
QPixmap *arrowPixmap; QPixmap *arrowPixmap;
}; };
#endif // UBFEATURESWIDGET_H #endif // UBFEATURESWIDGET_H

Loading…
Cancel
Save