Enable a notification system
AbandonedPublic

Authored by laysrodrigues on Apr 22 2018, 6:20 PM.

Details

Summary

Using KNotifications and NotifyConfig we can push to the
user notifications that we think that is relevant to the
use of this printer host.
Also enabled the user to config the user of the notifications
on the Settings Menu, so he/she can activate/deactivate and
customize the notifications.

Signed-off-by: Lays Rodrigues <laysrodriguessilva@gmail.com>

Diff Detail

Repository
R231 Atelier
Branch
notification
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 5134
Build 5152: arc lint + arc unit
There are a very large number of changes, so older changes are hidden. Show Older Changes

Update notifyrc file

rizzitello requested changes to this revision.Aug 15 2018, 10:06 AM

Does not work when installed Or when not installed. the notification.rc file doesn't seam to be installed.

This revision now requires changes to proceed.Aug 15 2018, 10:06 AM

after manually installing the rc file the config area looks like this..

Add info the notifyrc file, because
I though that the lack of info there
wouldnt be a problem.
-> The configuration will only work with the installed
file. We dont have any way to use it as a qrc, as I said
before. Waiting to the guy from KNotification get back to me.

Add info the notifyrc file, because
I though that the lack of info there
wouldnt be a problem.
-> The configuration will only work with the installed
file. We dont have any way to use it as a qrc, as I said
before. Waiting to the guy from KNotification get back to me.

you currently can't embed that file. secondly why would you remove the options from the Rc then i can't configure what notification i want and if i can't configure the notifications then im a hard no on this feature.

It was just a silly mistake... (on your second comment)

rizzitello requested changes to this revision.Aug 15 2018, 9:34 PM

i get this warning when i run the program now: Object::connect: No such slot MainWindow::configureNotifications() in /home/chris/Documents/Projects/Code/Kde/atelier/src/mainwindow.cpp:295

Are we installing the rc file or not? if so please put it in the deploy/ folder and note its not currently being installed and because of that the notifications do not work with atelier installed or not. I am not sure if we are waiting to embed the rc file or not.

For mac os i would think you place the rc file inside the bundle for the app or in the case of installing via homebrew where it would be installed the same as other unix using the homebrew path as a prefix..

This revision now requires changes to proceed.Aug 15 2018, 9:34 PM
  • Fixes slot warning
  • Install file notifyrc

-> It works on local installations =D

rizzitello requested changes to this revision.Aug 16 2018, 8:02 PM

I think now we just need to fix up the wording and see if we can do a progress dialog for the print job before landing

deploy/atelier.notifyrc
19

This is the description of the even shown in the configure notification dialog maybe change it to

"The printer reported an error"

src/widgets/atcoreinstancewidget.cpp
402

I think we should do what kde connect does for its notification titles and use the device name something like <Profile Name> (on <device>) for the title. This will let the user quickly scan thru the notification center and see what events happened on what applications (most apps use the program name for the Title)

436

This message is awardly worded

Title : "Atelier"
Message: "A print job has started on <device>"

Why device? because i can use the same profile for several printers and as a result the profile name is not a unique identifier.

Ideally This would be be a popup when printing like this and be persistent like a copy job in dolphin


| Print job on <device> X |

Printing: <filename> <Pause button other contols>
estimated time remaining: <estimated time>
<<<<<<<<<<<<<Progressbar>>>>>>>>>>>>>>>>>

and then when finished it would change to be then fade away after a the normal time out


|Print job on <device> X |

Printed: <filename>
Total Job Time: <Print job time>

This revision now requires changes to proceed.Aug 16 2018, 8:02 PM
rizzitello added inline comments.Aug 16 2018, 8:29 PM
src/widgets/atcoreinstancewidget.cpp
402

After finishing a print job you get a second connected notification. We need to either move this to Connecting: and make it say connecting or find some way to tell if we are comming from a previous state of Connecting and show the dialog only if that is true.

laysrodrigues marked 2 inline comments as done.Aug 16 2018, 9:47 PM

See if this one for connection is good enough

  • Sith suggestions
laysrodrigues added inline comments.Aug 16 2018, 9:51 PM
src/widgets/atcoreinstancewidget.cpp
436

I don't like the idea of a persistent notification if we already have the progress inside the main window. Because a print job can take hours, and the user won't allow a notification on the screen for that long.

I think we should use better titles for the notification because if you look in the notification center they look off with Finshed! or Connected etc when all other notification titles are the name of the application that sent the notification or in the case of kde connect the device where the event happened. ( since we work with multiple devices i think we should use the kde connect title scheme)

I think we should remove the print started one unless we are going to use progress since the only way to start a print job is if the user clicks start in the dialog. The user will have initiated the start of the print and i do not think the notification is helpful if it just says " started a print job". Since as just mentioned the must be clicked to start the job and there is not wait to start the print. I do think no matter what a Printing finished Notification should still be there.

The Print finished dialog should perhaps include the file that was printed if look at how dolphin handles its copy jobs when the job finishes it will say something like finished copying < filename>
i think we should include this in our finished print dialog .

src/widgets/atcoreinstancewidget.cpp
383

I dont like as much when i tried it as the connected notification. Lets try this

add an new private of type AtCore::STATES to atcoreinstancewidget (i called mine m_laststate) then we do this

    case AtCore::IDLE: {
        if(m_laststate == AtCore::CONNECTING) {
            stateString = i18n("Connected to %1", m_core.serial()->portName());
            KNotification::event ...
       }
 .....
    };//end of switch
    m_laststate = newState;
    m_statusWidget->setState(stateString);
}

Then we will only see the dialog if the last state was connecting. This can also help with the error stuff later on too.

416

would you consider this style for the KNotification::event calls ?

