Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit fc64d86

Browse files
authored
Merge branch 'master' into 0.7.0-test
2 parents 94f31b2 + 08f2912 commit fc64d86

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+732
-136
lines changed

new sync methods.txt

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
tables by project
2+
3+
-> fullsync : all tables only if project column is ""
4+
5+
RamApplication
6+
RamFileType
7+
RamProject
8+
RamState
9+
RamTemplateAssetGroup
10+
RamTemplateStep
11+
RamUser
12+
13+
-> projectSync : all tables but with project filter using project column
14+
15+
-> in UI "full sync" = fullsync + current project sync
16+
17+
-> quicksync : doesn't change
18+
19+
20+
/ok/ LOCAL data update methods
21+
/ok/ Server update
22+
/ok/ ldi: setProject
23+
/ok/ ldi: getProject
24+
/ok/ ldi: create with project
25+
/ok/ ldi: project filters on getters
26+
/ok/ Reimplement RamObject to set the project column (creation, update data)
27+
/ok/ on RamObjects storing project, remove project from data and use the column
28+
/ok/ Add project data to sync (server)
29+
/ok/ Add project data to sync (client)
30+
/ok/ Reimplement fullSync
31+
/ok/ Implement projectSync
32+
/ok/ RamServerInterface::downloadData only general tables
33+
/ok/ Server refuses sync in case of wrong app version
34+
/ok/ Pull missing uuids from server
35+
36+
37+
38+
// Schedule removals not updated in ui on sync but on reboot
39+
// Delay loading objects in Models
40+
> Instead of loading objects, add nullptrs to the list, and replace by the obj when first called
41+
> all checks of the objs must be done with the data
42+
// RamAbstractObject data integrity checks (a function called on construct, ovrriden by children) calls invalidate() if data is not right
43+
> Calls and LDI data integrity check
44+
// Full sync should always be synchronous to be sure everything is better
45+
// Refactor localdatainterface to create a new LocalDataManager class with static methods for queries on a specific db
46+
// Implement Sync by table (for fullSync and projectSync):
47+
> table one by one, cache incoming data until we've got all tables (both on server side & client side)
48+
> server::startSyncSession
49+
> client: send tables one by one
50+
> server::sync
51+
> client: when all sent tables are retrieved or if timeout*numTables
52+
> server::endSyncSession
53+
// Implement pagination, don't send/return more than 100 rows per table
54+
55+
56+
57+
58+
59+
60+
1- Download only the general data
61+
2- Pull objects only when needed (and delay in ramobjectmodel)
62+
3- sync :
63+
- general data, all, send new, modified, receive new, modified
64+
- project data, send new and modified, get modified. Pull new when needed (all objects are in the lists)

src/duqf-app/app-config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#define CACHE_RAMOBJECT_DATA true
77
#define CACHE_LOCAL_DATA true
88

9+
//#define DEBUG_ALL_INCOMING_DATA
10+
911
//#define FORCE_WELCOME_SCREEN
1012

1113
#endif // APPCONFIG_H

src/mainwindow.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,8 @@ void MainWindow::connectEvents()
349349
connect(ui_projectSettingsPage, SIGNAL(closeRequested()), this, SLOT(home()));
350350

351351
// Other buttons
352-
connect(actionSync, SIGNAL(triggered()), DBInterface::instance(),SLOT(sync()));
353-
connect(actionFullSync, SIGNAL(triggered()), DBInterface::instance(),SLOT(fullSync()));
352+
connect(actionSync, SIGNAL(triggered()), DBInterface::instance(),SLOT(quickSync()));
353+
connect(actionFullSync, SIGNAL(triggered()), this,SLOT(fullSync()));
354354
connect(mainStack,SIGNAL(currentChanged(int)), this, SLOT(pageChanged(int)));
355355

356356
// Misc
@@ -790,8 +790,13 @@ void MainWindow::setOnlineAction()
790790
{
791791
DBInterface::instance()->setOnline();
792792

793-
// Trigger a full sync
794-
if (RamServerInterface::instance()->isOnline()) DBInterface::instance()->fullSync();
793+
// Trigger a general sync
794+
if (RamServerInterface::instance()->isOnline())
795+
{
796+
DBInterface::instance()->generalSync();
797+
RamProject *proj = Ramses::instance()->currentProject();
798+
if (proj) DBInterface::instance()->projectSync(proj->uuid());
799+
}
795800
}
796801

797802
void MainWindow::databaseSettingsAction()
@@ -1056,6 +1061,7 @@ void MainWindow::startSync()
10561061
{
10571062
ui_refreshButton->hide();
10581063
mainStatusBar->showMessage(tr("Syncing..."));
1064+
10591065
}
10601066

10611067
bool MainWindow::eventFilter(QObject *obj, QEvent *event)

src/mainwindow.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ private slots:
144144
void finishSync();
145145
void startSync();
146146

147+
147148
protected:
148149
void closeEvent(QCloseEvent *event) override;
149150
void keyPressEvent(QKeyEvent *key) override;

src/pages/loginpage.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ void LoginPage::loginButton_clicked()
111111
}
112112
settings.endArray();
113113

