mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-21 11:54:15 +01:00
Uncrustify
This commit is contained in:
parent
b5b48d3bf0
commit
1cfc7f1586
@ -43,19 +43,18 @@ using namespace Core;
|
||||
using namespace Core::Internal;
|
||||
|
||||
namespace {
|
||||
|
||||
struct PageData {
|
||||
struct PageData {
|
||||
int index;
|
||||
QString category;
|
||||
QString id;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
// helper to sort by translated category and name
|
||||
bool compareOptionsPageByCategoryAndNameTr(const IOptionsPage *p1, const IOptionsPage *p2)
|
||||
{
|
||||
// helper to sort by translated category and name
|
||||
bool compareOptionsPageByCategoryAndNameTr(const IOptionsPage *p1, const IOptionsPage *p2)
|
||||
{
|
||||
const UAVGadgetOptionsPageDecorator *gp1 = qobject_cast<const UAVGadgetOptionsPageDecorator *>(p1);
|
||||
const UAVGadgetOptionsPageDecorator *gp2 = qobject_cast<const UAVGadgetOptionsPageDecorator *>(p2);
|
||||
|
||||
if (gp1 && !gp2) {
|
||||
return false;
|
||||
}
|
||||
@ -66,13 +65,14 @@ namespace {
|
||||
return cc < 0;
|
||||
}
|
||||
return QString::localeAwareCompare(p1->trName(), p2->trName()) < 0;
|
||||
}
|
||||
}
|
||||
|
||||
// helper to sort by category and id
|
||||
bool compareOptionsPageByCategoryAndId(const IOptionsPage *p1, const IOptionsPage *p2)
|
||||
{
|
||||
// helper to sort by category and id
|
||||
bool compareOptionsPageByCategoryAndId(const IOptionsPage *p1, const IOptionsPage *p2)
|
||||
{
|
||||
const UAVGadgetOptionsPageDecorator *gp1 = qobject_cast<const UAVGadgetOptionsPageDecorator *>(p1);
|
||||
const UAVGadgetOptionsPageDecorator *gp2 = qobject_cast<const UAVGadgetOptionsPageDecorator *>(p2);
|
||||
|
||||
if (gp1 && !gp2) {
|
||||
return false;
|
||||
}
|
||||
@ -83,13 +83,10 @@ namespace {
|
||||
return cc < 0;
|
||||
}
|
||||
return QString::localeAwareCompare(p1->id(), p2->id()) < 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(::PageData)
|
||||
|
||||
SettingsDialog::SettingsDialog(QWidget *parent, const QString &categoryId, const QString &pageId) :
|
||||
Q_DECLARE_METATYPE(::PageData) SettingsDialog::SettingsDialog(QWidget *parent, const QString &categoryId, const QString &pageId) :
|
||||
QDialog(parent), m_applied(false)
|
||||
{
|
||||
setupUi(this);
|
||||
@ -129,8 +126,7 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &categoryId, const
|
||||
QList<int> sizes;
|
||||
if (size0 > 0 && size1 > 0) {
|
||||
sizes << size0 << size1;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sizes << 150 << 300;
|
||||
}
|
||||
splitter->setSizes(sizes);
|
||||
@ -164,7 +160,7 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &categoryId, const
|
||||
|
||||
// get all pages and split them between plugin and gadget list
|
||||
QList<Core::IOptionsPage *> pages = ExtensionSystem::PluginManager::instance()->getObjects<IOptionsPage>();
|
||||
foreach(IOptionsPage *page, pages) {
|
||||
foreach(IOptionsPage * page, pages) {
|
||||
if (qobject_cast<UAVGadgetOptionsPageDecorator *>(page)) {
|
||||
gadgetPages.append(page);
|
||||
} else {
|
||||
@ -182,10 +178,11 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &categoryId, const
|
||||
QTreeWidgetItem *initialItem = 0;
|
||||
|
||||
// add plugin pages
|
||||
foreach(IOptionsPage *page, pluginPages) {
|
||||
foreach(IOptionsPage * page, pluginPages) {
|
||||
QTreeWidgetItem *item = addPage(page);
|
||||
|
||||
// to automatically expand all plugin categories, uncomment next line
|
||||
//item->parent()->setExpanded(true);
|
||||
// item->parent()->setExpanded(true);
|
||||
if (page->id() == initialPage && page->category() == initialCategory) {
|
||||
initialItem = item;
|
||||
}
|
||||
@ -197,8 +194,9 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &categoryId, const
|
||||
separator->setText(0, QString(30, 0xB7));
|
||||
|
||||
// add gadget pages
|
||||
foreach(IOptionsPage *page, gadgetPages) {
|
||||
foreach(IOptionsPage * page, gadgetPages) {
|
||||
QTreeWidgetItem *item = addPage(page);
|
||||
|
||||
if (page->id() == initialPage && page->category() == initialCategory) {
|
||||
initialItem = item;
|
||||
}
|
||||
@ -213,7 +211,6 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &categoryId, const
|
||||
}
|
||||
pageTree->setCurrentItem(initialItem);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SettingsDialog::~SettingsDialog()
|
||||
@ -231,8 +228,10 @@ SettingsDialog::~SettingsDialog()
|
||||
}
|
||||
}
|
||||
|
||||
QTreeWidgetItem *SettingsDialog::addPage(IOptionsPage *page) {
|
||||
QTreeWidgetItem *SettingsDialog::addPage(IOptionsPage *page)
|
||||
{
|
||||
PageData pageData;
|
||||
|
||||
pageData.index = m_pages.count();
|
||||
pageData.category = page->category();
|
||||
pageData.id = page->id();
|
||||
@ -452,6 +451,7 @@ bool SettingsDialog::execDialog()
|
||||
void SettingsDialog::done(int val)
|
||||
{
|
||||
QSettings *settings = ICore::instance()->settings();
|
||||
|
||||
settings->beginGroup("General");
|
||||
|
||||
settings->setValue("LastPreferenceCategory", m_currentCategory);
|
||||
|
@ -36,11 +36,9 @@
|
||||
#include "coreplugin/dialogs/ioptionspage.h"
|
||||
|
||||
namespace Core {
|
||||
|
||||
class UAVGadgetInstanceManager;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class SettingsDialog : public QDialog, public::Ui::SettingsDialog {
|
||||
Q_OBJECT
|
||||
|
||||
@ -80,9 +78,7 @@ private:
|
||||
|
||||
QTreeWidgetItem *addPage(IOptionsPage *page);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
} // namespace Core
|
||||
|
||||
#endif // SETTINGSDIALOG_H
|
||||
|
@ -132,7 +132,7 @@ int opHID_hidapi::open(int max, int vid, int pid, int usage_page, int usage)
|
||||
int devices_found = false;
|
||||
struct hid_device_info *current_device_ptr = NULL;
|
||||
struct hid_device_info *tmp_device_ptr = NULL;
|
||||
struct hid_device_info **current_device_pptr = ¤t_device_ptr;
|
||||
struct hid_device_info * *current_device_pptr = ¤t_device_ptr;
|
||||
|
||||
OPHID_TRACE("IN");
|
||||
|
||||
@ -170,7 +170,6 @@ int opHID_hidapi::open(int max, int vid, int pid, int usage_page, int usage)
|
||||
}
|
||||
|
||||
if (devices_found) {
|
||||
|
||||
devices_found = 0;
|
||||
|
||||
// Go through the list until we can open one
|
||||
@ -178,7 +177,6 @@ int opHID_hidapi::open(int max, int vid, int pid, int usage_page, int usage)
|
||||
tmp_device_ptr = current_device_ptr;
|
||||
|
||||
while (tmp_device_ptr) {
|
||||
|
||||
OPHID_DEBUG("Opening device VID(%04hx).PID(%04hx)",
|
||||
tmp_device_ptr->vendor_id,
|
||||
tmp_device_ptr->product_id);
|
||||
|
@ -70,10 +70,10 @@ void USBMonitor::deviceEventReceived()
|
||||
|
||||
dev = udev_monitor_receive_device(this->monitor);
|
||||
if (dev) {
|
||||
//this->monitorNotifier->setEnabled(0);
|
||||
// this->monitorNotifier->setEnabled(0);
|
||||
QString action = QString(udev_device_get_action(dev));
|
||||
QString devtype = QString(udev_device_get_devtype(dev));
|
||||
qDebug() << "[DEBUG] Action: " << action << " device: " <<devtype;
|
||||
qDebug() << "[DEBUG] Action: " << action << " device: " << devtype;
|
||||
if (action == "add" && devtype == "usb_device") {
|
||||
printPortInfo(dev);
|
||||
emit deviceDiscovered(makePortInfo(dev));
|
||||
@ -83,7 +83,7 @@ void USBMonitor::deviceEventReceived()
|
||||
}
|
||||
|
||||
udev_device_unref(dev);
|
||||
//this->monitorNotifier->setEnabled(1);
|
||||
// this->monitorNotifier->setEnabled(1);
|
||||
} else {
|
||||
OPHID_ERROR("No Device event from udev. Spurious event?.");
|
||||
}
|
||||
@ -123,7 +123,7 @@ USBMonitor::USBMonitor(QObject *parent) : QThread(parent)
|
||||
this->monitor = udev_monitor_new_from_netlink(this->context, "udev");
|
||||
udev_monitor_filter_add_match_subsystem_devtype(
|
||||
this->monitor, "usb", NULL);
|
||||
//udev_monitor_filter_add_match_tag(this->monitor, "openpilot");
|
||||
// udev_monitor_filter_add_match_tag(this->monitor, "openpilot");
|
||||
udev_monitor_enable_receiving(this->monitor);
|
||||
this->monitorNotifier = new QSocketNotifier(
|
||||
udev_monitor_get_fd(this->monitor), QSocketNotifier::Read, this);
|
||||
@ -168,7 +168,7 @@ QList<USBPortInfo> USBMonitor::availableDevices()
|
||||
|
||||
enumerate = udev_enumerate_new(this->context);
|
||||
udev_enumerate_add_match_subsystem(enumerate, "usb");
|
||||
//udev_enumerate_add_match_tag(enumerate, "openpilot");
|
||||
// udev_enumerate_add_match_tag(enumerate, "openpilot");
|
||||
udev_enumerate_add_match_sysattr(enumerate, "idVendor", "20a0");
|
||||
udev_enumerate_scan_devices(enumerate);
|
||||
devices = udev_enumerate_get_list_entry(enumerate);
|
||||
|
@ -61,7 +61,6 @@ void USBMonitor::deviceEventReceived()
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Get the instance of the USBMONITOR
|
||||
*
|
||||
@ -246,7 +245,7 @@ bool USBMonitor::matchAndDispatchChangedDevice(const QString & deviceID, const G
|
||||
qDebug() << "[STATUS CHANGE] from device ID: " << deviceID;
|
||||
bool rc;
|
||||
SP_DEVINFO_DATA spDevInfoData;
|
||||
DWORD dwFlag = (DBT_DEVICEARRIVAL == wParam) ? DIGCF_PRESENT : 0/*DIGCF_ALLCLASSES*/;
|
||||
DWORD dwFlag = (DBT_DEVICEARRIVAL == wParam) ? DIGCF_PRESENT : 0 /*DIGCF_ALLCLASSES*/;
|
||||
HDEVINFO devInfo;
|
||||
|
||||
devInfo = SetupDiGetClassDevs(&guid, NULL, NULL, dwFlag | DIGCF_DEVICEINTERFACE);
|
||||
@ -316,8 +315,8 @@ bool USBMonitor::matchAndDispatchChangedDevice(const QString & deviceID, const G
|
||||
* \return QList
|
||||
* \retval List of handled devices
|
||||
*/
|
||||
QList<USBPortInfo> USBMonitor::availableDevices() {
|
||||
|
||||
QList<USBPortInfo> USBMonitor::availableDevices()
|
||||
{
|
||||
enumerateDevicesWin(guid_hid);
|
||||
return knowndevices;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user