Improve first-time user experience#1016
Conversation
It didn't before because default_host profile directory was getting created on the disk before the check.
qrand() doesn't seem to be all that random though.
Setting height to the minimum was adding unneeded scrollbars
We never seeded it at the start... explains why we had so many similar nicknames in IRC
50ms seems to be enough for the async X11 to render the window normally even under full system load.
It also was confusing with Host::connectToServer doing the actual connecting
The connection dialog now opens automatically.
Mudlet is now centered and has a decent size for the most common resolutions
It was pretty ancient and referenced outdated button names. Also cut down on the wording so a new user isn't hit with a wall of text.
User-selected desktop fonts and sizes should be used instead.
There was a bug where it would ignore predefined profiles in the calculation. Also use the last modified, not read date - a lot of things like virus scanners could read the directory whereas far fewer things will write to it.
Will send it in as a separate PR instead, its out of scope here
| auto pItem = new QListWidgetItem( mProfileList.at(i) ); | ||
|
|
||
| // mProfileList is derived from a filesystem directory, but MacOS is not | ||
| // mProfileList is derived from a filesystem directory, but MacOS is not |
src/main.cpp
Outdated
|
|
||
| if (first_launch) { | ||
| // give Mudlet window decent size - most of the screen on non-HiDPI displays | ||
| mudlet::self()->resize(1500, 800); |
There was a problem hiding this comment.
That is unreasonably large for punters with only a single 1024x768 screen - not sure if it will be constrained to the actual dimensions but if not it could put the title bar or other bits off screen - which is decidedly user-hostile for a first run IMNSHO! 😒
Why not establish the geometry of the space on the (primary) screen and work to most of that with:
QSize initialSpace = qApp->desktop()->availableGeometry( primaryScreen() );
mudlet::self()->resize( initialSpace.width() * 3 / 4, initialSpace.height() * 3 / 4 );
mudlet::self()->move( initialSpace.width() / 8, initialSpace.height() / 8 );
There was a problem hiding this comment.
Sure - improved. Thanks! :)
src/main.cpp
Outdated
| mudlet::self()->resize(1500, 800); | ||
|
|
||
| auto mudletFrame = mudlet::self()->frameGeometry(); | ||
| auto desktopFrame = qApp->desktop()->size(); |
There was a problem hiding this comment.
QDesktopWidget - particularly the section in the Qt Documentation entitled "Use of the Primary Screen"...! Otherwise the display will be centered on the join between two monitors in an identical twin arrangement, which just smacks of mono-displayism
Consider centering on the screen identified as the primary screen for the application - like wot I suggested in comment above here 😀
There was a problem hiding this comment.
Done. I've went with the current screen in use instead.
| timerAutologin->start( 1000 ); | ||
|
|
||
| connect(mpMainStatusBar, SIGNAL(messageChanged(QString)), this, SLOT(slot_statusBarMessageChanged(QString))); | ||
| // Do something with the QStatusBar just so we "use" it (for 15 seconds)... |
There was a problem hiding this comment.
Why are you removing this? I had this cunning plan so that it was arranged for it to go away after this start-up message if the user does not want it - I suppose that the revision in this PR to auto-start a session makes the "Click on the ..." a bit moot on the first run but why not change the messages on THAT occasion to say what is happening or even just display the text currently in braces...
There was a problem hiding this comment.
I think we have to explicitly use/show the status bar once - otherwise subsequent usages of QAction::setStatusTip(...) does not work if the user does want the status bar - either permanently or as required.
🕧 Let me experiment and confirm (or deny) that...
There was a problem hiding this comment.
statusTips that we do use - if they are wanted later - will revert but revise text in a suitable manner...
src/mudlet.cpp
Outdated
| } | ||
|
|
||
| void mudlet::connectToServer() | ||
| void mudlet::openConnectionDialog() |
There was a problem hiding this comment.
This is a sensible change - is it a slot_ BTW?
Also, whilst renaming things, how about fixing the smelling mistake for the (void) mudlet::slot_connection_dlg_finnished( const QString& profile, int historyVersion ) with the useless second argument as well...? 😀
There was a problem hiding this comment.
It's not a slot. Sure, in another PR, why blow the scope of this one up...
There was a problem hiding this comment.
I was wrong, it is a slot - renamed it as such.
| <file>icons/dialog-error.png</file> | ||
| <file>icons/dialog-information.png</file> | ||
| <file>icons/dialog-ok-apply.png</file> | ||
| <file>icons/dialog-ok-apply_small.png</file> |
There was a problem hiding this comment.
Interesting to note that this is still the alpha version of the file - I'd have thought we'd have eventually renamed it to be just mudlet.qrc at some time in the past... 🤣
| <html><head><meta name="qrichtext" content="1" /><style type="text/css"> | ||
| p, li { white-space: pre-wrap; } | ||
| </style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> | ||
| </style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> |
There was a problem hiding this comment.
I thought I saw you write somewhere in this PR that you wanted to remove a specific font setting - unfortunately the Qt Designer plugin won't play ball with that - it seems to assume the default of the last editor of the file. *sigh*
| <property name="topMargin"> | ||
| <number>9</number> | ||
| </property> | ||
| <item row="0" column="0"> |
There was a problem hiding this comment.
Same issue as before with the Qt Designer plug-in - it reorders QGridLayout items as they are touched and makes the changes harder to trace - give me a day or less and I can try to untangle them if that helps...
|
|
||
| for (auto host : hostList) { | ||
| QString val = readProfileData(host, QStringLiteral("autologin")); | ||
| if (val.toInt() == Qt::Checked) { |
There was a problem hiding this comment.
Hang on - if that item is not present (has not ever been set) then I think we get back a null QString() for val. Using a toInt() on that will fail and return 0 which just happens to be the same as the Qt::Unchecked enum {Qt::Checked is 2 currently in comparison} - that being the case, should we not be a little more rigorous and use:
if ((! val.isEmpty()) && val.toInt() == Qt::Checked) {
?
There was a problem hiding this comment.
I don't see the point - if the value is not set, it defaults to unchecked. How will adding more rigour help?
There was a problem hiding this comment.
If the value has not ever been set, val will be empty - so val.toInt(bool * isOk) will fail (The boolean isOk points at, if non-null, would be set to false instead of true) and it just so happens that the enum QtCheckState has the value of 0for Qt::Unchecked but technically (bloody unlikely, I know 🙄 ) Qt could change the enumerated values in the future and then 0 might be the Qt::Checked value instead - and then every profile would get fired up...!
I wonder if Coverity would pick up on this?
The reason I'm going on about it is that I vaguely recall having an issue with, a qsort lessThan functor which was doing a comparison on two strings that both might be numbers - the behaviour if both of them were strings was broken because if they were not numbers the QString::toInt() was quietly returning a zero for both of them which WERE being treated as numbers when a string comparison should have been done instead... and that bug was caused by failing to account for toInt() not succeeding either!
tl;dr; Basically I am not sure it is wise to depend on the consistency of numeric values of enums which have values expressed as named constants when the allocation of values to elements of the enum is not within our perview...
| bool openedProfile = false; | ||
|
|
||
| for (auto host : hostList) { | ||
| QString val = readProfileData(host, QStringLiteral("autologin")); |
There was a problem hiding this comment.
This is one of those cases where I think we can/should use the QLatin1String("autologin") instead - as there will be at one more instance of this, once we check all the strings!
📖 You have reminded us that the QStringLiteral(...) form - though more convenient when a string might be translated after all and thus switch to a tr(...) construct and also supporting positional place-holder (%1 to %99) replacements {whereas the QLatin1String(...) form does not} the QLatin1String usage does allow shared usage of the compiled constants whereas the QStringLiteral being storable in a read-only data segment does not...
There was a problem hiding this comment.
But that function is not overloaded to take a QLatin1String. See http://doc.qt.io/qt-5/qlatin1string.html#details
Note: If the function you're calling with a QLatin1String argument isn't actually overloaded to take QLatin1String, the implicit conversion to QString will trigger a memory allocation, which is usually what you want to avoid by using QLatin1String in the first place. In those cases, using QStringLiteral may be the better option.
|
One thing about selected a random predefined MUD - Avalon is the German Avalon.de mud Is it one that @HeikoKoehn put in? What about if, potentially, we add other language using MUDs to the mix (e.g. the Spanish Realms of Legends as a reward for their help and code 😀 for inspiration even if we do not exactly reproduce the latter ourselves) - dumping the user into a MUD that uses a language they do not understand - like English for non-English users - is not particularly user friendly IMHO...! |
|
Also - the action taken to show the "Welcome to Mudlet" widget hides the other widget that gives the blurb about some MUDs which is a bit pointless if that text is supposed to encourage that MUD to be selected to (copy and) try out! {I suppose I must confuse my WoTMUD bias here as I wrote THAT blurb and I do want to encourage players for it... 😉} |
|
They could select a different language but I don't think it'll be any worse than it is now which is an big bad error message and a profile they can't connect with, since it is the The MUD descriptions will show up as soon as someone connects at least once - I think we already have a lot of text on the first-launch screen and adding more going to get lost on the user. I've cut the text down a lot already, if you look at the diff! People want to just try Mudlet out, most won't sit there for ages deliberating on the first choice of the a MUD they pick, especially as they have no idea what they're doing. |
|
This is actually one case where making use of the tooltips would make sense, so you could over over a games icon to learn what it is about. What do you think? |
|
The status bar for the Editor is a separate |
|
Oh... I see that tooltips don't appear on the menu as they should, and that I because I have such a big screen, I literally can't see what I've selected on the menu and the description in the status bar at the same time. I think that's problem that information isn't contextualised and displayed in some other part of the screen instead - a problem to fix in another PR. It also means that if you went and disabled the statusbar in the menu, like I did because it's using up my space, you won't be getting the information! |
getDescription doesn't have a QLatin1String overload so a runtime allocation was necessary. Using QStringLiteral creates a QString at compiletime so it's free.
|
OK, I got this to a state I'm happy with for now. I've added MUD descriptions as tooltips as you wanted @SlySven. Have another go at reviewing this! |
| </property> | ||
| <property name="rightMargin"> | ||
| <number>0</number> | ||
| <number>9</number> |
There was a problem hiding this comment.
Is this an intentional increase in the right margin?
src/ui/connection_profiles.ui
Outdated
| <property name="leftMargin"> | ||
| <number>9</number> | ||
| </property> | ||
| <layout class="QGridLayout" name="gridLayout_3"> |
There was a problem hiding this comment.
What/where are the leftMargin and rightMargin elements now?
| <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:9pt; font-weight:600;"></p> | ||
| <p align="right" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:9pt; font-weight:600;">- The Mudlet Team</span></p></td></tr></table></body></html></string> | ||
| <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:9pt; font-weight:600;"><br /></p> | ||
| <p align="right" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> <span style=" font-family:'Sans'; font-size:9pt;">The Mudlet Team </span><img src=":/icons/mudlet_main_16px.png" /></p></td></tr></table></body></html></string> |
There was a problem hiding this comment.
🤢 uuurrrgh - was this saved with the simple HTML option - I'm guessing not!
There was a problem hiding this comment.
I think I fixed this in my attached commit below! 😀
There was a problem hiding this comment.
Simple html broke all the formatting when I tried it... I'll try your patch though.
src/ui/connection_profiles.ui
Outdated
| <pointsize>9</pointsize> | ||
| </font> | ||
| </property> | ||
| <property name="readOnly"> |
There was a problem hiding this comment.
I think if you frob a setting in the Designer it notes your tweaking and saves the revised setting - even if it is the normal one I think you have to hit the left-triangle icon to reset the setting (so that it is NOT in bold in the Designer control's properties area) otherwise it gets set in this file even though it does not change it from the default setting.
There was a problem hiding this comment.
Oh, not something I touched in the commit I attached below - safest to remove these lines with the "plain text editor" option in Qt Creator! 😀
| QString description = mud_description_textedit->toPlainText(); | ||
| writeProfileData( profile, QStringLiteral( "description" ), description ); | ||
|
|
||
| // don't display custom profile descriptions as a tooltip, as passwords could be stored in there |
There was a problem hiding this comment.
Not a helpful comment IMHO - If the user wants to write the password in the description area isn't that their problem - after all it will be shown if they click on the icon to select the profile to play it! 🙁
There was a problem hiding this comment.
Yeah, it will be shown when they explicitly click on it - and it won't be shown when they hover over it accidentally. I for example put passwords in there and wouldn't want them to be shown when I'm sharing my screen with someone else for example... might be an impractical concern though.
src/dlgConnectionProfiles.cpp
Outdated
| QString s = mProfileList.at(i); | ||
| if( s.isEmpty() ) | ||
| continue; | ||
| continue; |
There was a problem hiding this comment.
|
Awesome! Thanks for the review. I'll address this all tonight. Looking
together the release together asap.
…On Tue, 30 May 2017 5:29 pm Stephen Lyons, ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/ui/connection_profiles.ui
<#1016 (comment)>:
> @@ -2169,7 +2190,7 @@
<number>12</number>
</property>
<property name="rightMargin">
- <number>0</number>
+ <number>9</number>
Is this an intentional increase in the right margin?
------------------------------
In src/ui/connection_profiles.ui
<#1016 (comment)>:
> @@ -61,23 +79,17 @@
<height>0</height>
</size>
</property>
- <layout class="QGridLayout" name="gridLayout_5">
- <property name="leftMargin">
- <number>9</number>
- </property>
+ <layout class="QGridLayout" name="gridLayout_3">
What/where are the leftMargin and rightMargin elements now?
------------------------------
In src/ui/connection_profiles.ui
<#1016 (comment)>:
> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:9pt;">Have fun!</span></p>
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:9pt; font-weight:600;"></p>
-<p align="right" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:9pt; font-weight:600;">- The Mudlet Team</span></p></td></tr></table></body></html></string>
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:9pt; font-weight:600;"><br /></p>
+<p align="right" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> <span style=" font-family:'Sans'; font-size:9pt;">The Mudlet Team </span><img src=":/icons/mudlet_main_16px.png" /></p></td></tr></table></body></html></string>
🤢 uuurrrgh - was this saved with the *simple* HTML option - I'm guessing
not!
------------------------------
In src/ui/connection_profiles.ui
<#1016 (comment)>:
> <property name="font">
<font>
<family>Bitstream Charter</family>
<pointsize>9</pointsize>
</font>
</property>
+ <property name="readOnly">
I think if you *frob* a setting in the Designer it notes your tweaking
and saves the revised setting - *even if it is the normal one* I think
you have to hit the *left-triangle* icon to *reset* the setting (so that
it is NOT in *bold* in the Designer control's properties area) otherwise
it gets set in this file even though it does not change it from the default
setting.
------------------------------
In src/dlgConnectionProfiles.cpp
<#1016 (comment)>:
> @@ -133,8 +131,10 @@ void dlgConnectionProfiles::slot_update_description()
if( pItem )
{
QString profile = pItem->text();
- QString desc = mud_description_textedit->toPlainText();
- writeProfileData( profile, QStringLiteral( "description" ), desc );
+ QString description = mud_description_textedit->toPlainText();
+ writeProfileData( profile, QStringLiteral( "description" ), description );
+
+ // don't display custom profile descriptions as a tooltip, as passwords could be stored in there
Not a helpful comment IMHO - If the user *wants* to write the password in
the description area isn't that *their* problem - after all it *will* be
shown if they click on the icon to select the profile to play it! 🙁
------------------------------
In src/dlgConnectionProfiles.cpp
<#1016 (comment)>:
> for( int i=0; i<mProfileList.size(); i++ )
{
QString s = mProfileList.at(i);
if( s.isEmpty() )
- continue;
+ continue;
|
|
@vadi2 can you apply commit-d3adf6b.txt (a git commit written as a "patch" and a
It does not do any wrapping of any of the tool-tips in HTML markup - which might be wanted for any that are more than a short sentence long...! |
|
@SlySven this has been sitting with you a while, mind reviewing it? I want it in 3.2 and there are just 2 days left until PR window closes. |
|
I agree that somehow the first line of text got omitted from that patch - but the remaining reordering of the ".ui" file will clean up the "Squash and Merge" here. Gimme a couple of hours please i.e. until 2017/06/03 23:00:00 UTC and I'll get another patch with just the rest of it without that HTML reformat... |
|
OK, try this patchfile: commit-9780902.txt, which just reorders the .ui file without touching the HTML (I noted that the other issue - the white-space glitch - has been done) - it should improve on the +216/-235 line change count for that file and make it easier to pick out the real changes! 👍 |
|
This one looks good, thank you! 💯 |
|
OK - I've applied all the changes. They're pretty minor so I assume no other feedback was necessary, will merge this tomorrow unless there are any other unmentioned concerns! |
|
This one is definitely a "Squash and merge" job! |
|
I know, don't worry ;) |



Video of before, video of after.
Improved the first time launch user experience significantly - the connection dialog comes up automatically and Mudlet isn't too tiny in a weird spot on the screen anymore. The welcome screen has also been fixed to actually show - it hadn't for years.