Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
4b182e73
Commit
4b182e73
authored
Apr 18, 2012
by
Ivan Ilin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
linux gcc fixes
parent
14e326ef
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
56 deletions
+62
-56
UBFeaturesController.cpp
src/board/UBFeaturesController.cpp
+2
-2
UBFeaturesController.h
src/board/UBFeaturesController.h
+13
-15
UBFeaturesWidget.cpp
src/gui/UBFeaturesWidget.cpp
+22
-15
UBFeaturesWidget.h
src/gui/UBFeaturesWidget.h
+25
-24
No files found.
src/board/UBFeaturesController.cpp
View file @
4b182e73
...
...
@@ -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
;
}
...
...
src/board/UBFeaturesController.h
View file @
4b182e73
...
...
@@ -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
<
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
);
static
QPixmap
thumbnailForFile
(
const
QString
&
path
);
...
...
@@ -97,4 +95,4 @@ private:
#endif
\ No newline at end of file
#endif
src/gui/UBFeaturesWidget.cpp
View file @
4b182e73
...
...
@@ -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
<
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
();
//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
<
UBFeature
>
();
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
<
UBFeature
>
();
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
<
UBFeature
>
();
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
}
src/gui/UBFeaturesWidget.h
View file @
4b182e73
...
...
@@ -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
<
UBFeature
>
*
flist
)
{
featuresList
=
flist
;
};
void
setFeaturesList
(
QVector
<
UBFeature
>
*
flist
)
{
featuresList
=
flist
;
}
private
:
QVector
<
UBFeature
>
*
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment