Skip to content

Commit

Permalink
NOISSUE add linux distro name and release stats to analytics
Browse files Browse the repository at this point in the history
Hopefully this can serve as some sort of guideline for focusing
effort towards the right distro packages to make.
  • Loading branch information
peterix committed Mar 12, 2018
1 parent 0812e3a commit 4111d35
Show file tree
Hide file tree
Showing 10 changed files with 420 additions and 1 deletion.
29 changes: 28 additions & 1 deletion COPYING.md
Expand Up @@ -224,4 +224,31 @@
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# lionshead

Code has been taken from https://github.com/natefoo/lionshead and loosely
translated to C++ laced with Qt.

MIT License

Copyright (c) 2017 Nate Coraor

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
9 changes: 9 additions & 0 deletions application/MultiMC.cpp
Expand Up @@ -1156,6 +1156,15 @@ MainWindow* MultiMC::showMainWindow(bool minimized)
auto kernelInfo = Sys::getKernelInfo();
customValues["cd5"] = kernelInfo.kernelName;
customValues["cd6"] = kernelInfo.kernelVersion;
auto distInfo = Sys::getDistributionInfo();
if(!distInfo.distributionName.isEmpty())
{
customValues["cd7"] = distInfo.distributionName;
}
if(!distInfo.distributionVersion.isEmpty())
{
customValues["cd8"] = distInfo.distributionVersion;
}
m_analytics->sendScreenView("Main Window", customValues);
}
return m_mainWindow;
Expand Down
2 changes: 2 additions & 0 deletions libraries/systeminfo/CMakeLists.txt
Expand Up @@ -4,6 +4,8 @@ find_package(Qt5Core)

set(systeminfo_SOURCES
include/sys.h
include/distroutils.h
src/distroutils.cpp
)

if (WIN32)
Expand Down
23 changes: 23 additions & 0 deletions libraries/systeminfo/include/distroutils.h
@@ -0,0 +1,23 @@
#include "sys.h"
#include <QString>

namespace Sys {
struct LsbInfo
{
QString distributor;
QString version;
QString description;
QString codename;
};

bool main_lsb_info(LsbInfo & out);
bool fallback_lsb_info(Sys::LsbInfo & out);
void lsb_postprocess(Sys::LsbInfo & lsb, Sys::DistributionInfo & out);
Sys::DistributionInfo read_lsb_release();

QString _extract_distribution(const QString & x);
QString _extract_version(const QString & x);
Sys::DistributionInfo read_legacy_release();

Sys::DistributionInfo read_os_release();
}
29 changes: 29 additions & 0 deletions libraries/systeminfo/include/sys.h
Expand Up @@ -12,6 +12,35 @@ struct KernelInfo

KernelInfo getKernelInfo();

struct DistributionInfo
{
DistributionInfo operator+(const DistributionInfo& rhs) const
{
DistributionInfo out;
if(!distributionName.isEmpty())
{
out.distributionName = distributionName;
}
else
{
out.distributionName = rhs.distributionName;
}
if(!distributionVersion.isEmpty())
{
out.distributionVersion = distributionVersion;
}
else
{
out.distributionVersion = rhs.distributionVersion;
}
return out;
}
QString distributionName;
QString distributionVersion;
};

DistributionInfo getDistributionInfo();

uint64_t getSystemRam();

bool isSystem64bit();
Expand Down

0 comments on commit 4111d35

Please sign in to comment.