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
fbb5d875
Commit
fbb5d875
authored
Aug 09, 2012
by
Ilia Ryabokon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sankore 874 feature widget create folder twice resolved
parent
d9559650
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
74 additions
and
3 deletions
+74
-3
UBFeaturesController.cpp
src/board/UBFeaturesController.cpp
+22
-0
UBFeaturesController.h
src/board/UBFeaturesController.h
+1
-0
UBFeaturesActionBar.cpp
src/gui/UBFeaturesActionBar.cpp
+10
-0
UBFeaturesActionBar.h
src/gui/UBFeaturesActionBar.h
+2
-0
UBFeaturesWidget.cpp
src/gui/UBFeaturesWidget.cpp
+29
-2
UBFeaturesWidget.h
src/gui/UBFeaturesWidget.h
+10
-1
No files found.
src/board/UBFeaturesController.cpp
View file @
fbb5d875
...
...
@@ -622,6 +622,7 @@ void UBFeaturesController::importImage(const QImage &image, const QString &fileN
importImage
(
image
,
currentElement
,
fileName
);
}
void
UBFeaturesController
::
importImage
(
const
QImage
&
image
,
const
UBFeature
&
destination
,
const
QString
&
fileName
)
{
QString
mFileName
=
fileName
;
...
...
@@ -648,6 +649,27 @@ void UBFeaturesController::importImage( const QImage &image, const UBFeature &de
}
QStringList
UBFeaturesController
::
getFileNamesInFolders
()
{
QStringList
strList
;
Q_ASSERT
(
curListModel
);
for
(
int
i
=
0
;
i
<
curListModel
->
rowCount
(
QModelIndex
());
i
++
)
{
QModelIndex
ind
=
curListModel
->
index
(
i
,
0
);
if
(
!
ind
.
isValid
())
{
qDebug
()
<<
"incorrect model index catched"
;
continue
;
}
UBFeature
curFeature
=
curListModel
->
data
(
ind
,
Qt
::
UserRole
+
1
).
value
<
UBFeature
>
();
if
(
curFeature
.
getType
()
==
FEATURE_FOLDER
)
{
strList
<<
QFileInfo
(
curFeature
.
getFullPath
().
toLocalFile
()).
fileName
();
}
}
return
strList
;
}
void
UBFeaturesController
::
addNewFolder
(
QString
name
)
{
QString
path
=
currentElement
.
getFullPath
().
toLocalFile
()
+
"/"
+
name
;
...
...
src/board/UBFeaturesController.h
View file @
fbb5d875
...
...
@@ -157,6 +157,7 @@ public:
void
removeFromFavorite
(
const
QUrl
&
path
,
bool
deleteManualy
=
false
);
void
importImage
(
const
QImage
&
image
,
const
QString
&
fileName
=
QString
());
void
importImage
(
const
QImage
&
image
,
const
UBFeature
&
destination
,
const
QString
&
fileName
=
QString
()
);
QStringList
getFileNamesInFolders
();
void
fileSystemScan
(
const
QUrl
&
currPath
,
const
QString
&
currVirtualPath
);
int
featuresCount
(
const
QUrl
&
currPath
);
...
...
src/gui/UBFeaturesActionBar.cpp
View file @
fbb5d875
...
...
@@ -209,6 +209,16 @@ void UBFeaturesActionBar::onActionRescanModel()
emit
rescanModel
();
}
void
UBFeaturesActionBar
::
lockIt
()
{
setEnabled
(
false
);
}
void
UBFeaturesActionBar
::
unlockIt
()
{
setEnabled
(
true
);
}
void
UBFeaturesActionBar
::
dragEnterEvent
(
QDragEnterEvent
*
event
)
{
const
UBFeaturesMimeData
*
fMimeData
=
qobject_cast
<
const
UBFeaturesMimeData
*>
(
event
->
mimeData
());
...
...
src/gui/UBFeaturesActionBar.h
View file @
fbb5d875
...
...
@@ -45,6 +45,8 @@ private slots:
void
onActionRemoveFavorite
();
void
onActionTrash
();
void
onActionRescanModel
();
void
lockIt
();
void
unlockIt
();
protected
:
void
dragEnterEvent
(
QDragEnterEvent
*
event
);
...
...
src/gui/UBFeaturesWidget.cpp
View file @
fbb5d875
#include <QDomDocument>
#include "UBFeaturesWidget.h"
#include "domain/UBAbstractWidget.h"
#include "gui/UBThumbnailWidget.h"
...
...
@@ -61,6 +60,7 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name)
layout
->
addWidget
(
mActionBar
);
connect
(
centralWidget
->
listView
(),
SIGNAL
(
clicked
(
const
QModelIndex
&
)),
this
,
SLOT
(
currentSelected
(
const
QModelIndex
&
)));
connect
(
this
,
SIGNAL
(
sendFileNameList
(
QStringList
)),
centralWidget
,
SIGNAL
(
sendFileNameList
(
QStringList
)));
connect
(
mActionBar
,
SIGNAL
(
searchElement
(
const
QString
&
)),
this
,
SLOT
(
searchStarted
(
const
QString
&
)));
connect
(
mActionBar
,
SIGNAL
(
newFolderToCreate
()),
this
,
SLOT
(
createNewFolder
()));
connect
(
mActionBar
,
SIGNAL
(
deleteElements
(
const
UBFeaturesMimeData
*
)),
this
,
SLOT
(
deleteElements
(
const
UBFeaturesMimeData
*
)));
...
...
@@ -79,6 +79,8 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name)
connect
(
centralWidget
,
SIGNAL
(
createNewFolderSignal
(
QString
)),
controller
,
SLOT
(
addNewFolder
(
QString
)));
connect
(
controller
,
SIGNAL
(
scanStarted
()),
centralWidget
,
SLOT
(
scanStarted
()));
connect
(
controller
,
SIGNAL
(
scanFinished
()),
centralWidget
,
SLOT
(
scanFinished
()));
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
()));
}
...
...
@@ -145,6 +147,7 @@ void UBFeaturesWidget::currentSelected(const QModelIndex ¤t)
void
UBFeaturesWidget
::
createNewFolder
()
{
centralWidget
->
showAdditionalData
(
UBFeaturesCentralWidget
::
NewFolderDialog
,
UBFeaturesCentralWidget
::
Modal
);
emit
sendFileNameList
(
controller
->
getFileNamesInFolders
());
}
void
UBFeaturesWidget
::
addFolder
()
...
...
@@ -492,6 +495,7 @@ UBFeaturesCentralWidget::UBFeaturesCentralWidget(QWidget *parent) : QWidget(pare
connect
(
dlg
,
SIGNAL
(
createNewFolder
(
QString
)),
this
,
SLOT
(
createNewFolderSlot
(
QString
)));
connect
(
dlg
,
SIGNAL
(
closeDialog
()),
this
,
SLOT
(
hideAdditionalData
()));
connect
(
this
,
SIGNAL
(
sendFileNameList
(
QStringList
)),
dlg
,
SLOT
(
setFileNameList
(
QStringList
)));
//Progress bar to show scanning progress
QProgressBar
*
progressBar
=
new
QProgressBar
();
...
...
@@ -621,7 +625,7 @@ UBFeaturesNewFolderDialog::UBFeaturesNewFolderDialog(QWidget *parent) : QWidget(
QHBoxLayout
*
buttonLayout
=
new
QHBoxLayout
(
this
);
QPushButton
*
acceptButton
=
new
QPushButton
(
acceptText
,
this
);
acceptButton
=
new
QPushButton
(
acceptText
,
this
);
QPushButton
*
cancelButton
=
new
QPushButton
(
cancelText
,
this
);
buttonLayout
->
addWidget
(
acceptButton
);
buttonLayout
->
addWidget
(
cancelButton
);
...
...
@@ -629,14 +633,23 @@ UBFeaturesNewFolderDialog::UBFeaturesNewFolderDialog(QWidget *parent) : QWidget(
mainLayout
->
addLayout
(
labelLayout
);
mainLayout
->
addLayout
(
buttonLayout
);
acceptButton
->
setEnabled
(
false
);
connect
(
acceptButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
accept
()));
connect
(
cancelButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
reject
()));
connect
(
mLineEdit
,
SIGNAL
(
textEdited
(
QString
)),
this
,
SLOT
(
reactOnTextChanged
(
QString
)));
reactOnTextChanged
(
QString
());
}
void
UBFeaturesNewFolderDialog
::
setRegexp
(
const
QRegExp
pRegExp
)
{
mValidator
->
setRegExp
(
pRegExp
);
}
bool
UBFeaturesNewFolderDialog
::
validString
(
const
QString
&
pStr
)
{
return
mLineEdit
->
hasAcceptableInput
()
&&
!
mFileNameList
.
contains
(
pStr
,
Qt
::
CaseSensitive
);
}
void
UBFeaturesNewFolderDialog
::
accept
()
{
...
...
@@ -649,6 +662,20 @@ void UBFeaturesNewFolderDialog::reject()
mLineEdit
->
clear
();
emit
closeDialog
();
}
void
UBFeaturesNewFolderDialog
::
setFileNameList
(
const
QStringList
&
pLst
)
{
mFileNameList
=
pLst
;
}
void
UBFeaturesNewFolderDialog
::
reactOnTextChanged
(
const
QString
&
pStr
)
{
if
(
validString
(
pStr
))
{
acceptButton
->
setEnabled
(
true
);
mLineEdit
->
setStyleSheet
(
"background:white;"
);
}
else
{
acceptButton
->
setEnabled
(
false
);
mLineEdit
->
setStyleSheet
(
"background:#FFB3C8;"
);
}
}
UBFeaturesWebView
::
UBFeaturesWebView
(
QWidget
*
parent
,
const
char
*
name
)
:
QWidget
(
parent
)
,
mpView
(
NULL
)
...
...
src/gui/UBFeaturesWidget.h
View file @
fbb5d875
...
...
@@ -72,6 +72,9 @@ public:
int
scrollbarHorisontalPadding
()
const
{
return
10
;}
int
scrollbarVerticalIndent
()
const
{
return
0
;}
signals
:
void
sendFileNameList
(
const
QStringList
lst
);
private
slots
:
void
onPreviewLoaded
(
int
id
,
bool
pSuccess
,
QUrl
sourceUrl
,
QString
pContentTypeHeader
,
QByteArray
pData
,
QPointF
pPos
,
QSize
pSize
,
bool
isBackground
);
void
currentSelected
(
const
QModelIndex
&
);
...
...
@@ -190,7 +193,6 @@ public:
void
setLockedExcludingAdditional
(
bool
pLock
);
QStackedWidget
*
mStackedWidget
;
UBFeaturesNavigatorWidget
*
mNavigator
;
UBFeatureProperties
*
mFeatureProperties
;
...
...
@@ -201,6 +203,7 @@ public:
signals
:
void
lockMainWidget
(
bool
pLock
);
void
createNewFolderSignal
(
QString
pStr
);
void
sendFileNameList
(
const
QStringList
lst
);
// progressbar widget related signals
void
maxFilesCountEvaluated
(
int
pValue
);
...
...
@@ -228,6 +231,7 @@ public:
UBFeaturesNewFolderDialog
(
QWidget
*
parent
=
0
);
void
setRegexp
(
const
QRegExp
pRegExp
);
bool
validString
(
const
QString
&
pStr
);
signals
:
void
createNewFolder
(
QString
str
);
...
...
@@ -236,10 +240,15 @@ signals:
private
slots
:
void
accept
();
void
reject
();
void
setFileNameList
(
const
QStringList
&
pLst
);
void
reactOnTextChanged
(
const
QString
&
pStr
);
private
:
QLineEdit
*
mLineEdit
;
QRegExpValidator
*
mValidator
;
QStringList
mFileNameList
;
QPushButton
*
acceptButton
;
};
...
...
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