Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
WillemNieuwenhuis committed May 8, 2015
2 parents 783588a + e12d18b commit 2c25590
Show file tree
Hide file tree
Showing 22 changed files with 311 additions and 142 deletions.
2 changes: 2 additions & 0 deletions core/catalog/catalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

using namespace Ilwis;

const QString Catalog::DEFAULT_WORKSPACE = "ilwis://internalcatalog/workspaces/default";

Catalog::Catalog()
{
}
Expand Down
1 change: 1 addition & 0 deletions core/catalog/catalog.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class KERNELSHARED_EXPORT Catalog : public IlwisObject

IlwisObject *clone();

static const QString DEFAULT_WORKSPACE;

protected:
virtual IIlwisObject createObject(const QVariant& indexValue) const;
Expand Down
2 changes: 1 addition & 1 deletion core/catalog/catalogquery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ bool CatalogQuery::checkForProperty(const std::vector<QString>& resourceBaseName
}

QString CatalogQuery::transformQuery(const QString& baseQuery) const{
if ( baseQuery == "")
if ( baseQuery == "" || baseQuery == sUNDEF)
return "";

QString query = baseQuery.toLower();
Expand Down
7 changes: 6 additions & 1 deletion core/catalog/catalogview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ void CatalogView::removeFixedItem(quint64 id)
_fixedItems.erase(iter);
}

quint32 CatalogView::fixedItemCount() const
{
return _fixedItems.size();
}

