-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Project Page #3036
Closed
Closed
New Project Page #3036
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
57bdde5
New Project Page
iiLubos 9e74446
Merge branch 'master' into master_projectList
iiLubos ef4696f
Finished desighn of ListProject page and some logic
iiLubos 380e56f
Added signal / slots
iiLubos 91a52ac
C++ formatting
iiLubos 6be3ffd
Merge branch 'master' into master_projectList
iiLubos 672b635
Fixed qml.qrc according previous PR about Form-refactoring
iiLubos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
import QtQuick | ||
import QtQuick.Controls | ||
|
||
import lc 1.0 | ||
import "../components" | ||
import "../inputs" | ||
|
||
Page { | ||
id: root | ||
|
||
property string headerTitle: qsTr("Projects") | ||
property bool withSearch: false | ||
property alias model: listView.model | ||
property bool showCreateProjectButton: false | ||
|
||
property string activeProjectId: "" | ||
property int projectModelType: ProjectsModel.EmptyProjectsModel | ||
|
||
property var controllerModel | ||
|
||
signal backClicked | ||
signal createProjectClicked | ||
signal personIconClicked | ||
|
||
signal openProjectRequested( string projectFilePath ) | ||
signal showLocalChangesRequested( string projectId ) | ||
signal activeProjectDeleted() | ||
|
||
Rectangle { | ||
anchors.fill: parent | ||
color: __style.lightGreenColor | ||
} | ||
|
||
header: MMHeader { | ||
id: header | ||
|
||
title: root.headerTitle | ||
color: __style.lightGreenColor | ||
personIconVisible: true | ||
rightMarginShift: 40 * __dp | ||
|
||
onBackClicked: root.backClicked() | ||
onPersonIconClicked: root.personIconClicked() | ||
} | ||
|
||
Column { | ||
width: parent.width - 40 * __dp | ||
anchors.horizontalCenter: parent.horizontalCenter | ||
anchors.top: parent.top | ||
anchors.topMargin: 10 * __dp | ||
spacing: 20 * __dp | ||
|
||
MMSearchEditor { | ||
id: searchBar | ||
|
||
width: parent.width - 2 * root.padding | ||
placeholderText: qsTr("Search for projects...") | ||
visible: root.withSearch | ||
|
||
onSearchTextChanged: function(text) { | ||
//root.model.searchExpression = text | ||
} | ||
} | ||
|
||
ListView { | ||
id: listView | ||
|
||
width: parent.width - 2 * root.padding | ||
height: ApplicationWindow.window ? ApplicationWindow.window.height - searchBar.height - 130 * __dp : 0 | ||
clip: true | ||
spacing: 10 * __dp | ||
|
||
delegate: MMProjectItem { | ||
width: listView.width | ||
|
||
highlight: model.ProjectId === root.activeProjectId | ||
projectId: model.ProjectId | ||
projectStatus: model.ProjectStatus ? model.ProjectStatus : ProjectStatus.NoVersion | ||
projectDisplayName: root.projectModelType === ProjectsModel.CreatedProjectsModel ? model.ProjectName : model.ProjectFullName | ||
projectDescription: model.ProjectDescription | ||
projectIsValid: model.ProjectIsValid | ||
projectIsLocal: model.ProjectIsLocal | ||
projectIsMergin: model.ProjectIsMergin | ||
projectIsPending: model.ProjectSyncPending ? model.ProjectSyncPending : false | ||
projectSyncProgress: model.ProjectSyncProgress ? model.ProjectSyncProgress : -1 | ||
projectRemoteError: model.ProjectRemoteError ? model.ProjectRemoteError : "" | ||
|
||
onOpenRequested: { | ||
if ( model.ProjectIsLocal ) | ||
root.openProjectRequested( model.ProjectFilePath ) | ||
else if ( !model.ProjectIsLocal && model.ProjectIsMergin && !model.ProjectSyncPending) { | ||
console.log("Download project with Id: " + model.ProjectId) | ||
} | ||
} | ||
onStopSyncRequested: controllerModel.stopProjectSync( model.ProjectId ) | ||
onShowChangesRequested: root.showLocalChangesRequested( model.ProjectId ) | ||
onSyncRequested: controllerModel.syncProject( model.ProjectId ) | ||
onRemoveRequested: console.log("Remove project with Id: " + model.ProjectId) | ||
onMigrateRequested: controllerModel.migrateProject( model.ProjectId ) | ||
} | ||
|
||
footer: Item { width: 1; height: createProjectButton.visible ? 80 * __dp : 0 } | ||
} | ||
} | ||
|
||
MMButton { | ||
id: createProjectButton | ||
|
||
width: root.width - 2 * 20 * __dp | ||
anchors.horizontalCenter: parent.horizontalCenter | ||
anchors.bottom: parent.bottom | ||
anchors.bottomMargin: 20 * __dp | ||
|
||
visible: root.showCreateProjectButton | ||
text: qsTr("Create project") | ||
|
||
onClicked: root.createProjectClicked() | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "project.h" | ||
|
||
QString LocalProject::id() const | ||
{ | ||
return fullName(); | ||
} | ||
|
||
QString LocalProject::fullName() const | ||
{ | ||
if ( !projectName.isEmpty() && !projectNamespace.isEmpty() ) | ||
return QString( "/getFullProjectName/%1/%2" ).arg( projectNamespace, projectName ); | ||
|
||
if ( projectDir.isEmpty() ) | ||
return QString(); | ||
|
||
QDir dir( projectDir ); | ||
return dir.dirName(); | ||
} | ||
|
||
QString MerginProject::id() const | ||
{ | ||
return QString( "/getFullProjectName/%1/%2" ).arg( projectNamespace, projectName ); | ||
} | ||
|
||
ProjectStatus::Status ProjectStatus::projectStatus( const Project &project ) | ||
{ | ||
if ( !project.isMergin() || !project.isLocal() ) // This is not a Mergin project or not downloaded project | ||
return ProjectStatus::NoVersion; | ||
|
||
// There was no sync yet | ||
if ( !project.local.hasMerginMetadata() ) | ||
{ | ||
return ProjectStatus::NoVersion; | ||
} | ||
|
||
// Version is lower than latest one, last sync also before updated | ||
if ( project.local.localVersion < project.mergin.serverVersion ) | ||
{ | ||
return ProjectStatus::NeedsSync; | ||
} | ||
|
||
if ( ProjectStatus::hasLocalChanges( project.local ) ) | ||
{ | ||
return ProjectStatus::NeedsSync; | ||
} | ||
|
||
return ProjectStatus::UpToDate; | ||
} | ||
|
||
bool ProjectStatus::hasLocalChanges( const LocalProject &project ) | ||
{ | ||
return false; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not correct approach. Personal Icon should be bound from parent as right item
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can discuss it. This is a special item and should be extended by the new design, it can contain a red mark on the top right corner of this icon or can contain user initials instead of the icon.