Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
VLMC
Commits
e721b2ba
Commit
e721b2ba
authored
Feb 11, 2011
by
Rohit Yadav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HACKINGS applied.
parent
d50163fc
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
94 additions
and
22 deletions
+94
-22
src/Gui/project/GuiProjectManager.cpp
src/Gui/project/GuiProjectManager.cpp
+9
-0
src/Gui/project/GuiProjectManager.h
src/Gui/project/GuiProjectManager.h
+2
-0
src/Gui/wizard/WelcomePage.cpp
src/Gui/wizard/WelcomePage.cpp
+42
-12
src/Gui/wizard/WelcomePage.h
src/Gui/wizard/WelcomePage.h
+1
-0
src/Gui/wizard/ui/WelcomePage.ui
src/Gui/wizard/ui/WelcomePage.ui
+15
-5
src/Project/ProjectManager.cpp
src/Project/ProjectManager.cpp
+24
-5
src/Project/ProjectManager.h
src/Project/ProjectManager.h
+1
-0
No files found.
src/Gui/project/GuiProjectManager.cpp
View file @
e721b2ba
...
...
@@ -307,3 +307,12 @@ GUIProjectManager::loadProject()
return
;
loadProject
(
fileName
);
}
void
GUIProjectManager
::
removeProject
(
const
QString
&
fileName
)
{
QFile
projectFile
(
fileName
);
if
(
!
projectFile
.
exists
()
)
return
;
ProjectManager
::
removeProject
(
fileName
);
}
src/Gui/project/GuiProjectManager.h
View file @
e721b2ba
...
...
@@ -64,6 +64,8 @@ public:
* This is handled here as there's no use for this in non-GUI mode.
*/
void
loadProject
(
const
QString
&
fileName
);
void
removeProject
(
const
QString
&
fileName
);
protected:
virtual
void
failedToLoad
(
const
QString
&
reason
)
const
;
...
...
src/Gui/wizard/WelcomePage.cpp
View file @
e721b2ba
...
...
@@ -46,6 +46,8 @@ WelcomePage::WelcomePage( QWidget* parent )
connect
(
m_ui
.
openPushButton
,
SIGNAL
(
clicked
()
),
this
,
SLOT
(
loadProject
()
)
);
connect
(
m_ui
.
removeProjectButton
,
SIGNAL
(
clicked
()
),
this
,
SLOT
(
removeProject
()
)
);
connect
(
m_ui
.
projectsListWidget
,
SIGNAL
(
itemPressed
(
QListWidgetItem
*
)
),
this
,
SLOT
(
selectOpenRadio
()
)
);
connect
(
m_ui
.
projectsListWidget
,
SIGNAL
(
itemDoubleClicked
(
QListWidgetItem
*
)
),
...
...
@@ -62,7 +64,8 @@ WelcomePage::~WelcomePage()
delete
m_projectPath
;
}
void
WelcomePage
::
changeEvent
(
QEvent
*
e
)
void
WelcomePage
::
changeEvent
(
QEvent
*
e
)
{
switch
(
e
->
type
()
)
{
...
...
@@ -74,7 +77,8 @@ void WelcomePage::changeEvent( QEvent *e )
}
}
int
WelcomePage
::
nextId
()
const
int
WelcomePage
::
nextId
()
const
{
if
(
m_ui
.
createRadioButton
->
isChecked
()
)
return
ProjectWizard
::
Page_General
;
...
...
@@ -82,7 +86,8 @@ int WelcomePage::nextId() const
return
ProjectWizard
::
Page_Open
;
}
void
WelcomePage
::
initializePage
()
void
WelcomePage
::
initializePage
()
{
QSettings
s
;
...
...
@@ -91,7 +96,8 @@ void WelcomePage::initializePage()
loadRecentsProjects
();
}
bool
WelcomePage
::
validatePage
()
bool
WelcomePage
::
validatePage
()
{
if
(
m_ui
.
openRadioButton
->
isChecked
()
)
{
...
...
@@ -109,12 +115,14 @@ bool WelcomePage::validatePage()
return
true
;
}
void
WelcomePage
::
cleanupPage
()
void
WelcomePage
::
cleanupPage
()
{
}
void
WelcomePage
::
loadRecentsProjects
()
void
WelcomePage
::
loadRecentsProjects
()
{
m_ui
.
projectsListWidget
->
clear
();
ProjectManager
*
pm
=
GUIProjectManager
::
getInstance
();
...
...
@@ -130,7 +138,8 @@ void WelcomePage::loadRecentsProjects()
}
}
void
WelcomePage
::
loadProject
()
void
WelcomePage
::
loadProject
()
{
QString
projectPath
=
QFileDialog
::
getOpenFileName
(
NULL
,
tr
(
"Select a project file"
),
...
...
@@ -163,30 +172,51 @@ void WelcomePage::loadProject()
selectOpenRadio
();
}
void
WelcomePage
::
selectOpenRadio
()
void
WelcomePage
::
removeProject
()
{
QList
<
QListWidgetItem
*>
selected
=
m_ui
.
projectsListWidget
->
selectedItems
();
if
(
selected
.
isEmpty
()
)
return
;
const
QString
fileName
=
selected
.
at
(
0
)
->
data
(
FilePath
).
toString
();
if
(
fileName
.
isEmpty
()
)
return
;
GUIProjectManager
::
getInstance
()
->
removeProject
(
fileName
);
loadRecentsProjects
();
// Reload recent projects
}
void
WelcomePage
::
selectOpenRadio
()
{
m_ui
.
openRadioButton
->
setChecked
(
true
);
m_ui
.
removeProjectButton
->
setEnabled
(
true
);
}
void
WelcomePage
::
projectDoubleClicked
(
QListWidgetItem
*
item
)
void
WelcomePage
::
projectDoubleClicked
(
QListWidgetItem
*
item
)
{
Q_UNUSED
(
item
);
if
(
wizard
()
)
wizard
()
->
next
();
}
QString
WelcomePage
::
projectPath
()
QString
WelcomePage
::
projectPath
()
{
return
*
m_projectPath
;
}
void
WelcomePage
::
setProjectPath
(
const
QString
&
path
)
void
WelcomePage
::
setProjectPath
(
const
QString
&
path
)
{
m_projectPath
->
clear
();
m_projectPath
->
append
(
path
);
}
void
WelcomePage
::
hideWizardAtStartup
(
bool
hidden
)
void
WelcomePage
::
hideWizardAtStartup
(
bool
hidden
)
{
QSettings
s
;
s
.
setValue
(
"ShowWizardStartup"
,
!
hidden
);
...
...
src/Gui/wizard/WelcomePage.h
View file @
e721b2ba
...
...
@@ -50,6 +50,7 @@ class WelcomePage : public QWizardPage
private
slots
:
void
loadProject
();
void
removeProject
();
void
loadRecentsProjects
();
void
projectDoubleClicked
(
QListWidgetItem
*
item
);
void
selectOpenRadio
();
...
...
src/Gui/wizard/ui/WelcomePage.ui
View file @
e721b2ba
...
...
@@ -6,7 +6,7 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
5
2
1
</width>
<width>
5
5
1
</width>
<height>
414
</height>
</rect>
</property>
...
...
@@ -54,7 +54,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item
row=
"
6
"
column=
"1"
>
<item
row=
"
7
"
column=
"1"
>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
...
...
@@ -83,7 +83,7 @@ p, li { white-space: pre-wrap; }
</property>
</spacer>
</item>
<item
row=
"4"
column=
"1"
rowspan=
"
2
"
>
<item
row=
"4"
column=
"1"
rowspan=
"
3
"
>
<widget
class=
"QListWidget"
name=
"projectsListWidget"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Maximum"
vsizetype=
"Maximum"
>
...
...
@@ -100,7 +100,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item
row=
"
5
"
column=
"2"
>
<item
row=
"
6
"
column=
"2"
>
<spacer
name=
"verticalSpacer_3"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
...
...
@@ -142,7 +142,7 @@ p, li { white-space: pre-wrap; }
</property>
</spacer>
</item>
<item
row=
"
7
"
column=
"0"
colspan=
"4"
>
<item
row=
"
8
"
column=
"0"
colspan=
"4"
>
<widget
class=
"QCheckBox"
name=
"hideStartupCheckBox"
>
<property
name=
"text"
>
<string>
Do not show at startup.
</string>
...
...
@@ -152,6 +152,16 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item
row=
"5"
column=
"2"
>
<widget
class=
"QPushButton"
name=
"removeProjectButton"
>
<property
name=
"enabled"
>
<bool>
false
</bool>
</property>
<property
name=
"text"
>
<string>
Remove
</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
...
...
src/Project/ProjectManager.cpp
View file @
e721b2ba
...
...
@@ -32,6 +32,7 @@
#include "Workspace.h"
#include <QDir>
#include <QMessageBox>
#include <QSettings>
#include <QtDebug>
#include <QXmlStreamWriter>
...
...
@@ -165,7 +166,21 @@ ProjectManager::loadProject( const QString& fileName )
Library
::
getInstance
()
->
loadProject
(
root
);
}
void
ProjectManager
::
__saveProject
(
const
QString
&
fileName
)
void
ProjectManager
::
removeProject
(
const
QString
&
fileName
)
{
// Remove all occurence of fileName
m_recentsProjects
.
removeAll
(
fileName
);
if
(
!
QFile
::
remove
(
fileName
)
)
QMessageBox
::
warning
(
NULL
,
tr
(
"Can't delete project file"
),
tr
(
"Can't delete this project file: %1
\n
Please delete it manually."
).
arg
(
fileName
)
);
QSettings
s
;
s
.
setValue
(
"RecentsProjects"
,
m_recentsProjects
);
}
void
ProjectManager
::
__saveProject
(
const
QString
&
fileName
)
{
QByteArray
projectString
;
...
...
@@ -189,7 +204,8 @@ void ProjectManager::__saveProject( const QString &fileName )
file
.
write
(
projectString
);
}
void
ProjectManager
::
emergencyBackup
()
void
ProjectManager
::
emergencyBackup
()
{
QString
name
;
...
...
@@ -203,7 +219,8 @@ void ProjectManager::emergencyBackup()
s
.
sync
();
}
bool
ProjectManager
::
isBackupFile
(
const
QString
&
projectFile
)
bool
ProjectManager
::
isBackupFile
(
const
QString
&
projectFile
)
{
return
projectFile
.
endsWith
(
ProjectManager
::
backupSuffix
);
}
...
...
@@ -215,7 +232,8 @@ ProjectManager::createAutoSaveOutputFileName( const QString& baseName ) const
}
void
ProjectManager
::
appendToRecentProject
(
const
QString
&
projectFile
)
void
ProjectManager
::
appendToRecentProject
(
const
QString
&
projectFile
)
{
// Append the item to the recents list
m_recentsProjects
.
removeAll
(
projectFile
);
...
...
@@ -227,7 +245,8 @@ void ProjectManager::appendToRecentProject( const QString& projectFile )
s
.
setValue
(
"RecentsProjects"
,
m_recentsProjects
);
}
QString
ProjectManager
::
projectName
()
const
QString
ProjectManager
::
projectName
()
const
{
if
(
m_projectName
.
isEmpty
()
==
true
)
{
...
...
src/Project/ProjectManager.h
View file @
e721b2ba
...
...
@@ -48,6 +48,7 @@ public:
static
const
QString
backupSuffix
;
void
loadProject
(
const
QString
&
fileName
);
void
removeProject
(
const
QString
&
fileName
);
QStringList
recentsProjects
()
const
;
virtual
bool
closeProject
();
virtual
void
saveProject
(
const
QString
&
outputFileName
);
...
...
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