QString CatalogView::filter() const
{
return _filter;
Expand Down Expand Up @@ -160,7 +165,7 @@ QString CatalogView::type() const

bool CatalogView::isValid() const
{
return _locations.size() > 0 || _fixedItems.size() > 0; // && _filter != "";
return _locations.size() > 0 || _fixedItems.size() > 0 ;
}

QUrl CatalogView::parentCatalogView() const
Expand Down
1 change: 1 addition & 0 deletions core/catalog/catalogview.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class KERNELSHARED_EXPORT CatalogView : public QObject, public Identity
std::vector<Resource> items() const;
void addFixedItem(quint64 id);
void removeFixedItem(quint64 id);
quint32 fixedItemCount() const;
QString filter() const;
void filter(const QString& filter);
Resource resource() const;
Expand Down
6 changes: 4 additions & 2 deletions core/ilwiscontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ IlwisContext::IlwisContext() : _workingCatalog(0), _memoryLimit(9e8), _memoryLef
{
//TODO relocate directories through configuration
QDir localDir(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
QStringList files = localDir.entryList(QStringList() << "*.*", QDir::Files);
_cacheLocation = QUrl::fromLocalFile(localDir.absolutePath());
QString datalocation = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/internalcatalog";
localDir = QDir(datalocation);
if (!localDir.exists()){
localDir.mkpath(datalocation);
}
_persistentInternalCatalog = QUrl::fromLocalFile(datalocation);
QStringList files = localDir.entryList(QStringList() << "*.*", QDir::Files);
files << localDir.entryList(QStringList() << "*.*", QDir::Files);
foreach(QString file, files)
localDir.remove(file);
_workingCatalog = new Catalog(); // empty catalog>
Expand Down Expand Up @@ -124,7 +125,8 @@ const ICatalog &IlwisContext::systemCatalog() const

void IlwisContext::setWorkingCatalog(const ICatalog &cat)
{
if ( !cat.isValid())
// the ilwis default workspace is just is a placeholder for everything goes; so we don't assign it
if ( !cat.isValid() || cat->source().url().toString() == Catalog::DEFAULT_WORKSPACE)
return;

mastercatalog()->addContainer(cat->source().url());
Expand Down
6 changes: 6 additions & 0 deletions core/publicdatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ void PublicDatabase::prepare() {
stmt = "create table aliasses (alias TEXT, code TEXT, type TEXT, source TEXT)";
sql.exec(stmt);

stmt = "create table workspaces (workspaceid INTEGER, description TEXT)";
sql.exec(stmt);

stmt = "create table workspace (workspaceid INTEGER, itemid INTEGER)";
sql.exec(stmt);

stmt = "create table datum \
(\
code TEXT,\
Expand Down
1 change: 1 addition & 0 deletions desktopclient/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ int main(int argc, char *argv[])

mastercatalogmodel.connect(&operations, &OperationCatalogModel::updateCatalog,&mastercatalogmodel, &MasterCatalogModel::updateCatalog );
mastercatalogmodel.connect(&workflows, &WorkflowCatalogModel::updateCatalog,&mastercatalogmodel, &MasterCatalogModel::updateCatalog );
operations.connect(uicontext().get(),&UIContextModel::currentWorkSpaceChanged, &operations, &OperationCatalogModel::workSpaceChanged);
messageHandler.connect(kernel()->issues().data(), &IssueLogger::updateIssues,&messageHandler, &UserMessageHandler::addMessage );


Expand Down
23 changes: 14 additions & 9 deletions desktopclient/qml/DesktopClient.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import "datapanel" as DataPanel
import "controls" as Control
import MessageModel 1.0
import ResourceModel 1.0
import MasterCatalogModel 1.0
import "Global.js" as Global

ApplicationWindow {
Expand Down Expand Up @@ -111,19 +112,23 @@ ApplicationWindow {
text : qsTr("Current Workspace")
anchors.verticalCenter: parent.verticalCenter
}
TextField{
ComboBox{
width : 150
text : "default"
readOnly: true
height : 25
style: TextFieldStyle {
textColor: "black"
background: Rectangle {
anchors.fill: parent
color: Global.alternatecolor3
objectName: "workspace_combobox_mainui"
model : mastercatalog.workspaces
textRole: "displayName"
anchors.verticalCenter: parent.verticalCenter
onCurrentIndexChanged: {
if ( currentIndex >= 0){
var wmodel =model[currentIndex]
console.debug(wmodel.name)
if ( wmodel){
dataPanel.changeCatalog(wmodel.url)
uicontext.currentWorkSpace = wmodel
}
}
}
anchors.verticalCenter: parent.verticalCenter

}
anchors.verticalCenter: parent.verticalCenter
Expand Down
42 changes: 0 additions & 42 deletions desktopclient/qml/workbench/OperationList.qml
Original file line number Diff line number Diff line change
Expand Up @@ -59,48 +59,6 @@ Rectangle {
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.ArrowCursor
// property variant operationNameDrag
// drag.target: operationNameDrag

// onPressed: {

// operationNameDrag = Qt.createQmlObject('import QtQuick 2.0; Text {
// id : operationNameDrag
// text : displayName
// width : operationName.width
// height : operationName.height
// x : operationName.x
// y : operationName.y
// font.pointSize: 12
// property string name : displayName !== null ? displayName : ""
// property string ilwisobjectid : id !== null ? id : ""
// property string type : "operation"

// Drag.keys: [ id ]
// Drag.active: mouseArea.drag.active
// Drag.hotSpot.x: x + width/2
// Drag.hotSpot.y: y + height/2
// opacity : Drag.active / 2

// states: State {
// when: mouseArea.drag.active
// ParentChange { target: operationNameDrag; parent: root }
// AnchorChanges { target: operationNameDrag; anchors.verticalCenter: undefined; anchors.horizontalCenter: undefined }
// }
// }', mouseArea, "dynamicName");

// }

// onReleased: {
// operationNameDrag.Drag.drop()
// operationNameDrag.parent = mouseArea
// operationNameDrag.anchors.fill = mouseArea
// operationNameDrag.destroy();
// // open formular
// applicationForm.state = operationsList.currentIndex == index && applicationForm.state != "minimized" ? "minimized" : "maximized"
// operationsList.currentIndex = index;
// makeForm(id, displayName, url)
// }

onClicked: {
applicationForm.state = operationsList.currentIndex == index && applicationForm.state != "minimized" ? "minimized" : "maximized"
Expand Down
25 changes: 2 additions & 23 deletions desktopclient/qml/workbench/Workspaces.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Item {
opacity : 0

signal unloadcontent(string content)
property WorkSpaceModel workspace : mastercatalog.currentWorkSpace
property WorkSpaceModel workspace : uicontext.currentWorkSpace

FunctionBarHeader{
id : functionBarHeader
Expand All @@ -40,27 +40,6 @@ Item {
anchors.top: creation.bottom
}
}
Action {
id :addbookmark
onTriggered: {
if ( workspace)
mastercatalog.addBookmark(workspace.url)
}
}

Controls.ActionButton{
id : addBookmarkButton
anchors.right : parent.right
anchors.bottom: parent.bottom
anchors.rightMargin: 5
anchors.bottomMargin: 10
buttontext : "Add\nBookmark"
iconsource : "../images/addbookmarkCS1.png"
height : 40
width :95
action : addbookmark
z : 1
}

states: [
State { name: "visible"
Expand Down Expand Up @@ -97,7 +76,7 @@ Item {
Component.onCompleted: {
state : "visible"
opacity : 1
workspaceinfo.state = workspace ? "fullsize" : "zerosize"
workspaceinfo.state = workspace && !workspace.isDefault ? "fullsize" : "zerosize"
}
}

2 changes: 2 additions & 0 deletions desktopclient/qml/workbench/workspace/WorkSpaceCreation.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ Row {
onCurrentIndexChanged: {
if ( names.model && currentIndex >= 0 && currentIndex < names.model.length)
workspace = names.model[currentIndex]
if ( currentIndex > 0) // we dont do anything on 0 as that is default workspace
workspaceinfo.state = "fullsize"
}

}
Expand Down
15 changes: 15 additions & 0 deletions ilwiscoreui/models/catalogmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ CatalogModel::CatalogModel(QObject *parent) : ResourceModel(Resource(), parent)
_level = 0;
}

CatalogModel::CatalogModel(const Resource &res, QObject *parent) : ResourceModel(res,parent)
{
_initNode = true;
_isScanned = false;
_level = 0;
if ( res.url().toString() == Catalog::DEFAULT_WORKSPACE){
_view = CatalogView(context()->workingCatalog()->source());
_view.addLocation(_view.resource().url());
_view.name("default");
setDisplayName("default");
}else
_view = CatalogView(res);
_displayName = _view.name();
}

void CatalogModel::setView(const CatalogView &view){
_view = view;
resource(view.resource());
Expand Down
1 change: 1 addition & 0 deletions ilwiscoreui/models/catalogmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class ILWISCOREUISHARED_EXPORT CatalogModel : public ResourceModel

~CatalogModel();
explicit CatalogModel(QObject *parent = 0);
CatalogModel(const Ilwis::Resource& res, QObject *parent);
bool isScanned() const;
bool initNode() const;
int level() const;
Expand Down
Loading

0 comments on commit 2c25590

Please sign in to comment.