Skip to content

Improve first-time user experience#1016

Merged
vadi2 merged 34 commits intoMudlet:developmentfrom
vadi2:fix-initial-connection-layout
Jun 4, 2017
Merged

Improve first-time user experience#1016
vadi2 merged 34 commits intoMudlet:developmentfrom
vadi2:fix-initial-connection-layout

Conversation

@vadi2
Copy link
Copy Markdown
Member

@vadi2 vadi2 commented May 16, 2017

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.

vadi2 added 19 commits May 14, 2017 20:06
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
@vadi2 vadi2 self-assigned this May 16, 2017
@vadi2 vadi2 requested a review from SlySven May 16, 2017 21:46
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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oops!

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);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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 );

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sure - improved. Thanks! :)

src/main.cpp Outdated
mudlet::self()->resize(1500, 800);

auto mudletFrame = mudlet::self()->frameGeometry();
auto desktopFrame = qApp->desktop()->size();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

⚠️ DON'T DO THESE THINGS - they can be nasty for users with multiple-headed systems (such as yours truely 😊 ) read up on the 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 😀

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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)...
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

But why... ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

⚠️ Confirmed my suspicions - it needs to be shown at least one for it to automatically show the 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()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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...? 😀

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's not a slot. Sure, in another PR, why blow the scope of this one up...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OK...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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... 🤣

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We should.

&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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) {

?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't see the point - if the value is not set, it defaults to unchecked. How will adding more rigour help?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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"));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

@SlySven
Copy link
Copy Markdown
Member

SlySven commented May 17, 2017

One thing about selected a random predefined MUD - Avalon is the German Avalon.de mud
mudlet_snapshot13

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...!

@SlySven
Copy link
Copy Markdown
Member

SlySven commented May 17, 2017

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... 😉}

@vadi2
Copy link
Copy Markdown
Member Author

vadi2 commented May 18, 2017

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 default_host profile that's the current selection. So I think what I've made is an improvement and we can tweak it later down the road as needed.

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.

@vadi2
Copy link
Copy Markdown
Member Author

vadi2 commented May 18, 2017

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?

@SlySven
Copy link
Copy Markdown
Member

SlySven commented May 30, 2017

The status bar for the Editor is a separate QMainWindow (or is that QMainWidget) instance - the primary usage of the main application window one is statusTips for the 2D mapper - check what happens with the context menu - (this is certainly for the script-able one and the floating widget form when docked but possibly also when undocked)...

@vadi2
Copy link
Copy Markdown
Member Author

vadi2 commented May 30, 2017

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!

vadi2 added 4 commits May 30, 2017 07:06
getDescription doesn't have a QLatin1String overload so a runtime allocation was necessary. Using QStringLiteral creates a QString at compiletime so it's free.
@vadi2
Copy link
Copy Markdown
Member Author

vadi2 commented May 30, 2017

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!

@vadi2 vadi2 assigned SlySven and unassigned vadi2 May 30, 2017
</property>
<property name="rightMargin">
<number>0</number>
<number>9</number>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this an intentional increase in the right margin?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yep, aesthetic reasons.

<property name="leftMargin">
<number>9</number>
</property>
<layout class="QGridLayout" name="gridLayout_3">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What/where are the leftMargin and rightMargin elements now?

&lt;p style=&quot;-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;&quot;&gt;&lt;/p&gt;
&lt;p align=&quot;right&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans'; font-size:9pt; font-weight:600;&quot;&gt;- The Mudlet Team&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;p style=&quot;-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;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p align=&quot;right&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; &lt;span style=&quot; font-family:'Sans'; font-size:9pt;&quot;&gt;The Mudlet Team &lt;/span&gt;&lt;img src=&quot;:/icons/mudlet_main_16px.png&quot; /&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🤢 uuurrrgh - was this saved with the simple HTML option - I'm guessing not!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think I fixed this in my attached commit below! 😀

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Simple html broke all the formatting when I tried it... I'll try your patch though.

<pointsize>9</pointsize>
</font>
</property>
<property name="readOnly">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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! 🙁

Copy link
Copy Markdown
Member Author

@vadi2 vadi2 May 30, 2017

Choose a reason for hiding this comment

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

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.

QString s = mProfileList.at(i);
if( s.isEmpty() )
continue;
continue;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

⚠️ Extra white-space on end of line!

@vadi2
Copy link
Copy Markdown
Member Author

vadi2 commented May 30, 2017 via email

@SlySven
Copy link
Copy Markdown
Member

SlySven commented May 30, 2017

@vadi2 can you apply commit-d3adf6b.txt (a git commit written as a "patch" and a .txt extension added so that the Web interface will accept it as a file to upload) as a commit to your PR:

  • it touches the .ui file to remove those one common margin to four separate ones cases
  • it redoes the HTML markup so that it is as simple as I can make it for the "Welcome message" but retains the content text and layout (and without a specific font being mentioned most/all of the time).
  • it reorders some bits that got moved so that the overall change-set for that file is smaller and easier to digest (and renames a gridLayout_3 back to the original gridLayout_5 so there is one less change even though there is a gap in the gridLayout_# names now - but as they are only used internally that is not an issue IMVHO!)

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...!

@vadi2
Copy link
Copy Markdown
Member Author

vadi2 commented May 30, 2017

I tried the patch, but it breaks the layout.

Before:
select a profile to connect with_072

After:
select a profile to connect with_071

I think it's trying to solve a problem we don't have right now - can we leave the html as-is and look at it when it becomes one?

@vadi2
Copy link
Copy Markdown
Member Author

vadi2 commented Jun 3, 2017

@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.

@SlySven
Copy link
Copy Markdown
Member

SlySven commented Jun 3, 2017

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...

@SlySven
Copy link
Copy Markdown
Member

SlySven commented Jun 3, 2017

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! 👍

@vadi2
Copy link
Copy Markdown
Member Author

vadi2 commented Jun 4, 2017

This one looks good, thank you! 💯

@vadi2
Copy link
Copy Markdown
Member Author

vadi2 commented Jun 4, 2017

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!

Copy link
Copy Markdown
Member

@SlySven SlySven left a comment

Choose a reason for hiding this comment

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

👍 I honestly think it is easier to see the changes in that .ui file now... 😀

@SlySven
Copy link
Copy Markdown
Member

SlySven commented Jun 4, 2017

This one is definitely a "Squash and merge" job!

@vadi2
Copy link
Copy Markdown
Member Author

vadi2 commented Jun 4, 2017

I know, don't worry ;)

@vadi2 vadi2 merged commit b97d6cc into Mudlet:development Jun 4, 2017
@vadi2 vadi2 deleted the fix-initial-connection-layout branch June 4, 2017 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants