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
f6ac9f82
Commit
f6ac9f82
authored
Aug 14, 2012
by
Ilia Ryabokon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Progress bar favorites fix
parent
fbb5d875
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
215 additions
and
160 deletions
+215
-160
UBFeaturesController.cpp
src/board/UBFeaturesController.cpp
+84
-111
UBFeaturesController.h
src/board/UBFeaturesController.h
+14
-3
UBFeaturesWidget.cpp
src/gui/UBFeaturesWidget.cpp
+89
-44
UBFeaturesWidget.h
src/gui/UBFeaturesWidget.h
+28
-2
No files found.
src/board/UBFeaturesController.cpp
View file @
f6ac9f82
This diff is collapsed.
Click to expand it.
src/board/UBFeaturesController.h
View file @
f6ac9f82
...
...
@@ -33,7 +33,7 @@ class UBFeaturesComputingThread : public QThread
public
:
explicit
UBFeaturesComputingThread
(
QObject
*
parent
=
0
);
virtual
~
UBFeaturesComputingThread
();
void
compute
(
const
QList
<
QPair
<
QUrl
,
QString
>
>
&
pScanningData
);
void
compute
(
const
QList
<
QPair
<
QUrl
,
QString
>
>
&
pScanningData
,
QSet
<
QUrl
>
*
pFavoritesSet
);
protected
:
void
run
();
...
...
@@ -44,12 +44,14 @@ signals:
void
scanStarted
();
void
scanFinished
();
void
maxFilesCountEvaluated
(
int
max
);
void
scanCategory
(
const
QString
&
str
);
void
scanPath
(
const
QString
&
str
);
public
slots
:
private
:
void
scanFS
(
const
QUrl
&
currentPath
,
const
QString
&
currVirtualPath
);
void
scanAll
(
QList
<
QPair
<
QUrl
,
QString
>
>
pScanningData
);
void
scanFS
(
const
QUrl
&
currentPath
,
const
QString
&
currVirtualPath
,
const
QSet
<
QUrl
>
&
pFavoriteSet
);
void
scanAll
(
QList
<
QPair
<
QUrl
,
QString
>
>
pScanningData
,
const
QSet
<
QUrl
>
&
pFavoriteSet
);
int
featuresCount
(
const
QUrl
&
pPath
);
int
featuresCountAll
(
QList
<
QPair
<
QUrl
,
QString
>
>
pScanningData
);
...
...
@@ -59,6 +61,7 @@ private:
QUrl
mScanningPath
;
QString
mScanningVirtualPath
;
QList
<
QPair
<
QUrl
,
QString
>
>
mScanningData
;
QSet
<
QUrl
>
mFavoriteSet
;
bool
restart
;
bool
abort
;
};
...
...
@@ -72,6 +75,9 @@ enum UBFeatureElementType
FEATURE_INTERACTIVE
,
FEATURE_INTERNAL
,
FEATURE_ITEM
,
FEATURE_AUDIO
,
FEATURE_VIDEO
,
FEATURE_IMAGE
,
FEATURE_TRASH
,
FEATURE_FAVORITE
,
FEATURE_SEARCH
,
...
...
@@ -107,6 +113,7 @@ public:
private
:
QString
virtualDir
;
QString
virtualPath
;
QImage
mThumbnail
;
QString
mName
;
QUrl
mPath
;
...
...
@@ -167,6 +174,7 @@ public:
static
QImage
getIcon
(
const
QString
&
path
,
UBFeatureElementType
pFType
);
static
bool
isDeletable
(
const
QUrl
&
url
);
static
char
featureTypeSplitter
()
{
return
':'
;}
static
QString
categoryNameForVirtualPath
(
const
QString
&
str
);
static
const
QString
virtualRootName
;
...
...
@@ -178,6 +186,8 @@ signals:
void
scanStarted
();
void
scanFinished
();
void
featureAddedFromThread
();
void
scanCategory
(
const
QString
&
);
void
scanPath
(
const
QString
&
);
private
slots
:
void
addNewFolder
(
QString
name
);
...
...
@@ -233,6 +243,7 @@ private:
QString
interactPath
;
QString
trashPath
;
QString
favoritePath
;
QString
webSearchPath
;
int
mLastItemOffsetIndex
;
UBFeature
currentElement
;
...
...
src/gui/UBFeaturesWidget.cpp
View file @
f6ac9f82
...
...
@@ -82,7 +82,9 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name)
connect
(
controller
,
SIGNAL
(
scanStarted
()),
mActionBar
,
SLOT
(
lockIt
()));
connect
(
controller
,
SIGNAL
(
scanFinished
()),
mActionBar
,
SLOT
(
unlockIt
()));
connect
(
controller
,
SIGNAL
(
maxFilesCountEvaluated
(
int
)),
centralWidget
,
SIGNAL
(
maxFilesCountEvaluated
(
int
)));
connect
(
controller
,
SIGNAL
(
featureAddedFromThread
()),
centralWidget
,
SLOT
(
increaseStatusBarValue
()));
connect
(
controller
,
SIGNAL
(
featureAddedFromThread
()),
centralWidget
,
SIGNAL
(
increaseStatusBarValue
()));
connect
(
controller
,
SIGNAL
(
scanCategory
(
QString
)),
centralWidget
,
SIGNAL
(
scanCategory
(
QString
)));
connect
(
controller
,
SIGNAL
(
scanPath
(
QString
)),
centralWidget
,
SIGNAL
(
scanPath
(
QString
)));
}
UBFeaturesWidget
::~
UBFeaturesWidget
()
...
...
@@ -498,15 +500,14 @@ UBFeaturesCentralWidget::UBFeaturesCentralWidget(QWidget *parent) : QWidget(pare
connect
(
this
,
SIGNAL
(
sendFileNameList
(
QStringList
)),
dlg
,
SLOT
(
setFileNameList
(
QStringList
)));
//Progress bar to show scanning progress
QProgressBar
*
progressBar
=
new
QProgressBar
();
UBFeaturesProgressInfo
*
progressBar
=
new
UBFeaturesProgressInfo
();
mAdditionalDataContainer
->
addWidget
(
progressBar
);
mAdditionalDataContainer
->
setCurrentIndex
(
ProgressBarWidget
);
progressBar
->
setMinimum
(
0
);
progressBar
->
setValue
(
0
);
progressBar
->
setMaximum
(
10000
);
connect
(
this
,
SIGNAL
(
maxFilesCountEvaluated
(
int
)),
progressBar
,
SLOT
(
setMaximum
(
int
)));
connect
(
this
,
SIGNAL
(
maxFilesCountEvaluated
(
int
)),
progressBar
,
SLOT
(
setProgressMax
(
int
)));
connect
(
this
,
SIGNAL
(
increaseStatusBarValue
()),
progressBar
,
SLOT
(
increaseProgressValue
()));
connect
(
this
,
SIGNAL
(
scanCategory
(
QString
)),
progressBar
,
SLOT
(
setCommmonInfoText
(
QString
)));
connect
(
this
,
SIGNAL
(
scanPath
(
QString
)),
progressBar
,
SLOT
(
setDetailedInfoText
(
QString
)));
mLayout
->
addWidget
(
mStackedWidget
,
1
);
mLayout
->
addWidget
(
mAdditionalDataContainer
,
0
);
...
...
@@ -547,6 +548,11 @@ UBFeature UBFeaturesCentralWidget::getCurElementFromProperties()
void
UBFeaturesCentralWidget
::
showAdditionalData
(
AddWidget
pWidgetType
,
AddWidgetState
pState
)
{
if
(
!
mAdditionalDataContainer
->
widget
(
pWidgetType
))
{
qDebug
()
<<
"can't find widget specified by UBFeaturesCentralWidget::showAdditionalData(AddWidget pWidgetType, AddWidgetState pState)"
;
return
;
}
mAdditionalDataContainer
->
setMaximumHeight
(
mAdditionalDataContainer
->
widget
(
pWidgetType
)
->
sizeHint
().
height
());
mAdditionalDataContainer
->
setCurrentIndex
(
pWidgetType
);
...
...
@@ -574,46 +580,21 @@ void UBFeaturesCentralWidget::hideAdditionalData()
void
UBFeaturesCentralWidget
::
scanStarted
()
{
if
(
!
mAdditionalDataContainer
->
widget
(
ProgressBarWidget
))
{
return
;
}
QProgressBar
*
progressBar
=
qobject_cast
<
QProgressBar
*>
(
mAdditionalDataContainer
->
widget
(
ProgressBarWidget
));
if
(
progressBar
&&
!
progressBar
->
isVisible
())
{
showAdditionalData
((
AddWidget
)
1
);
}
showAdditionalData
(
ProgressBarWidget
);
}
void
UBFeaturesCentralWidget
::
scanFinished
()
{
if
(
!
mAdditionalDataContainer
->
widget
(
ProgressBarWidget
))
{
return
;
}
QProgressBar
*
progressBar
=
qobject_cast
<
QProgressBar
*>
(
mAdditionalDataContainer
->
widget
(
ProgressBarWidget
));
if
(
progressBar
&&
progressBar
->
isVisible
())
{
hideAdditionalData
();
qDebug
()
<<
"progressBar max value is "
<<
progressBar
->
maximum
();
}
}
void
UBFeaturesCentralWidget
::
increaseStatusBarValue
()
{
if
(
!
mAdditionalDataContainer
->
widget
(
ProgressBarWidget
))
{
return
;
}
QProgressBar
*
progressBar
=
qobject_cast
<
QProgressBar
*>
(
mAdditionalDataContainer
->
widget
(
ProgressBarWidget
));
if
(
progressBar
)
{
progressBar
->
setValue
(
progressBar
->
value
()
+
1
);
}
hideAdditionalData
();
}
UBFeaturesNewFolderDialog
::
UBFeaturesNewFolderDialog
(
QWidget
*
parent
)
:
QWidget
(
parent
)
{
this
->
setStyleSheet
(
"background:white;"
);
QVBoxLayout
*
mainLayout
=
new
QVBoxLayout
();
setLayout
(
mainLayout
);
QVBoxLayout
*
mainLayout
=
new
QVBoxLayout
(
this
);
QVBoxLayout
*
labelLayout
=
new
QVBoxLayout
(
this
);
QVBoxLayout
*
labelLayout
=
new
QVBoxLayout
();
QLabel
*
mLabel
=
new
QLabel
(
labelText
,
this
);
mLineEdit
=
new
QLineEdit
(
this
);
...
...
@@ -623,7 +604,7 @@ UBFeaturesNewFolderDialog::UBFeaturesNewFolderDialog(QWidget *parent) : QWidget(
labelLayout
->
addWidget
(
mLabel
);
labelLayout
->
addWidget
(
mLineEdit
);
QHBoxLayout
*
buttonLayout
=
new
QHBoxLayout
(
this
);
QHBoxLayout
*
buttonLayout
=
new
QHBoxLayout
();
acceptButton
=
new
QPushButton
(
acceptText
,
this
);
QPushButton
*
cancelButton
=
new
QPushButton
(
cancelText
,
this
);
...
...
@@ -677,6 +658,64 @@ void UBFeaturesNewFolderDialog::reactOnTextChanged(const QString &pStr)
}
}
UBFeaturesProgressInfo
::
UBFeaturesProgressInfo
(
QWidget
*
parent
)
:
QWidget
(
parent
),
mProgressBar
(
0
),
mCommonInfoLabel
(
0
),
mDetailedInfoLabel
(
0
)
{
QVBoxLayout
*
mainLayer
=
new
QVBoxLayout
(
this
);
mProgressBar
=
new
QProgressBar
(
this
);
// setting defaults
mProgressBar
->
setMinimum
(
0
);
mProgressBar
->
setMaximum
(
100000
);
mProgressBar
->
setValue
(
0
);
mProgressBar
->
setStyleSheet
(
"background:white"
);
mCommonInfoLabel
=
new
QLabel
(
this
);
mDetailedInfoLabel
=
new
QLabel
(
this
);
mDetailedInfoLabel
->
setAlignment
(
Qt
::
AlignRight
);
mCommonInfoLabel
->
hide
();
mDetailedInfoLabel
->
hide
();
mainLayer
->
addWidget
(
mCommonInfoLabel
);
mainLayer
->
addWidget
(
mDetailedInfoLabel
);
mainLayer
->
addWidget
(
mProgressBar
);
}
void
UBFeaturesProgressInfo
::
setCommmonInfoText
(
const
QString
&
str
)
{
mProgressBar
->
setFormat
(
str
+
tr
(
" load"
)
+
"(%p%)"
);
}
void
UBFeaturesProgressInfo
::
setDetailedInfoText
(
const
QString
&
str
)
{
mDetailedInfoLabel
->
setText
(
str
);
}
void
UBFeaturesProgressInfo
::
setProgressMax
(
int
pValue
)
{
mProgressBar
->
setMaximum
(
pValue
);
}
void
UBFeaturesProgressInfo
::
setProgressMin
(
int
pValue
)
{
mProgressBar
->
setMinimum
(
pValue
);
}
void
UBFeaturesProgressInfo
::
increaseProgressValue
()
{
mProgressBar
->
setValue
(
mProgressBar
->
value
()
+
1
);
}
void
UBFeaturesProgressInfo
::
sendFeature
(
UBFeature
pFeature
)
{
Q_UNUSED
(
pFeature
);
}
UBFeaturesWebView
::
UBFeaturesWebView
(
QWidget
*
parent
,
const
char
*
name
)
:
QWidget
(
parent
)
,
mpView
(
NULL
)
,
mpWebSettings
(
NULL
)
...
...
@@ -1295,9 +1334,12 @@ Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const
{
UBFeature
item
=
index
.
data
(
Qt
::
UserRole
+
1
).
value
<
UBFeature
>
();
if
(
item
.
getType
()
==
FEATURE_INTERACTIVE
||
item
.
getType
()
==
FEATURE_ITEM
||
item
.
getType
()
==
FEATURE_INTERNAL
||
item
.
getType
()
==
FEATURE_FOLDER
)
||
item
.
getType
()
==
FEATURE_ITEM
||
item
.
getType
()
==
FEATURE_AUDIO
||
item
.
getType
()
==
FEATURE_VIDEO
||
item
.
getType
()
==
FEATURE_IMAGE
||
item
.
getType
()
==
FEATURE_INTERNAL
||
item
.
getType
()
==
FEATURE_FOLDER
)
resultFlags
|=
Qt
::
ItemIsDragEnabled
;
...
...
@@ -1338,12 +1380,15 @@ bool UBFeaturesSearchProxyModel::filterAcceptsRow( int sourceRow, const QModelIn
/*QString name = sourceModel()->data(index, Qt::DisplayRole).toString();
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
()
==
FEATURE_INTERACTIVE
||
feature
.
getType
()
==
FEATURE_INTERNAL
||
feature
.
getType
()
==
FEATURE_ITEM
;
||
feature
.
getType
()
==
FEATURE_INTERNAL
||
feature
.
getType
()
==
FEATURE_ITEM
||
feature
.
getType
()
==
FEATURE_AUDIO
||
feature
.
getType
()
==
FEATURE_VIDEO
||
feature
.
getType
()
==
FEATURE_IMAGE
;
return
isFile
&&
filterRegExp
().
exactMatch
(
feature
.
getName
()
);
return
isFile
&&
filterRegExp
().
exactMatch
(
feature
.
getName
()
);
}
bool
UBFeaturesPathProxyModel
::
filterAcceptsRow
(
int
sourceRow
,
const
QModelIndex
&
sourceParent
)
const
...
...
src/gui/UBFeaturesWidget.h
View file @
f6ac9f82
...
...
@@ -45,6 +45,7 @@ class UBFeaturesNavigatorWidget;
class
UBFeaturesMimeData
;
class
UBFeaturesCentralWidget
;
class
UBFeaturesNewFolderDialog
;
class
UBFeaturesProgressBar
;
class
UBFeaturesWidget
:
public
UBDockPaletteWidget
{
...
...
@@ -189,7 +190,6 @@ public:
void
setPropertiesThumbnail
(
const
QPixmap
&
pix
);
StackElement
currentView
()
const
{
return
static_cast
<
StackElement
>
(
mStackedWidget
->
currentIndex
());}
UBFeature
getCurElementFromProperties
();
void
showAdditionalData
(
AddWidget
pWidgetType
,
AddWidgetState
pState
=
NonModal
);
void
setLockedExcludingAdditional
(
bool
pLock
);
...
...
@@ -207,6 +207,12 @@ signals:
// progressbar widget related signals
void
maxFilesCountEvaluated
(
int
pValue
);
void
increaseStatusBarValue
();
void
scanCategory
(
const
QString
&
);
void
scanPath
(
const
QString
&
);
public
slots
:
void
showAdditionalData
(
AddWidget
pWidgetType
,
AddWidgetState
pState
=
NonModal
);
private
slots
:
void
createNewFolderSlot
(
QString
pStr
);
...
...
@@ -214,7 +220,6 @@ private slots:
void
scanStarted
();
void
scanFinished
();
void
increaseStatusBarValue
();
private
:
...
...
@@ -252,6 +257,27 @@ private:
};
class
UBFeaturesProgressInfo
:
public
QWidget
{
Q_OBJECT
public
:
UBFeaturesProgressInfo
(
QWidget
*
parent
=
0
);
private
slots
:
void
setCommmonInfoText
(
const
QString
&
str
);
void
setDetailedInfoText
(
const
QString
&
str
);
void
setProgressMin
(
int
pValue
);
void
setProgressMax
(
int
pValue
);
void
increaseProgressValue
();
void
sendFeature
(
UBFeature
pFeature
);
private
:
QProgressBar
*
mProgressBar
;
QLabel
*
mCommonInfoLabel
;
QLabel
*
mDetailedInfoLabel
;
};
class
UBFeaturesWebView
:
public
QWidget
{
Q_OBJECT
...
...
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