Skip to content
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

Split sharedialog code #3773

Merged
merged 10 commits into from
Oct 21, 2015
Merged

Split sharedialog code #3773

merged 10 commits into from
Oct 21, 2015

Conversation

rullzer
Copy link
Contributor

@rullzer rullzer commented Sep 7, 2015

In preparation of the full desktop sharing (#3737) the sharedialog code had to be somewhat unentangled.

There now is more code in libsync and the gui is cleaned up a bit.

  • OCSJob class added. To allow a nice abstraction also for the new sharee endpoint code (which is required)
  • OcsShareJob class is now in libsync and has more generic functions like createShare, setPassword etc. So the GUI part can just say do this.
  • ShareDialog is cleaned up

My tests show that everything still works as expected but please run your own tests to make sure I did not break anything!

CC: @dragotin @guruz @ogoffart and others that want to test!

/**
* Set the password of a share
*
* @param password The apssword of the share, if the password is empty the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/apssword/password

@ogoffart
Copy link
Contributor

ogoffart commented Sep 8, 2015

Ideally, my long term goal would be that libsync would be for the sync engine.
Adding these jobs there goes against my goal.

@rullzer
Copy link
Contributor Author

rullzer commented Sep 8, 2015

@ogoffart ah mm, then we could also move the jobs to the gui for now...
but also they are not really gui... yet is not ideal...

I'll move them to the gui for now.

@guruz
Copy link
Contributor

guruz commented Sep 8, 2015

Not sure I agree with @ogoffart .. sharing will be more prominent in future.. hm

@dragotin
Copy link
Contributor

dragotin commented Sep 8, 2015

Not agreeing with @ogoffart is hardly an option.

@rullzer
Copy link
Contributor Author

rullzer commented Oct 4, 2015

So finally my qt5 setup is running :)
All the files are now back in gui. But we might want to move to an libocs or libshare in the not to distant future. But I need somebody with some cmake-fu for that.

Please tests and review :)

explicit OcsShareJob(AccountPtr account, QObject *parent = 0);

/**
* Constructors for exisiting shares of which we know the shareId
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/exisitng/existing/

@rullzer
Copy link
Contributor Author

rullzer commented Oct 5, 2015

@phil-davis thanks. Fixed

@guruz
Copy link
Contributor

guruz commented Oct 14, 2015

I'm not working on oC these days, maybe @danimo @dragotin can have a look.

@ckamm ckamm self-assigned this Oct 14, 2015
QList<QPair<QString, QString> > getParams;
getParams.append(qMakePair(QString::fromLatin1("path"), path));
setGetParams(getParams);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think an API that provides a method addParam( QPair()) instead of the setGetParams(QList()) would be nicer because it would save to set up the List and all the pairing here. Could we also use just an addParam() rather than addGetParam() and addPostParam()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I like that. let me take care of that.

@dragotin
Copy link
Contributor

Apart from my comment above (which is kind of minor but maybe still nice to have) I like this very much 👍

As usual my question: Do we see any chance to (unit-) test our job implementations, especially with a focus on error handling that we do? Any idea?

@ckamm
Copy link
Contributor

ckamm commented Oct 14, 2015

@rullzer Feel free to defer my comment about splitting this into several classes and result parsing to later. I think this is already way nicer right now! :)

There is now a generic OCSJob which must be inherited by other jobs. This is in
prepartion for the other OCS job that will come (for the Sharee API endpoint
for example).

More logic is moved from the sharedialog to the OcsShareJob. So in the GUI code
we now only say what we want (a new share, set the password etc). And the code
in libsync will make that happen. Error handling is for now still done in the
GUI part.

For now the ocsjob and ocssharejob live in gui but probabaly we should
create a libshare or libocs at some point.
* Comments
* Use the path of the abstractnetworkjob
@rullzer
Copy link
Contributor Author

rullzer commented Oct 16, 2015

Fixes are on their way. Basically what I noticed is that yet another layer of abstraction would be nice. So that we have share objects.

Then the gui interacts with a share object (sets password etc). The object in the background then makes sure that the proper jobs are fired etc. That should make the gui code even cleaner and allow us to have really proper separation between the logic and the gui. But also that is future work.

* Pass the share_id to the functions that need it
@rullzer
Copy link
Contributor Author

rullzer commented Oct 16, 2015

Ok pushed. Lots of commits (but squashing will come later).
Code is a lot cleaner now. But we still have room for improvement.

@ckamm I addressed most of your comments I think. Thanks.

@ckamm @dragotin Could you have another look before I start squashing commits and merge it.

* @ingroup gui
*
* Base class for jobs that talk to the OCS endpoints on the server.
* All the comminication logic is handled in this class.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/comminication/communication/
I will just add low-value comments by finding the comment typos, and along the way maybe some day be able to learn how this beast all fits together and then contribute something actually useful :)

@ckamm
Copy link
Contributor

ckamm commented Oct 16, 2015

@rullzer The fixes so far look good. Unfortunately I won't have time for another full review next week.

@rullzer
Copy link
Contributor Author

rullzer commented Oct 16, 2015

Thanks @ckamm @phil-davis

CREATE = 4,
DELETE = 8,
SHARE = 16,
ALL = 31
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not READ | UPDATE | ... ?

rullzer added a commit that referenced this pull request Oct 21, 2015
@rullzer rullzer merged commit ec351e0 into master Oct 21, 2015
@rullzer rullzer deleted the split_sharedialog branch October 21, 2015 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants