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

System Tray icon #765

Closed
DanielBorgesOliveira opened this issue Jan 4, 2020 · 17 comments
Closed

System Tray icon #765

DanielBorgesOliveira opened this issue Jan 4, 2020 · 17 comments
Assignees
Labels
External Enhancement External Enhancement

Comments

@DanielBorgesOliveira
Copy link

Firstly I would like to thank you for your Job.

I developed a system tray program to show the sync progress of your onedrive client. I would like to share it with everyone interested in this. Any help would be apreciated too.

The code is availabe in https://github.com/DanielBorgesOliveira/onedrive_tray.

Thank you.

@abraunegg
Copy link
Owner

@DanielBorgesOliveira
Thanks for contributing

@abraunegg abraunegg added the External Enhancement External Enhancement label Jan 4, 2020
@norbusan
Copy link
Collaborator

norbusan commented Jan 5, 2020

GREAT!! Thanks a lot @DanielBorgesOliveira I will try it out immediately.

@norbusan
Copy link
Collaborator

norbusan commented Jan 5, 2020

@DanielBorgesOliveira hmm, unfortunately I doesn't run on Linux with qt 5.12. I get a segfault immediately at startup:

(gdb) bt
#0  0x00007ffff7a952f1 in QWidget::setAttribute(Qt::WidgetAttribute, bool) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#1  0x00007ffff7a7992b in QBoxLayout::insertWidget(int, QWidget*, int, QFlags<Qt::AlignmentFlag>) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#2  0x0000555555559bae in Window::createMessageGroupBox() ()
#3  0x000055555555a92f in Window::Window() ()
#4  0x0000555555558b10 in main ()

Any ideas?

@DanielBorgesOliveira
Copy link
Author

DanielBorgesOliveira commented Jan 6, 2020

Hi @norbusan,

I do not know why you are getting this error but I built it successfully with qt 5.12.6.
Try to download and install the qt binary available in https://www.qt.io/download-open-source.

Maybe there is a problem with the qt lib provided by your distribution.

@coxackie
Copy link

coxackie commented Jan 7, 2020

This is very promising... could it be eventually integrated? Also, any hope it could also be made into a GNOME shell extension (Javascript)?

@abraunegg
Copy link
Owner

@coxackie
PR and development help is always welcome

@DanielBorgesOliveira
Copy link
Author

Hi @coxackie it would be great to integrate the project and evolve it to a gnome shell extension.

@norbusan
Copy link
Collaborator

norbusan commented Jan 9, 2020

@DanielBorgesOliveira I am quite sure that my distribution correctly packages Qt, it is Debian ;-) So that is for sure not the problem. I will look into it again.

@norbusan
Copy link
Collaborator

norbusan commented Jan 9, 2020

@coxackie a JavaScript version for Gnome/Cinnamon would be nice indeed, but is a completely different beast. Of course one can read the C code and translate it into JavaScript manually, but there is nothing automatically here.

And the applet would be shown in the notification area of Gnome anyway, so no need for a separate javascript version.

@coxackie
Copy link

coxackie commented Jan 9, 2020

@ norbusan I understand that it would take effort and time, which may nit be available. The reasons I mentioned it is that:
(1) GNOME does not support system tray by default, and extensions to do so are rather flaky;
(2) it would avoid having to pull Qt and work directly with GTK through the shell; and
(3) the extra memory footprint would be almost zero, keeping everything lightweight as it is.

But, as I said, i understand that this is out of scope.

@norbusan
Copy link
Collaborator

@DanielBorgesOliveira I debug the program, and there is something fishy: In window.cpp you do

QHBoxLayout *iconLayout = new QHBoxLayout;
iconLayout->addWidget(iconLabel);
...

but iconLabel is nowhere initialized.In fact,the iconComboBox in the next line similar, and then showIconCheck, too.

Commenting these lines:

--- a/window.cpp
+++ b/window.cpp
@@ -222,10 +222,10 @@ void Window::createMessageGroupBox()
     showIconCheckBox->setChecked(true);
 
     QHBoxLayout *iconLayout = new QHBoxLayout;
-    iconLayout->addWidget(iconLabel);
-    iconLayout->addWidget(iconComboBox);
-    iconLayout->addStretch();
-    iconLayout->addWidget(showIconCheckBox);
+    // iconLayout->addWidget(iconLabel);^M
+    //iconLayout->addWidget(iconComboBox);^M
+    // iconLayout->addStretch();^M
+    // iconLayout->addWidget(showIconCheckBox);^M
     // ********** Create the baloon warning in the tray ********** //
 }
 
@@ -251,10 +251,10 @@ void Window::createConfigurationGroupBox()
     showIconCheckBox->setChecked(true);
 
     QHBoxLayout *iconLayout = new QHBoxLayout;
-    iconLayout->addWidget(iconLabel);
-    iconLayout->addWidget(iconComboBox);
-    iconLayout->addStretch();
-    iconLayout->addWidget(showIconCheckBox);
+    // iconLayout->addWidget(iconLabel);^M
+    // iconLayout->addWidget(iconComboBox);^M
+    // iconLayout->addStretch();^M
+    // iconLayout->addWidget(showIconCheckBox);^M
     // ********** Create the baloon warning in the tray ********** //
 }

Fixes the segmentation fault.

My guess is that you are compiling without hardening options or some other compiler, but this looks very fishy.

But I have to say, I never program Qt

@DanielBorgesOliveira
Copy link
Author

Hi @norbusan

This part of the code was part of my effort to add a configuration window.
I have just updated the code with this window but not yet implement the save button responsible to save the configuration.

Please, try the last version of the code and tell if there is something wrong.

Thank you very much.

@norbusan
Copy link
Collaborator

Hi @DanielBorgesOliveira
I checked the code you pushed, and it works fine, but there is still one error in window_1.cpp you do

messageLayout->addWidget(typeLabel, 0, 0);

but the typeLabel is still commented, so that makes the program crash again. Commenting this line makes it compile and run.

@norbusan
Copy link
Collaborator

@DanielBorgesOliveira later on I send a PR adding command line handling for onedrive path and arguments

@DanielBorgesOliveira
Copy link
Author

@norbusan you are right. I forgot to comment the line 106 of window_1.cpp.
I just accepted the PR. Thank you.

@abraunegg
Copy link
Owner

Closing this issue tracker as this external enhancement is now referenced in the wiki: https://github.com/abraunegg/onedrive/wiki/External-Enhancements-to-the-OneDrive-Linux-Client

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
External Enhancement External Enhancement
Projects
None yet
Development

No branches or pull requests

4 participants