Exemplo n.º 1
0
wyButton::wyButton(wyNode* normal, wyNode* selected, wyNode* disabled, wyNode* focused, wyTargetSelector* downSelector, wyTargetSelector* upSelector) :
		m_clickScale(1.f),
		m_originalScale(0.f),
		m_normalState(NULL),
		m_selectedState(NULL),
		m_disabledState(NULL),
		m_focusedState(NULL) {
	setNormalState(normal);
	setSelectedState(selected);
	setDisabledState(disabled);
	setFocusedState(focused);
	setDownSelector(downSelector);
	setUpSelector(upSelector);

	float width = 0;
	float height = 0;
	if (normal != NULL) {
		width = normal->getWidth();
		height = normal->getHeight();
	}

	if (selected != NULL) {
		width = MAX(selected->getWidth(), width);
		height = MAX(selected->getHeight(), height);
	}

	if (disabled != NULL) {
		width = MAX(disabled->getWidth(), width);
		height = MAX(disabled->getHeight(), height);
	}
	if (focused != NULL) {
		width = MAX(focused->getWidth(), width);
		height = MAX(focused->getHeight(), height);
	}
	setContentSize(width, height);
	setTouchEnabled(true);
}
void RackWindow::createToolBars()
{
    //main toolbar actions:
    QAction *fullscreenAct = new QAction(tr("Fullscreen"), this);
    fullscreenAct->setCheckable(true);
    QAction *enterSettingsAct = new QAction(tr("Change Widget Layout"), this);
    QAction *quitAct = new QAction(tr("Quit"), this);

    //main toolbar menus:
    QMenu *mainMenu = new QMenu(this);
    mainMenu->setObjectName("rackMainMenu");
    QAction *titleAct = new QAction(tr("R.A.C.K."),this);
    titleAct->setDisabled(true);
    mainMenu->addAction(titleAct);
    mainMenu->setDefaultAction(titleAct);
    mainMenu->addAction(fullscreenAct);
    mainMenu->addAction(enterSettingsAct);
    mainMenu->addAction(quitAct);

    //main toolbar buttons:
    RPushButton *settingsButton = new RPushButton(tr("Menu"));
    settingsButton->setObjectName("rackSettingsButton");
    settingsButton->setMenu(mainMenu);
    RBlinkButton *deleteButton = new RBlinkButton(tr("Delete"));
    deleteButton->setObjectName("rackDeleteButton");
    RBlinkButton *previewButton = new RBlinkButton(tr("Preview"));
    previewButton->setObjectName("rackPreviewButton");

    //main toolbar:
    QToolBar *mainToolBar = new QToolBar;
    mainToolBar->setObjectName("rackMainToolBar");
    mainToolBar->setMovable(false);
    mainToolBar->addWidget(settingsButton);
    mainToolBar->addWidget(deleteButton);
    mainToolBar->addWidget(previewButton);

    //delete state:
    QObject::connect(deleteButton, SIGNAL(clicked()), m_coreImpl, SLOT(toggleDeleteState()));
    QObject::connect(m_coreImpl, SIGNAL(deleteStateChanged(bool)), deleteButton, SLOT(setBlinking(bool)));

    //preview state:
    QObject::connect(previewButton, SIGNAL(clicked()), m_coreImpl, SLOT(togglePreviewState()));
    QObject::connect(m_coreImpl, SIGNAL(previewStateChanged(bool)), previewButton, SLOT(setBlinking(bool)));

    //normal state:
    QObject::connect(this, SIGNAL(enterSettingsMode()), m_coreImpl, SLOT(setNormalState()));

    //main toolbar signals & slots:
    QObject::connect(fullscreenAct, SIGNAL(triggered(bool)), this, SLOT(toggleFullscreen()));
    QObject::connect(enterSettingsAct, SIGNAL(triggered()), SIGNAL(enterSettingsMode()));
    QObject::connect(quitAct, SIGNAL(triggered()), this, SLOT(close()));
    QObject::connect(this, SIGNAL(enterSettingsMode()), mainToolBar, SLOT(hide()));
    QObject::connect(this, SIGNAL(leaveSettingsMode()), mainToolBar, SLOT(show()));





    /////////////////////////save tests
    QAction *saveAct = new QAction(tr("Save"), this);
    mainMenu->addAction(saveAct);
    QObject::connect(saveAct, SIGNAL(triggered()), this, SLOT(savePluginHosts()));
    ////////////////////////////


    /////////////////////////style sheet load
    QAction *styleAct = new QAction(tr("Load Style Sheet"), this);
    mainMenu->addAction(styleAct);
    QObject::connect(styleAct, SIGNAL(triggered()), this, SLOT(openStyleSheet()));
    ////////////////////////////

    /////////////////////////style sheet reload
    QAction *restyleAct = new QAction(tr("Reload Style Sheet"), this);
    mainMenu->addAction(restyleAct);
    QObject::connect(restyleAct, SIGNAL(triggered()), this, SLOT(loadStyleSheet()));
    ////////////////////////////


    //settings toolbar buttons:
    RPushButton *settingsOKButton = new RPushButton(tr("OK"));
    settingsOKButton->setObjectName("rackSettingsOKButton");

    RPushButton *settingsCancelButton = new RPushButton(tr("Cancel"));
    settingsCancelButton->setObjectName("rackSettingsCancelButton");

    //settings toolbar:
    QToolBar *settingsToolBar = new QToolBar;
    settingsToolBar->setObjectName("rackSettingsToolBar");
    settingsToolBar->setMovable(false);
    settingsToolBar->addWidget(settingsOKButton);
    settingsToolBar->addWidget(settingsCancelButton);

    //settings toolbar signals & slots:
    QObject::connect(settingsOKButton, SIGNAL(clicked()), SIGNAL(leaveSettingsMode()));
    QObject::connect(this, SIGNAL(enterSettingsMode()), settingsToolBar, SLOT(show()));
    QObject::connect(this, SIGNAL(leaveSettingsMode()), settingsToolBar, SLOT(hide()));

    //add toolbars to mainwindow:
    addToolBar(Qt::BottomToolBarArea, mainToolBar);
    addToolBar(Qt::BottomToolBarArea, settingsToolBar);
}
Exemplo n.º 3
0
void    sys_init()
{
//   char str[32];
//   unsigned long ul;
//   struct LogEntry entry;
   struct NodeCfg ncfg;
   unsigned long long _ull;
   
   FILEDESCR_t fd;
   int err;
   static struct child c = {BAD_ADDRESS, 0};
   
//   msg_count       = 0;
//   last_msg_pos    = 0;
   total_msg_count = 0;

   for(err = MAX_CHILDREN; err--; )
      memcopy(&children[err], &c, sizeof(struct child));
   //memset(zone_state, 0, sizeof(zone_state));
   for(err = STRG_MAX_ZONE_NUM; err--;)
      zone_state[err] = ZONE_STATE_ON;

   init_LEDs();
   setNormalState();
   //switchOnLED(LED_RED);
//   scroll_pos      = 0;
//   port_attr_t p4;

//   event_emit(0, INIT_EVT, 0);

   /*
   PIN_SET(p4.dir, 0x19, PIN_HI);
   PIN_CLEAR(p4.sel, 0x19);
   port_set_attr(4, 0x19, &p4);
   port_write(4, 0x19, PIN_HI);
   p4_val = 0x01;
   */
  
//   SPI_init();
//   err = initStorage();
//   OLED_init();
//   init_kbrd();
//   menu_init(0);
//   OLED_clr(68, 3*9, 2 * 6, 9);
//   err = mmcReadBlock(23, 3, &ul);

   //err = logEntriesNum();
   //err = logAddEntry(&entry, "Test message3");
   //err = strgFindNode(0x66ULL, &ncfg);
   //itoa(err, fd.filename, 10);
   //OLED_puts(0, 0, 0xff, font6x9, fd.filename);
   //out_dump (0, 50, sizeof(struct NodeCfg), &ncfg);
   /*
   strcpy(str, "Pos: ");
   ul = logstat.last_entry_pos;
   //ul = (unsigned long)syscfg.log_state_pos << 9;
   ultoa(ul, str + strlen(str), 10);
   str[strlen(str) + 1] = 0;
   str[strlen(str)]     = ' ';
   ul = syscfg.log_state_pos;
   ultoa(ul, str + strlen(str), 10);

   OLED_puts(0, 0, 0xff, font6x9, str);
   */

//   init_FAT();
//   Read_PBR();
//   ultoa(fat.root_dir, fd.filename, 16);
//   OLED_puts(17 * 6, 50, 0xff, font6x9, fd.filename);
/*
   strcpy(fd.filename, "LOG     ");
   if(FindFile(fat.root_dir, &fd) != FAT_SUCCESS)
      OLED_puts(0, 50, 0xff, font6x9, "FindFile failed");
   else
   {
      itoa(fd.clust, fd.filename, 16);
      OLED_puts(0, 50, 0xff, font6x9, fd.filename);
      ultoa(fd.size, fd.filename, 16);
      OLED_puts(10 * 6, 50, 0xff, font6x9, fd.filename);
   }
*/

   event_emit(LOW_PRIORITY, INIT_EVT, 0);

//   stimer_set(1, 1000);
//
               
    return;
}