コード例 #1
0
int NetScanningController::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: newData((*reinterpret_cast< const QList<Device*>(*)>(_a[1]))); break;
        case 1: infInformation((*reinterpret_cast< SVT_NotifyType(*)>(_a[1]))); break;
        case 2: deviceCountChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 3: newDeviceNotify((*reinterpret_cast< SVT_NotifyType(*)>(_a[1]))); break;
        case 4: routerTypeChanged(); break;
        case 5: gatewayChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 6: onNewData((*reinterpret_cast< SVT_NotifyType(*)>(_a[1]))); break;
        case 7: onInfInformation((*reinterpret_cast< SVT_NotifyType(*)>(_a[1]))); break;
        case 8: onCountChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 9: onNode2Device((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< Device*(*)>(_a[2]))); break;
        case 10: onDeviceDataChanged((*reinterpret_cast< const Device(*)>(_a[1]))); break;
        case 11: onRefresh(); break;
        case 12: onSubscribeData((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break;
        case 13: startScan(); break;
        default: ;
        }
        _id -= 14;
    }
    return _id;
}
コード例 #2
0
ファイル: lefthandmenu.cpp プロジェクト: timsee/Corluma
LeftHandMenu::LeftHandMenu(cor::DeviceList *devices, CommLayer *comm, GroupData *groups, QWidget *parent) : QWidget(parent) {
    mNumberOfShownLights = 0;
    mLastScrollValue = 0;
    mAlwaysOpen = false;
    mSelectedLights = devices;
    mComm = comm;
    mGroups = groups;
    mParentSize = parent->size();
    auto width = int(mParentSize.width() * 0.66f);
    this->setGeometry(width * -1,
                      0,
                      width,
                      parent->height());
    mIsIn = false;
    mNumberOfRooms = 0;

    mSpacer = new QWidget(this);
    mSpacer->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    mSpacer->setStyleSheet("border: none; background-color:rgb(33,32,32);");

    mWidget = new QWidget(this);
    mWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    mWidget->setStyleSheet("border: none; background-color:rgba(0,0,0,0);");

    mScrollArea = new QScrollArea(this);
    mScrollArea->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    QScroller::grabGesture(mScrollArea->viewport(), QScroller::LeftMouseButtonGesture);
    mScrollArea->setWidget(mWidget);
    mScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    mScrollArea->horizontalScrollBar()->setEnabled(false);


    // --------------
    // Setup Main Palette
    // -------------
    mMainPalette = new cor::LightVectorWidget(6, 2, true, this);
    mMainPalette->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    mMainPalette->setFixedHeight(this->height() * 0.1);
    mMainPalette->setStyleSheet("background-color:rgb(33,32,32);");

    //---------------
    // Setup Buttons
    //---------------

    mSingleColorButton = new LeftHandButton("Single Color", EPage::colorPage, ":/images/colorWheel_icon.png", this, this);
    mSingleColorButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    connect(mSingleColorButton, SIGNAL(pressed(EPage)), this, SLOT(buttonPressed(EPage)));
    mSingleColorButton->shouldHightlght(true);

    mSettingsButton = new LeftHandButton("Settings", EPage::settingsPage, ":/images/settingsgear.png", this, this);
    mSettingsButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    connect(mSettingsButton, SIGNAL(pressed(EPage)), this, SLOT(buttonPressed(EPage)));

    PresetPalettes palettes;
    cor::Light light;
    light.routine = ERoutine::multiBars;
    light.palette = palettes.palette(EPalette::water);
    light.speed   = 100;
    mMultiColorButton = new LeftHandButton("Multi Color", EPage::palettePage, cor::lightToJson(light), this, this);
    mMultiColorButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    connect(mMultiColorButton, SIGNAL(pressed(EPage)), this, SLOT(buttonPressed(EPage)));

    cor::Light moodLight;
    moodLight.routine = ERoutine::multiFade;
    moodLight.palette = palettes.palette(EPalette::fire);
    moodLight.speed   = 100;
    mMoodButton = new LeftHandButton("Moods", EPage::moodPage, cor::lightToJson(moodLight), this, this);
    mMoodButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    connect(mMoodButton, SIGNAL(pressed(EPage)), this, SLOT(buttonPressed(EPage)));

    mNewGroupButton = new AddNewGroupButton(mWidget);
    mNewGroupButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    connect(mNewGroupButton, SIGNAL(pressed()), this, SLOT(newGroupButtonPressed()));

    mRenderThread = new QTimer(this);
    connect(mRenderThread, SIGNAL(timeout()), this, SLOT(renderUI()));

    connect(this, SIGNAL(changedDeviceCount()), this, SLOT(deviceCountChanged()));
}