Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
build system tweaks
PLEASE NOTE BELOW however: https://twitter.com/malexaMK/status/1010658898376888321 desktop parser work
- Loading branch information
Matthew Kehrer
committed
Jun 24, 2018
1 parent
e02e7fa
commit 8958f57
Showing
10 changed files
with
198 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#include "Files/desktop_entry.h" | ||
#include <QFile> | ||
|
||
DesktopEntry::DesktopEntry(QObject *parent) | ||
: IDesktopApp(parent), p_entrycount(0), p_linecount(0) | ||
{ | ||
p_fileobj = new QFile(); | ||
} | ||
|
||
DesktopEntry::DesktopEntry(QObject *parent, const QString &folder, const QString &filename) | ||
: IDesktopApp(parent), p_entrycount(0), p_linecount(0), p_parent_folder(folder), p_entry_filename(filename) | ||
{ | ||
p_fileobj = new QFile(); | ||
} | ||
|
||
DesktopEntry::~DesktopEntry() | ||
{ | ||
if (p_fileobj != nullptr) | ||
delete p_fileobj; | ||
} | ||
|
||
IDesktopApp::LPC_Pair DesktopEntry::get_line_param_count(void) const | ||
{ | ||
return std::pair<int,int>(p_linecount, p_entrycount); | ||
} | ||
|
||
IDesktopApp::pNode_Vals DesktopEntry::get_nv_map(void) const | ||
{ | ||
return const_cast<IDesktopApp::pNode_Vals>(&p_map_nv); | ||
} | ||
|
||
void DesktopEntry::create_nv_map(const IDesktopApp::LPC_Pair &l_e, void (*per_entry)(QString &, QString &, IDesktopApp::LPC_Pair &)) | ||
{ | ||
int line_count = l_e.first; | ||
int entry_count = l_e.second; | ||
const QByteArray zeroed(1024, '\0'); | ||
const QString rootnode(QString::fromWCharArray(IDesktopApp::get_root_node(), wcslen(IDesktopApp::get_root_node()))); | ||
|
||
for(auto p = IDesktopApp::LPC_Pair(line_count,entry_count); std::get<0>(p) > 0 && std::get<1>(p) > 0; p=std::make_pair(--line_count,--entry_count)) | ||
{ | ||
QByteArray qba = zeroed; | ||
QString qsa = QString(qba); | ||
|
||
if (qsa == rootnode) | ||
continue; | ||
|
||
per_entry(qsa.split(QChar('='))[0], qsa.split(QChar('='))[1], p); | ||
} | ||
|
||
} | ||
|
||
void DesktopEntry::create_nv_map(const int lC, const int eC, void (*per_entry)(QString &, QString &, IDesktopApp::LPC_Pair &)) | ||
{ | ||
int line_count = lC; | ||
int entry_count = eC; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#ifndef _DESKTOP_ENTRY_H_ | ||
#define _DESKTOP_ENTRY_H_ | ||
|
||
#include <QMap> | ||
#include <QFile> | ||
#include "stacer-core_global.h" | ||
#include "Iface/idesktopapp.h" | ||
|
||
class STACERCORESHARED_EXPORT DesktopEntry : public IDesktopApp | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit DesktopEntry(QObject *parent=nullptr); | ||
DesktopEntry(QObject *parent, const QString& folder, const QString& filename); | ||
~DesktopEntry() override; | ||
|
||
virtual IDesktopApp::LPC_Pair get_line_param_count(void) const; | ||
virtual IDesktopApp::pNode_Vals get_nv_map(void) const; | ||
|
||
virtual void create_nv_map(const IDesktopApp::LPC_Pair &l_e, void(*per_entry)(QString&,QString&,IDesktopApp::LPC_Pair&)); | ||
virtual void create_nv_map(const int lC, const int eC, void(*per_entry)(QString&,QString&,IDesktopApp::LPC_Pair&)); | ||
|
||
private: | ||
int p_linecount; | ||
int p_entrycount; | ||
|
||
IDesktopApp::Node_Vals p_map_nv; | ||
QString p_parent_folder; | ||
QString p_entry_filename; | ||
QFile *p_fileobj; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include "Iface/idesktopapp.h" | ||
|
||
IDesktopApp::IDesktopApp( QObject* parent ) | ||
: QObject(parent) | ||
{ | ||
|
||
} | ||
|
||
IDesktopApp::~IDesktopApp() | ||
{ | ||
|
||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#ifndef _IDESKTOPAPP_H_ | ||
#define _IDESKTOPAPP_H_ | ||
|
||
#include <QObject> | ||
#include "stacer-core_global.h" | ||
|
||
class STACERCORESHARED_EXPORT IDesktopApp : public QObject | ||
{ | ||
Q_OBJECT | ||
public: | ||
typedef std::pair<int,int> LPC_Pair; | ||
typedef QMap<QString,QString> Node_Vals; | ||
typedef Node_Vals* pNode_Vals; | ||
public: | ||
explicit IDesktopApp( QObject* parent = nullptr ); | ||
~IDesktopApp() override; | ||
|
||
Q_DECL_RELAXED_CONSTEXPR const wchar_t *get_root_node(void) { | ||
return L"[DesktopEntry]"; | ||
} | ||
|
||
// A - line count | ||
// B - entry count | ||
virtual IDesktopApp::LPC_Pair get_line_param_count(void) const = 0; | ||
// ptr to qmap | ||
virtual IDesktopApp::pNode_Vals get_nv_map(void) const = 0; | ||
|
||
virtual void create_nv_map(const IDesktopApp::LPC_Pair &l_e, void(*per_entry)(QString&,QString&,IDesktopApp::LPC_Pair&)) = 0; | ||
virtual void create_nv_map(const int lC, const int eC, void(*per_entry)(QString&,QString&,IDesktopApp::LPC_Pair&)) = 0; | ||
|
||
virtual const QString getName(QString *key_override=nullptr) const = 0; | ||
|
||
virtual const QString getExec(QString *key_override=nullptr) const = 0; | ||
}; | ||
|
||
Q_DECLARE_METATYPE(::IDesktopApp*) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters