View Issue Details

IDProjectCategoryView StatusLast Update
0003884FreeCADPatchpublic2019-03-31 09:25
ReporteropenBrainAssigned To 
PrioritynoneSeveritytextReproducibilityalways
Status closedResolutionfixed 
Product Version0.18 
Target Version0.19Fixed in Version0.19 
Summary0003884: Add information about desktop environment in FC info
DescriptionThe goal of the patch is to add some useful information about the user desktop environment (mainly Linux environments are concerned) when FC info are copied to clipboard with the dedicated button of the about dialog.
Can be helpful to forum helpers.
Steps To Reproduce

diff --git a/src/Gui/Splashscreen.cpp b/src/Gui/Splashscreen.cpp
index e097a1c11..3478fa73e 100644
--- a/src/Gui/Splashscreen.cpp
+++ b/src/Gui/Splashscreen.cpp
@@ -32,6 +32,7 @@
 # include <QMutex>
 # include <QTextBrowser>
 # include <QProcess>
+# include <QProcessEnvironment>
 # include <QSysInfo>
 # include <QTextStream>
 # include <QWaitCondition>
@@ -724,7 +725,23 @@ void AboutDialog::on_copyButton_clicked()
     QString major  = QString::fromLatin1(config["BuildVersionMajor"].c_str());
     QString minor  = QString::fromLatin1(config["BuildVersionMinor"].c_str());
     QString build  = QString::fromLatin1(config["BuildRevision"].c_str());
-    str << "OS: " << SystemInfo::getOperatingSystem() << endl;
+    
+    QString deskEnv = QProcessEnvironment::systemEnvironment().value(QString::fromAscii("XDG_CURRENT_DESKTOP"),QString::fromAscii(""));

+    QString deskSess = QProcessEnvironment::systemEnvironment().value(QString::fromAscii("DESKTOP_SESSION"),QString::fromAscii(""));

+    QString deskInfo = QString::fromAscii("");
+    if (!(deskEnv == QString::fromAscii("") && deskSess == QString::fromAscii("")))

+    {
+        if (deskEnv == QString::fromAscii("") || deskSess == QString::fromAscii(""))

+        {
+            deskInfo = QString::fromAscii(" (") + deskEnv + deskSess + QString::fromAscii("(");

+        }
+        else
+        {
+            deskInfo = QString::fromAscii(" (") + deskEnv + QString::fromAscii("/") 
+ deskSess + QString::fromAscii(")");
+        }
+    }
+    
+    str << "OS: " << SystemInfo::getOperatingSystem() << deskInfo << 
endl;
     int wordSize = SystemInfo::getWordSizeOfOS();
     if (wordSize > 0) {
         str << "Word size of OS: " << wordSize << "-bit" << 
endl;
Additional InformationSorry to submit a diff, but not everything is ready for PR.
  1. Only tested on KDE Plasma
  2. Compatible with Qt4 & Qt5 (AFAIK)

Tell me if more needed
TagsNo tags attached.

Activities

openBrain

2019-03-05 17:54

developer  

FC_deskenv.diff (1,762 bytes)
diff --git a/src/Gui/Splashscreen.cpp b/src/Gui/Splashscreen.cpp
index e097a1c11..3478fa73e 100644
--- a/src/Gui/Splashscreen.cpp
+++ b/src/Gui/Splashscreen.cpp
@@ -32,6 +32,7 @@
 # include <QMutex>
 # include <QTextBrowser>
 # include <QProcess>
+# include <QProcessEnvironment>
 # include <QSysInfo>
 # include <QTextStream>
 # include <QWaitCondition>
@@ -724,7 +725,23 @@ void AboutDialog::on_copyButton_clicked()
     QString major  = QString::fromLatin1(config["BuildVersionMajor"].c_str());
     QString minor  = QString::fromLatin1(config["BuildVersionMinor"].c_str());
     QString build  = QString::fromLatin1(config["BuildRevision"].c_str());
-    str << "OS: " << SystemInfo::getOperatingSystem() << endl;
+    
+    QString deskEnv = QProcessEnvironment::systemEnvironment().value(QString::fromAscii("XDG_CURRENT_DESKTOP"),QString::fromAscii(""));
+    QString deskSess = QProcessEnvironment::systemEnvironment().value(QString::fromAscii("DESKTOP_SESSION"),QString::fromAscii(""));
+    QString deskInfo = QString::fromAscii("");
+    if (!(deskEnv == QString::fromAscii("") && deskSess == QString::fromAscii("")))
+    {
+        if (deskEnv == QString::fromAscii("") || deskSess == QString::fromAscii(""))
+        {
+            deskInfo = QString::fromAscii(" (") + deskEnv + deskSess + QString::fromAscii("(");
+        }
+        else
+        {
+            deskInfo = QString::fromAscii(" (") + deskEnv + QString::fromAscii("/") + deskSess + QString::fromAscii(")");
+        }
+    }
+    
+    str << "OS: " << SystemInfo::getOperatingSystem() << deskInfo << endl;
     int wordSize = SystemInfo::getWordSizeOfOS();
     if (wordSize > 0) {
         str << "Word size of OS: " << wordSize << "-bit" << endl;
FC_deskenv.diff (1,762 bytes)

openBrain

2019-03-20 20:58

developer   ~0012936

Last edited: 2019-03-21 02:01

View 3 revisions

@Kunda1 (or other with some rights), I finally proposed this patch in pull request ( FreeCAD Pull Request 2038 ) with some improvements.
Could you thus close this ticket to prevent duplication ?
Thanks (sorry for inconvenience).

Kunda1

2019-03-21 02:02

administrator   ~0012937

Last edited: 2019-03-21 02:02

View 2 revisions

I've notified the devs on the ticket to close this ticket once that FreeCAD Pull Request 2038 has been merged.

wmayer

2019-03-31 09:25

administrator   ~0012978

https://github.com/FreeCAD/FreeCAD/commit/2b856e08402b275cf7c6d9d6d126b15a676cf40d

Issue History

Date Modified Username Field Change
2019-03-05 17:54 openBrain New Issue
2019-03-05 17:54 openBrain File Added: FC_deskenv.diff
2019-03-06 00:43 Kunda1 Steps to Reproduce Updated View Revisions
2019-03-06 00:44 Kunda1 Assigned To => wmayer
2019-03-06 00:44 Kunda1 Status new => assigned
2019-03-20 20:58 openBrain Note Added: 0012936
2019-03-21 02:01 Kunda1 Note Edited: 0012936 View Revisions
2019-03-21 02:01 Kunda1 Note Edited: 0012936 View Revisions
2019-03-21 02:02 Kunda1 Target Version => 0.19
2019-03-21 02:02 Kunda1 Note Added: 0012937
2019-03-21 02:02 Kunda1 Note Edited: 0012937 View Revisions
2019-03-31 09:25 wmayer Assigned To wmayer =>
2019-03-31 09:25 wmayer Status assigned => closed
2019-03-31 09:25 wmayer Resolution open => fixed
2019-03-31 09:25 wmayer Fixed in Version => 0.19
2019-03-31 09:25 wmayer Note Added: 0012978