Skip to content

Rename DeviceInfo to DeviceSpecs to remove conflict #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/controls/qml/Application.qml
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ Application_p {
edge: Qt.RightEdge
visible: false
z: 10
anchors.verticalCenterOffset: DeviceInfo.flatTireHeight/2
anchors.verticalCenterOffset: DeviceSpecs.flatTireHeight/2
}

Indicator {
id: leftIndicator
edge: Qt.LeftEdge
visible: true
z: 10
anchors.verticalCenterOffset: DeviceInfo.flatTireHeight/2
anchors.verticalCenterOffset: DeviceSpecs.flatTireHeight/2
}

Indicator {
Expand Down
2 changes: 1 addition & 1 deletion src/controls/qml/BorderGestureArea.qml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ import org.asteroid.utils 1.0
MouseArea {
id: root

property int boundary: width*DeviceInfo.borderGestureWidth
property int boundary: width*DeviceSpecs.borderGestureWidth
property bool delayReset

signal gestureStarted(string gesture)
Expand Down
4 changes: 2 additions & 2 deletions src/controls/qml/Dims.qml
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ QtObject {
\brief Returns a dimension that is \a number percent of the screen height.
*/
function h(number) {
return (number/100)*(Screen.desktopAvailableHeight+DeviceInfo.flatTireHeight)
return (number/100)*(Screen.desktopAvailableHeight+DeviceSpecs.flatTireHeight)
}

/*!
\qmlmethod real l(real number)
\brief Returns a dimension that is \a number percent of the screen width or height; whichever is smaller.
*/
function l(number) {
if(Screen.desktopAvailableWidth > (Screen.desktopAvailableHeight+DeviceInfo.flatTireHeight))
if(Screen.desktopAvailableWidth > (Screen.desktopAvailableHeight+DeviceSpecs.flatTireHeight))
return h(number)
else
return w(number)
Expand Down
4 changes: 2 additions & 2 deletions src/controls/qml/ListItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ Item {
anchors {
verticalCenter: parent.verticalCenter
left: parent.left
leftMargin: DeviceInfo.hasRoundScreen ? Dims.w(18) : Dims.w(12)
leftMargin: DeviceSpecs.hasRoundScreen ? Dims.w(18) : Dims.w(12)
}
}

Label {
id: label

anchors {
leftMargin: DeviceInfo.hasRoundScreen ? Dims.w(6) : Dims.w(10)
leftMargin: DeviceSpecs.hasRoundScreen ? Dims.w(6) : Dims.w(10)
left: icon.right
verticalCenter: parent.verticalCenter
}
Expand Down
4 changes: 2 additions & 2 deletions src/controls/qml/PageHeader.qml
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ Item {
}
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
leftPadding: DeviceInfo.hasRoundScreen ? Dims.w(25) : 0
rightPadding: DeviceInfo.hasRoundScreen ? Dims.w(25) : 0
leftPadding: DeviceSpecs.hasRoundScreen ? Dims.w(25) : 0
rightPadding: DeviceSpecs.hasRoundScreen ? Dims.w(25) : 0
wrapMode: Text.WordWrap
maximumLineCount: 2
}
Expand Down
4 changes: 2 additions & 2 deletions src/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
set(SRC
src/utils_plugin.cpp
src/deviceinfo.cpp
src/devicespecs.cpp
src/fileinfo.cpp
src/bluetoothstatus.cpp)
set(HEADERS
src/utils_plugin.h
src/deviceinfo.h
src/devicespecs.h
src/fileinfo.h
src/bluetoothstatus.h)

Expand Down
22 changes: 11 additions & 11 deletions src/utils/src/deviceinfo.cpp → src/utils/src/devicespecs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "deviceinfo.h"
#include "devicespecs.h"
#include <QFile>

const char* CONFIG_FILE = "/etc/asteroid/machine.conf";
const char* HOST_FILE = "/etc/hostname";
const char* OS_RELEASE_FILE = "/etc/os-release";

DeviceInfo::DeviceInfo()
DeviceSpecs::DeviceInfo()
: m_settings(CONFIG_FILE, QSettings::IniFormat)
{
QSettings::Status status(m_settings.status());
Expand Down Expand Up @@ -57,47 +57,47 @@ DeviceInfo::DeviceInfo()
}
}

bool DeviceInfo::hasRoundScreen()
bool DeviceSpecs::hasRoundScreen()
{
return m_settings.value("Display/ROUND", false).toBool();
}

double DeviceInfo::borderGestureWidth()
double DeviceSpecs::borderGestureWidth()
{
return m_settings.value("Display/BORDER_GESTURE_WIDTH", 0.1).toFloat();
}

int DeviceInfo::flatTireHeight()
int DeviceSpecs::flatTireHeight()
{
return m_settings.value("Display/FLAT_TIRE", 0).toInt();
}

bool DeviceInfo::needsBurnInProtection()
bool DeviceSpecs::needsBurnInProtection()
{
return m_settings.value("Display/NEEDS_BURN_IN_PROTECTION", true).toBool();
}

bool DeviceInfo::hasWlan()
bool DeviceSpecs::hasWlan()
{
return m_settings.value("Capabilities/HAS_WLAN", false).toBool();
}

bool DeviceInfo::hasSpeaker()
bool DeviceSpecs::hasSpeaker()
{
return m_settings.value("Capabilities/HAS_SPEAKER", false).toBool();
}

QString DeviceInfo::hostname() const
QString DeviceSpecs::hostname() const
{
return m_hostname;
}

QString DeviceInfo::machineName() const
QString DeviceSpecs::machineName() const
{
return m_settings.value("Identity/MACHINE", "unknown").toString();
}

QString DeviceInfo::buildID() const
QString DeviceSpecs::buildID() const
{
return m_buildid;
}
8 changes: 4 additions & 4 deletions src/utils/src/deviceinfo.h → src/utils/src/devicespecs.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
#include <QQmlEngine>
#include <QSettings>

class DeviceInfo : public QObject
class DeviceSpecs : public QObject
{
Q_OBJECT
Q_DISABLE_COPY(DeviceInfo)
Q_DISABLE_COPY(DeviceSpecs)
Q_PROPERTY(bool hasRoundScreen READ hasRoundScreen CONSTANT)
Q_PROPERTY(double borderGestureWidth READ borderGestureWidth CONSTANT)
Q_PROPERTY(int flatTireHeight READ flatTireHeight CONSTANT)
Expand All @@ -36,14 +36,14 @@ class DeviceInfo : public QObject
Q_PROPERTY(QString hostname READ hostname CONSTANT)
Q_PROPERTY(QString machineName READ machineName CONSTANT)
Q_PROPERTY(QString buildID READ buildID CONSTANT)
DeviceInfo();
DeviceSpecs();
public:
static QObject *qmlInstance(QQmlEngine *engine, QJSEngine *scriptEngine)
{
Q_UNUSED(engine);
Q_UNUSED(scriptEngine);

return new DeviceInfo;
return new DeviceSpecs;
}
bool hasRoundScreen();
double borderGestureWidth();
Expand Down
4 changes: 2 additions & 2 deletions src/utils/src/utils_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "utils_plugin.h"
#include <QtQml>
#include "bluetoothstatus.h"
#include "deviceinfo.h"
#include "devicespecs.h"
#include "fileinfo.h"

UtilsPlugin::UtilsPlugin(QObject *parent) : QQmlExtensionPlugin(parent)
Expand All @@ -29,7 +29,7 @@ void UtilsPlugin::registerTypes(const char *uri)
{
Q_ASSERT(uri == QLatin1String("org.asteroid.utils"));

qmlRegisterSingletonType<DeviceInfo>(uri, 1,0, "DeviceInfo", &DeviceInfo::qmlInstance);
qmlRegisterSingletonType<DeviceSpecs>(uri, 1,0, "DeviceInfo", &DeviceInfo::qmlInstance);
qmlRegisterSingletonType<FileInfo>(uri, 1, 0, "FileInfo", &FileInfo::qmlInstance);
qmlRegisterType<BluetoothStatus>(uri, 1, 0, "BluetoothStatus");
}
Expand Down