From 10345eea7371e99182bdfb77959e585b9b29c264 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 21 Mar 2017 12:18:09 +0100 Subject: [PATCH] Restyling of log viewer Now the entries have icons telling the type of message. This is more convenient when multi-line messages are encountered. --- src/lay/LogViewerDialog.ui | 14 +++++++++++++- src/lay/images/empty_16.png | Bin 0 -> 149 bytes src/lay/images/error_16.png | Bin 0 -> 674 bytes src/lay/images/info_16.png | Bin 0 -> 499 bytes src/lay/images/warn_16.png | Bin 0 -> 637 bytes src/lay/layLogViewerDialog.cc | 17 ++++++++++++----- src/lay/layResources.qrc | 4 ++++ src/lay/laySaltGrainPropertiesDialog.cc | 12 ++++++------ 8 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 src/lay/images/empty_16.png create mode 100644 src/lay/images/error_16.png create mode 100644 src/lay/images/info_16.png create mode 100644 src/lay/images/warn_16.png diff --git a/src/lay/LogViewerDialog.ui b/src/lay/LogViewerDialog.ui index 41834aa0c..889342ade 100644 --- a/src/lay/LogViewerDialog.ui +++ b/src/lay/LogViewerDialog.ui @@ -88,12 +88,24 @@ + + + 16 + 16 + + + + false + QListView::Adjust true + + false + @@ -157,7 +169,7 @@ - :/warn.png + :/warn_16.png diff --git a/src/lay/images/empty_16.png b/src/lay/images/empty_16.png new file mode 100644 index 0000000000000000000000000000000000000000..10b1f1be69386ddc01a2e7bfea83c208f1210e5a GIT binary patch literal 149 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf4nJ zFy8=S#yt0AQ=p(^iEBhjaDG}zd16s2LwR|*US?i)adKios$PCk`s{Z$Qb0vQo-U3d l7QM*{60D08M0%JwfQAb&FxLB4^Z{iVJYD@<);T3K0RT{2BXa-% literal 0 HcmV?d00001 diff --git a/src/lay/images/error_16.png b/src/lay/images/error_16.png new file mode 100644 index 0000000000000000000000000000000000000000..c9dad1310711826bf2c1dd147eca79606aefe4b2 GIT binary patch literal 674 zcmV;T0$u%yP)8*v!MpYNrYN-kv4G=nk8kTiF_LMgU`U>xe; zY)*tWPJ!g6fD%Z0|3NuR_Yk=bDiV||f`eO4ai~8iNw4QxV~cYjriI?U9io9q6Djmv z-r@Z|&-=U|zQF&kVzDSElgW=_Jl+umfdoMyNfbMZq8wxc#djGdhUySsqf4R}0&Ab?%>FEcaFi%f>4(`i}Pb;|_+ zfk2>|n3@W`tk)U#_kp7$Fqf-q!1I9H4aV~T&*MR-!+wOr_;!B&#ImgS8~~W6`7AXt z!RYW1xV#)rx!p!8k-%5ed=3Ej0O0$@#fa2u_1?HnPX4N;l@$QMW1o*To6Qjb;JPFj z4PSf92ms?a>Lmz{kN>iKzWYzFq1uy^J!pLpJstpn*=kWR82o8jRyV;TSw7xuHi6O6 zyVrZY*r?SY%krn*3DIaYyIHBgQdI|x4Hh$ox+pqZl?r09ShjDbs_JSa5}`)9Z2z8} zC3||B?76wVkMwza+YW_7q^jzhp66|oYPFhwwYZ3sBtdq$7P*#nx;Lx8`3}4AB3RNj1pk!dH?_b07*qo IM6N<$f&?lsN&o-= literal 0 HcmV?d00001 diff --git a/src/lay/images/info_16.png b/src/lay/images/info_16.png new file mode 100644 index 0000000000000000000000000000000000000000..d1fa366446e37390cac4e7ef610c24115660d29d GIT binary patch literal 499 zcmVMWLn|PCy!h8=)p#fXW*e#HJ`D5dYoe&Hv5+W`KW6t$XPA`}?M8+5ljh zW>_wl#~T59z2GF9-MP)>c56`-VLsPjW?`l$W^Ox<^P29bbm9B{Wj=rCJC0qOPN#_D zuk@gE0NpSQTPqWEI{s;~c+?XS8jmLs(I}OQ0D#fx9n1t~1`)?Zs%}}<8vqyyN$Kn1 za7aom8kv{ErDZCmZU9^)2|Uls5g8xMq=+~HEGE*gn!!w3L=G&=iUmMFrqF7G;th$H|aJpiD$@as5^2MM6rY)+KI^A>=PZQGv-005Li8$i5) zd8V~)C%*JcxBJp!raNXf*IZ$ylyOxkSPws*rDHc5XZL`v1MslC6Aj=|MCxhtp9EFaKj!`_Q(N@y`IA9@_HdAGO&b7I-`l~UxITBnDDwI~ z=FcNMd)z1~C06>~k7$#&KfKt({K;d^C-~i)Vb+=o0Nl=D(b=#qacgnjQmIh|NCG4w zoepAt&JJlUuKh1PsZIKke;a4cc?^I7Fqii8MmEW&DartbdlI-d-MxCr3B+RZPkKX= z5Z@cZ<&}6K99DOFr61ZI7UkNO&z$p^Hxn&_+8A?vg15iVayYC?01k8!47hav@x9Zg z3c1aT954aXV4>Wv9A5;6SF^i!#kQ0Z6oJ#&7Bc{9OW7;O>M4>Q+KGS|;>?dKI9 z8gh#OW*P+2vB-b=Xj#+FI=~;B1Y8*d*AD{F%~HxiX6=max|R=sgp^oJr&M(O$P!Sz z-NKiI$>|)9O=a5*0FAQ?lkmK#C#75vj;7TInP~^rmjGwm41^FMl3fNwHZp4$Y}Yk! z2C6mevW+i5*#{K08N7Zq4j|fP02oLnVyIMVaTta?uPrJxKCIs|3{|wO(8XRi(YJmB X_oS&DXk~uz00000NkvXXu0mjfA= 0) { LogFileEntry::mode_type mode = m_messages [index.row ()].mode (); - std::string message = m_messages [index.row ()].text (); if (mode == LogFileEntry::Error) { - return QVariant (tl::to_qstring (tl::to_string (QObject::tr ("ERROR: ")) + message)); + return QIcon (QString::fromUtf8 (":/error_16.png")); } else if (mode == LogFileEntry::Warning) { - return QVariant (tl::to_qstring (tl::to_string (QObject::tr ("Warning: ")) + message)); + return QIcon (QString::fromUtf8 (":/warn_16.png")); + } else if (mode == LogFileEntry::Info) { + return QIcon (QString::fromUtf8 (":/info_16.png")); } else { - return QVariant (tl::to_qstring (message)); + return QIcon (QString::fromUtf8 (":/empty_16.png")); } + } + + } else if (role == Qt::DisplayRole) { + + if (index.row () < int (m_messages.size ()) && index.row () >= 0) { + return QVariant (tl::to_qstring (m_messages [index.row ()].text ())); } } else if (role == Qt::FontRole) { diff --git a/src/lay/layResources.qrc b/src/lay/layResources.qrc index ef87d4e5f..3ffd9e81e 100644 --- a/src/lay/layResources.qrc +++ b/src/lay/layResources.qrc @@ -116,6 +116,10 @@ images/salt.png images/salt_icon.png images/warn.png + images/warn_16.png + images/empty_16.png + images/error_16.png + images/info_16.png syntax/ruby.xml diff --git a/src/lay/laySaltGrainPropertiesDialog.cc b/src/lay/laySaltGrainPropertiesDialog.cc index a3042783e..88fd3d652 100644 --- a/src/lay/laySaltGrainPropertiesDialog.cc +++ b/src/lay/laySaltGrainPropertiesDialog.cc @@ -519,8 +519,8 @@ SaltGrainPropertiesDialog::accept () if (! SaltGrain::valid_name (d->name)) { dependencies_alert->error () << tr ("'%1' is not a valid package name").arg (tl::to_qstring (d->name)) << tl::endl - << tr ("Valid package names are words (letters, digits, underscores)") << tl::endl - << tr ("Package groups can be specified in the form 'group/package'"); + << tr ("Valid package names are words (letters, digits, underscores).") << tl::endl + << tr ("Package groups can be specified in the form 'group/package'."); continue; } @@ -539,20 +539,20 @@ SaltGrainPropertiesDialog::accept () dep.check_circular (dep.grain_for_name (m_grain.name ()), dep.grain_for_name (d->name)); } catch (tl::Exception &ex) { dependencies_alert->error () << ex.msg () << tl::endl - << tr ("Circular dependency means a package is eventually depending on itself."); + << tr ("Circular dependency means, a package is eventually depending on itself."); } } if (d->version.empty ()) { dependencies_alert->warn () << tr ("No version specified for dependency '%1'").arg (tl::to_qstring (d->name)) << tl::endl - << tr ("Versions help checking dependencies.") << tl::endl - << tr ("If the dependency package has a version itself, the version is automatically set to it's current version"); + << tr ("Please consider giving a version here. Versions help deciding whether a package needs to be updated.") << tl::endl + << tr ("If the dependency package has a version itself, the version is automatically set to it's current version."); } if (d->url.empty ()) { dependencies_alert->warn () << tr ("No download URL specified for dependency '%1'").arg (tl::to_qstring (d->name)) << tl::endl << tr ("A download URL should be specified to ensure the package dependencies can be resolved.") << tl::endl - << tr ("If the dependency package was downloaded itself, the URL is automatically set to the download source"); + << tr ("If the dependency package was downloaded itself, the URL is automatically set to the download source."); } else { std::string spec_url = SaltGrain::spec_url (d->url); tl::InputHttpStream stream (spec_url);