KNotification::event("printerDisconnected" // event name
    , i18n("Disconnected")  //Title
    , i18n("Disconnected from %1." //Body 
              , m_comboProfile->currentText() // i18n line substutions
              // if there was a %2 its source would be here                                       
      )// end of the i18n (with vars) 
);// end of notification event.

I find this to be much more readable.

436

The persistent notifications like the file transfers for dolphin stay in the tray or notification area and provide visual progress if the application is minimized. the user can toggle if they are shown by clicking the notification icon in the tray area. Im suggesting we do exactly that . If your unsure about how this will function just copy a large file via dolphin and look at how its progress is handled.

If your using several printers from one instance the notifications will be a useful way to monitor the jobs at the same time. As well as allow the user to keep atelier minimized and just get a quick peek at the progress of any job. I really think we should at very least try this and see how it works for us.

rizzitello requested changes to this revision.Aug 18 2018, 12:07 AM

For the print progress I think we would want to use KJob not a KNotification::event

This revision now requires changes to proceed.Aug 18 2018, 12:07 AM
laysrodrigues marked an inline comment as done.Aug 25 2018, 1:01 PM

Some of sith suggestions

Since the connection notification is bad when
emitted from the Idle state, a successiful connection
and all the notifications related to idle state are
now a idle notification

Use device name instead of profile for start/finish
notifications

src/mainwindow.cpp
309

Is it not possible to use modern signal slots syntax ?

src/widgets/atcoreinstancewidget.cpp
394

The indentation level is wrong.

rizzitello requested changes to this revision.Aug 25 2018, 2:07 PM
rizzitello added inline comments.
src/widgets/atcoreinstancewidget.cpp
393–400
case AtCore::IDLE: {
        if(m_laststate == AtCore::CONNECTING) {
            stateString = i18n("Connected to %1", m_core.serial()->portName());
            KNotification::event ...
       }
 .....
    };//end of switch
    m_laststate = newState;
    m_statusWidget->setState(stateString);
}

This way we don't show the notification every time we hit idle state.

419

Please use device name not profile

This revision now requires changes to proceed.Aug 25 2018, 2:07 PM
laysrodrigues marked 2 inline comments as done.Aug 25 2018, 2:32 PM
laysrodrigues added inline comments.
src/mainwindow.cpp
309

For this one nope. =/

  • Enable a notification system
  • AStyle - Will squash this one later(after review)
rizzitello added a comment.EditedAug 25 2018, 2:52 PM

I think we should do what kde connect does for its notification titles and use the device name something like <Profile Name> (on <device>) for the title. This will let the user quickly scan thru the notification center and see what events happened on what applications (most apps use the program name for the Title) Since we have support for several devices we should show the device info instead

src/widgets/atcoreinstancewidget.cpp
437

This Event should be removed and a KJob event should instead be used . As stated in previous comments i feel that this notification is redundant since the user must click print to start the job there is no delay to start the job and the UI will reflect that the print job started.

rizzitello requested changes to this revision.Aug 25 2018, 2:58 PM
This revision now requires changes to proceed.Aug 25 2018, 2:58 PM
rizzitello requested changes to this revision.Sep 8 2018, 1:57 PM

Please see comments about the titles of the notifications.

This revision now requires changes to proceed.Sep 8 2018, 1:57 PM
tcanabrava accepted this revision.Sep 8 2018, 6:07 PM
tcanabrava added inline comments.
src/widgets/atcoreinstancewidget.cpp
437

I don't know the differences from this to a KJob, chris, can you explain a bit?

rizzitello added inline comments.Sep 8 2018, 8:07 PM
src/widgets/atcoreinstancewidget.cpp
437

A Kio::job appears to be the type of popup that dolphin uses for the file transfers.
The perfect print pop up (for me) would have the following:

  • file being printed
  • the device thats printing
  • elapsed time / remaining time
  • A progress bar
  • An abort and pause / resume button.
patrickelectric accepted this revision.Sep 9 2018, 1:00 AM
laysrodrigues added inline comments.Nov 19 2018, 1:29 PM
src/widgets/atcoreinstancewidget.cpp
437

Idk about that on other platforms than Linux, and that is not related to a notification system, that is about monitoring.

rizzitello requested changes to this revision.Nov 19 2018, 2:02 PM

Please use "Atelier" for the titles of the the notifications. Please see how other applications in kde word their titles.

src/widgets/atcoreinstancewidget.cpp
437

I can not see how this is useful to any users as just a notification that the job started because the user has to click print to start the job and they must have the Application (as well as the specific atcore instance) in Focus and they will see on the GUI the job has started. As I have said before i do not feel this is helpful with out it being a KIO job.

This revision now requires changes to proceed.Nov 19 2018, 2:02 PM

About the titles:

Kdevelop sample:
[Event/ProcessSuccess]
Name=Process successful
[Event/ProcessError]
Name=Process error

Kde connect:
[Event/pairingRequest]
Name=Pairing Request
[Event/callReceived]
Name=Incoming Call

So the apps don't use the name of the application on the event name. So I don't see why I should change that for Atelier.

src/widgets/atcoreinstancewidget.cpp
396

Since this only happens when first connected I think the message should be

"Connected to printer" Instead of "Printer is Idle"

397

be sure to indent for the for these continued lines of i18n (here and elsewhere)

, i18n("%1 ...%2"
   , %1 replacement
   , %2 replacement
 )//Closing the i18n call.
417

When we connect we only have a title I think disconnect should also have no body since its one line of needed info. If not then we should add a title to the connect one to be consistent.

437

Printing Started.

451

Printing Finished.

465

We should consider a notification here since using command injection can pause the machine without user interaction.

laysrodrigues abandoned this revision.Jul 9 2019, 1:34 AM