mirror of https://github.com/Qortal/Brooklyn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
813 B
29 lines
813 B
/* |
|
SPDX-FileCopyrightText: 2018 Kai Uwe Broulik <[email protected]> |
|
|
|
SPDX-License-Identifier: LGPL-2.1-or-later |
|
*/ |
|
|
|
#include "utils.h" |
|
|
|
int Utils::treeStructureToInt(int subscription, int section, int index) |
|
{ |
|
return subscription * 1000000 + section * 1000 + index; |
|
} |
|
|
|
void Utils::intToTreeStructure(int source, int &subscription, int §ion, int &index) |
|
{ |
|
// TODO some better math :) or bit shifting or something |
|
index = source % 1000; |
|
section = (source / 1000) % 1000; |
|
subscription = source / 1000000; |
|
} |
|
|
|
QString Utils::itemActionName(const QVariantMap &item) |
|
{ |
|
QString actionName = item.value(QStringLiteral("action")).toString(); |
|
if (actionName.isEmpty()) { |
|
actionName = item.value(QStringLiteral("submenu-action")).toString(); |
|
} |
|
return actionName; |
|
}
|
|
|