114-
// Trigger a full sync
115-
if (RamServerInterface::instance()->isOnline()) DBInterface::instance()->fullSync();
114+
// Trigger a general sync
115+
if (RamServerInterface::instance()->isOnline()) DBInterface::instance()->generalSync();
116116
}
117117

118118
void LoginPage::userChanged(RamUser *u)

src/progressmanager.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ void ProgressManager::setTitle(const QString &t)
3434
void ProgressManager::setProgress(const int &p)
3535
{
3636
m_val = p;
37+
qApp->processEvents();
3738
emit progress(p);
3839
}
3940

4041
void ProgressManager::setMaximum(const int &m)
4142
{
43+
qDebug() << "Progress max: " << m;
4244
m_maximum = m;
4345
emit maximum(m);
4446
}

src/progresspage.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "progresspage.h"
22

3+
#include "progressmanager.h"
4+
35
ProgressPage::ProgressPage(QWidget *parent) : QWidget(parent)
46
{
57
setupUi();
@@ -35,7 +37,7 @@ void ProgressPage::setupUi()
3537

3638
l->addStretch();
3739

38-
m_titleLabel = new QLabel("", this);
40+
m_titleLabel = new QLabel("Work in progress...", this);
3941
l->addWidget(m_titleLabel);
4042

4143
m_progressBar = new ProgressBar(this);

src/progresspage.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <QProgressBar>
77
#include <QLabel>
88

9-
#include "progressmanager.h"
109
#include "progressbar.h"
1110

1211
class ProgressPage : public QWidget

src/ramdatainterface/dbinterface.cpp

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#include "dbinterface.h"
2+
#include "duqf-app/app-config.h"
23
#include "duqf-utils/guiutils.h"
34
#include "progressmanager.h"
5+
#include "ramses.h"
6+
#include "datacrypto.h"
47

58
DBInterface *DBInterface::_instance = nullptr;
69

@@ -71,9 +74,9 @@ bool DBInterface::contains(QString uuid, QString table)
7174
return m_ldi->contains(uuid, table);
7275
}
7376

74-
void DBInterface::createObject(QString uuid, QString table, QString data)
77+
void DBInterface::createObject(QString uuid, QString table, QString data, QString projectUuid)
7578
{
76-
m_ldi->createObject(uuid, table, data);
79+
m_ldi->createObject(uuid, table, data, projectUuid);
7780
}
7881

7982
QString DBInterface::objectData(QString uuid, QString table)
@@ -86,6 +89,16 @@ void DBInterface::setObjectData(QString uuid, QString table, QString data)
8689
m_ldi->setObjectData(uuid, table, data);
8790
}
8891

92+
QString DBInterface::project(QString uuid, QString table)
93+
{
94+
return m_ldi->project(uuid, table);
95+
}
96+
97+
void DBInterface::setProject(QString uuid, QString table, QString projectUuid)
98+
{
99+
m_ldi->setProject(uuid, table, projectUuid);
100+
}
101+
89102
void DBInterface::removeObject(QString uuid, QString table)
90103
{
91104
m_ldi->removeObject(uuid, table);
@@ -105,7 +118,7 @@ void DBInterface::setUsername(QString uuid, QString username)
105118
{
106119
m_ldi->setUsername(uuid, username);
107120
// Setting the username must trigger an instant sync (if it's not new)
108-
if (username.toLower() != "new") sync();
121+
if (username.toLower() != "new") quickSync();
109122
}
110123

111124
bool DBInterface::isUserNameAavailable(const QString &userName)
@@ -141,7 +154,8 @@ void DBInterface::setDataFile(const QString &file, bool ignoreUser)
141154

142155
qDebug() << "Selected previous user: " << userUuid;
143156

144-
emit userChanged( userUuid );
157+
// The user will be set AFTER login/setOnline
158+
// emit userChanged( userUuid );
145159
setOnline(serverUuid);
146160

147161
pm->setText(tr("Ready!"));
@@ -283,10 +297,12 @@ void DBInterface::acceptClean()
283297

284298
resumeSync();
285299
// Full sync
286-
fullSync();
300+
generalSync();
301+
RamProject *proj = Ramses::instance()->currentProject();
302+
if (proj) projectSync(proj->uuid());
287303
}
288304

289-
void DBInterface::sync()
305+
void DBInterface::quickSync()
290306
{
291307
if (m_syncSuspended) {
292308
log(tr("Sync is suspended!"), DuQFLog::Warning);

src/ramdatainterface/dbinterface.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,14 @@ class DBInterface : public DuQFLoggerObject
5555
QSet<QString> tableUuids(QString table);
5656
bool contains(QString uuid, QString table);
5757

58-
void createObject(QString uuid, QString table, QString data);
58+
void createObject(QString uuid, QString table, QString data, QString projectUuid = "");
5959

6060
QString objectData(QString uuid, QString table);
6161
void setObjectData(QString uuid, QString table, QString data);
6262

63+
QString project(QString uuid, QString table);
64+
void setProject(QString uuid, QString table, QString projectUuid);
65+
6366
void removeObject(QString uuid, QString table);
6467
void restoreObject(QString uuid, QString table);
6568
bool isRemoved(QString uuid, QString table);

0 commit comments

Comments
 (0)