MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    setSizePolicy(
                QSizePolicy(
                    QSizePolicy::MinimumExpanding,
                    QSizePolicy::MinimumExpanding));
    setMinimumSize(100, 100);
    setContentsMargins(0, 0, 0, 5);
    setWindowTitle("Qt VirtManager");
    QIcon::setThemeName("QtVirtManager");
    setWindowIcon(QIcon::fromTheme("virtual-engineering"));
    setMouseTracking(true);
    setDockOptions(
                QMainWindow::AnimatedDocks |
                QMainWindow::ForceTabbedDocks);
    restoreGeometry(settings.value("Geometry").toByteArray());
    initTaskWareHouse();
    initDomainStateMonitor();
    initTrayIcon();
    initConnListWidget();
    initToolBar();
    initDockWidgets();
    restoreState(settings.value("State").toByteArray());
    this->setVisible(!settings.value("Visible", false).toBool());
    changeVisibility();
    waitAtClose = settings.value("WaitAtClose", 180).toInt();
    closeProgress = new QProgressBar(this);
    closeProgress->setRange(0, waitAtClose*1000);
    closeProgress->setToolTip("Progress for waiting the connection close");
    statusBar()->addPermanentWidget(closeProgress);
    statusBar()->hide();
    initVirEventloop();
}
Beispiel #2
0
QMenu *
ViewLightGL::createToolsMenu(QWidget * parent)
{
	QMenu * menu = new QMenu(parent);
    QPixmap home(ViewerIcon::getPixmap(ViewerIcon::home));
    QPixmap _light(ViewerIcon::getPixmap(ViewerIcon::light));
	menu->addAction(home,tr("&Home"),this,SLOT(home()),Qt::CTRL+Qt::SHIFT+Qt::Key_H);
    menu->addAction(tr("on X axis"),this,SLOT(XAxis()),Qt::CTRL+Qt::SHIFT+Qt::Key_X);
    menu->addAction(tr("on Y axis"),this,SLOT(YAxis()),Qt::CTRL+Qt::SHIFT+Qt::Key_Y);
    menu->addAction(tr("on Z axis"),this,SLOT(ZAxis()),Qt::CTRL+Qt::SHIFT+Qt::Key_Z);
    menu->addSeparator();
    QAction * idVisibility = menu->addAction(_light,tr("Visible"),this,SLOT(changeVisibility()),Qt::CTRL+Qt::SHIFT+Qt::Key_S);
    idVisibility->setCheckable( TRUE );
    idVisibility->setChecked( isVisible() );
    QObject::connect(this,SIGNAL(visibilityChanged( bool)),idVisibility,SLOT(setChecked(bool)));
    menu->addSeparator();
    QAction * idLight = menu->addAction(_light,     tr("&Enabled"),     this, SLOT(toggleEnabled()));
	idLight->setCheckable(true);
	idLight->setChecked(isEnabled());
    idLight->setWhatsThis(tr("<b>Light Rendering</b><br><br>"
	"Set <b>Light Rendering</b> enable/disable.<br><br>"
	"The Rendering will (not) take into account ligth source.<br><br>"
	"You can also use Menu <br><b>Tools > Renderer > Light</b><br>"));
	return menu;
}
Beispiel #3
0
void eaps8000UsbWindow::connectUiElements()
{
    connect( _ui->btn_emergencyStop, SIGNAL( clicked() ), this,
             SLOT( emergencyStop() ) );
    connect( _ui->cob_measuredValues, SIGNAL( currentTextChanged( QString ) ),
             this, SLOT( visibilitySelectionChanged() ) );
    connect( _ui->cob_setValue, SIGNAL( currentTextChanged( QString ) ), this,
             SLOT( setValueSelectionChanged() ) );
    connect( _ui->cob_setValueUnit, SIGNAL( currentTextChanged( QString ) ),
             this, SLOT( updateUnitRange() ) );

    connect( _ui->btn_connect, SIGNAL( clicked() ), this,
             SLOT( connectivityButtonPressed() ) );
    connect( _ui->btn_setValue, SIGNAL( clicked() ), this, SLOT( setValue() ) );
    connect( _ui->btn_measuredValuesVisibility, SIGNAL( clicked() ), this,
             SLOT( changeVisibility() ) );
    connect( _ui->btn_resetInfo, SIGNAL( clicked() ), this,
             SLOT( resetInfo() ) );
}
Beispiel #4
0
///Override the visibility toggler
void TranslucentButtons::setVisible(bool enabled)
{
   kDebug() << "Enabling!";
   if (m_enabled != enabled) {
      if (m_pTimer) {
         m_pTimer->stop();
         disconnect(m_pTimer);
      }
      m_pTimer = new QTimer(this); //TODO LEAK
      connect(m_pTimer, SIGNAL(timeout()), this, SLOT(changeVisibility()));
      m_step = 0;
      m_CurrentColor = "black";
      m_CurrentColor.setAlpha(0);
      repaint();
      m_pTimer->start(10);
      raise();
   }
   m_enabled = enabled;
   QWidget::setVisible(enabled);
}
///How to paint
void DelegateDropOverlay::paintEvent(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index)
{
   if (!m_lpButtons)
      return;
   static bool initSignals = false;
   if (!initSignals) {
      connect(index.model(),SIGNAL(layoutChanged()),this,SLOT(slotLayoutChanged()));
      initSignals = true;
   }
   int step = index.data(ContactModel::Role::DropState).toInt();
   if ((step == 1 || step == -1) && m_lActiveIndexes.indexOf(index) == -1) {
      m_lActiveIndexes << index;
      //Create tge timer
      if (!m_pTimer) {
         m_pTimer = new QTimer(this);
         connect(m_pTimer, SIGNAL(timeout()), this, SLOT(changeVisibility()));
      }

      //Start it if it's nor already
      if (!m_pTimer->isActive()) {
         m_pTimer->start(10);
      }
   }
   int i =0;
   QMapIterator<QString, OverlayButton*> it(*m_lpButtons);
   const int dropPosition = index.data(Call::Role::DropPosition).toInt();
   while (it.hasNext()) {
      it.next();
      if (step) {
         const bool highlight = dropPosition == it.value()->role;
         const int tmpStep = (step>0)?step:15+step;
         painter->save();
         painter->setOpacity(1);
         painter->setRenderHint(QPainter::Antialiasing, true);
         QPen pen = highlight?QApplication::palette().color(QPalette::Highlight): QColor(235,235,235,235);
         pen.setWidth(1);
         painter->setPen(pen);
         QLinearGradient linearGrad(QPointF(0, 0), QPointF(0, 100));
         linearGrad.setColorAt(0, QColor(130,130,130,(0.7*tmpStep*tmpStep)));
         linearGrad.setColorAt(1, QColor(0,0,0,(0.75*tmpStep*tmpStep)));
         painter->setBrush(linearGrad);
         const QRect buttonRect = QRect(
            option.rect.x()+(option.rect.width()/m_lpButtons->size())*i+4,
            option.rect.y()+2,
            option.rect.width()/m_lpButtons->size() - 10,
            option.rect.height()-4);
         painter->drawRoundedRect(buttonRect, 10, 10);
         painter->setPen(highlight?QColor(Qt::white):m_Pen);

         if (it.value()->m_pImage) {
            painter->drawImage(QRect(
               buttonRect.x()+buttonRect.width()-(buttonRect.height()-10)-10/*padding*/,
               buttonRect.y()+5,
               (buttonRect.height()-10),
               (buttonRect.height()-10)),*it.value()->m_pImage);
         }

         QFont font = painter->font();
         font.setBold(true);
         painter->setFont(font);
         painter->drawText (buttonRect, Qt::AlignVCenter|Qt::AlignHCenter, QString(it.key()).remove('&') );
         painter->restore();
         i++;

         if (highlight) {
            QColor col = pen.color();
            for(int i=1;i<=4;i++) {
               painter->setBrush(Qt::NoBrush);
               pen.setWidth(i);
               col.setAlpha(205*(0.5/((float)i)));
               pen.setColor(col);
               painter->setPen(pen);
               painter->drawRoundedRect(buttonRect, 10, 10);
            }
         }
      }
   }
}//paintEvent
Beispiel #6
0
void init(void) {
	// Clear screen
	PORTA = 0xff;
	for(uint8_t i=0;i<8;i++)
	{
		PORTB = (0x01 << i);
		PORTA = 0xff;
		_delay_ms(5);
		PORTB = 0x00;
	}
	for(uint8_t i=0;i<8;i++)
	{
		PORTD = (0x01<<i);
		PORTA = 0xff;
		_delay_ms(5);
		PORTD = 0x00;
	}
	// Clear out displayList
	for (uint8_t i = 0; i < 8; i++) {
		displayList[i] = NULL;
	}

	localBuffer = (char*) malloc(256 * sizeof(char));

	// Init patterns and fonts.
	// Pattern list contains all the patterns on the chip. Add image uses this to look up pattern memory locations.
	initPattern(&commencement, 32, 120, COMMENCEMENT);
	patternList[0] = &commencement;
	initPattern(&congrats, 32, 120, CONGRATS);
	patternList[1] = &congrats;
	initPattern(&dearmichelle, 32, 120, DEARMICHELLE);
	patternList[2] = &dearmichelle;
	initPattern(&gobobcats, 32, 120, GOBOBCATS);
	patternList[3] = &gobobcats;
	initPattern(&ns, 32, 120, NS);
	patternList[4] = &ns;
	initPattern(&soe, 32, 120, SOE);
	patternList[5] = &soe;
	initPattern(&ssha, 32, 120, SSHA);
	patternList[6] = &ssha;
	initPattern(&ucmlogo, 32, 120, UCMLOGO);
	patternList[7] = &ucmlogo;
	initPattern(&welcome, 32, 120, WELCOME);
	patternList[8] = &welcome;
	initPattern(&welcomemichelle, 32, 120, WELCOMEMICHELLE);
	patternList[9] = &welcomemichelle;
	initPattern(&ucmerced, 32, 192, UCMERCED);
	patternList[10] = &ucmerced;
	initPattern(&proggy, 22, 1144, PROGGY);
	patternList[11] = &proggy;
	initPattern(&hperror, 32, 392, HPERROR);
	patternList[12] = &hperror;
	initFont(&proggyFont, 12, &proggy);
	listSize = 0;

	pattern_t* p;
	// Add all the patterns to the display list, but make them invisible.
	for (int i = 0; i < 10; i++) {
		p = patternList[i];
		addImage(i, p, 0, 0, 0, 120, -1, -p->cols, true);
		changeVisibility(i, false);
	}
}
Beispiel #7
0
// slave operations
void i2cSlaveReceiveService(uint8_t receiveDataLength, uint8_t* receiveData)
{
	uint8_t i;
	// this function will run when a master somewhere else on the bus
	// addresses us and wishes to write data to us
	
	cbi(PORTB, PB6);

	// copy the received data to a local buffer
	for(i=0; i<receiveDataLength; i++)
		localBuffer[i] = *receiveData++;

	add_message_cmd *am;
	add_image_cmd *ai;
	pong_cmd *p;

	switch (localBuffer[0]) {
	case FRAME_CMD:
		frame = ((frame_cmd*) localBuffer)->frame;
		updateOffsets();
		draw();
		break;
	case SHOW_CMD:
		exclusivelyShow(((id_cmd*) localBuffer)->id);
		updateOffsets();
		draw();
		break;
	case ADD_MESSAGE_CMD:
		am = (add_message_cmd*) localBuffer;
		addMessage(am->id, am->message, am->rStart, am->rStep, am->rStop, am->cStart, am->cStep, am->cStop, am->loop); 
		updateOffsets();
		draw();
		break;
	case DELETE_CMD:
		removeDisplayable(((id_cmd*) localBuffer)->id);
		updateOffsets();
		draw();
		break;
	case ENABLE_CMD:
		changeVisibility(((id_cmd*) localBuffer)->id, true);
		updateOffsets();
		draw();
		break;
	case DISABLE_CMD:
		changeVisibility(((id_cmd*) localBuffer)->id, false);
		updateOffsets();
		draw();
		break;
	case ADD_IMAGE_CMD:
		ai = (add_image_cmd*) localBuffer;
		// only process valid pattern image ids
		if (ai->imageID >= TOTALPATTERNS || ai->imageID < 0) break; 
		addImage(ai->id, patternList[ai->imageID], ai->rStart, ai->rStep, ai->rStop, ai->cStart, ai->cStep, ai->cStop, ai->loop);
		updateOffsets();
		draw();
		break;
	case PONG_CMD:
		p = (pong_cmd*) localBuffer;
		drawPong(p->paddle1_y, p->paddle2_y, p->ball_x, p->ball_y);
		break;
	case TEST_CMD:
		test();
		break;
	default:
		PORTB = 0x00;
		PORTD = 0x00;
		PORTA = 0x00;
		break;
	}

	localBufferLength = receiveDataLength;
}
void MainWindow::closeEvent(QCloseEvent *ev)
{
    if ( !this->isVisible() ) changeVisibility();
    if ( runningConnExist() && wait_thread==nullptr ) {
        connListWidget->setEnabled(false);
        toolBar->setEnabled(false);
        logDock->setEnabled(false);
        domainDock->setEnabled(false);
        networkDock->setEnabled(false);
        storagePoolDock->setEnabled(false);
        secretDock->setEnabled(false);
        ifaceDock->setEnabled(false);
        domainsStateMonitor->stopMonitoring();
        taskWrHouse->stopTaskComputing();
        // close VM Displays
        QStringList keys(VM_Displayed_Map.keys());
        foreach ( QString key, keys ) {
            if ( VM_Displayed_Map.value(key, nullptr)!=nullptr ) {
                VM_Viewer *value = nullptr;
                QString _type = VM_Displayed_Map.value(key, nullptr)->TYPE.toUpper();
                if ( _type=="LXC" ) {
                    value = static_cast<LXC_Viewer*>(
                                VM_Displayed_Map.value(key, nullptr));
                } else if ( _type=="SPICE" ) {
                    value = static_cast<Spice_Viewer*>(
                                VM_Displayed_Map.value(key, nullptr));
                };
                if ( nullptr!=value ) value->close();
                //qDebug()<<key<<"removed into Close";
            };
        };
        VM_Displayed_Map.clear();
        //qDebug()<<"Viewers cleared";
        // close StorageVolControls
        keys = Overviewed_StPool_Map.keys();
        foreach ( QString key, keys ) {
            if ( Overviewed_StPool_Map.value(key, nullptr)!=nullptr ) {
                VirtStorageVolControl *value = nullptr;
                value = static_cast<VirtStorageVolControl*>(
                                Overviewed_StPool_Map.value(key, nullptr));
                if ( nullptr!=value ) value->close();
                //qDebug()<<key<<"removed into Close";
            };
        };
        Overviewed_StPool_Map.clear();
        //qDebug()<<"StorageVolControls cleared";
        // close DomainEditors
        keys = DomainEditor_Map.keys();
        foreach ( QString key, keys ) {
            if ( DomainEditor_Map.value(key, nullptr)!=nullptr ) {
                CreateVirtDomain *value = nullptr;
                value = static_cast<CreateVirtDomain*>(
                                DomainEditor_Map.value(key, nullptr));
                if ( nullptr!=value ) value->close();
                //qDebug()<<key<<"removed into Close";
            };
        };
        DomainEditor_Map.clear();
        //qDebug()<<"DomainEditors cleared";
        wait_thread = new Wait(this, connListWidget);
        // stop virtEventLoop after closing all connections
        connect(wait_thread, SIGNAL(finished()),
                virtEventLoop, SLOT(stop()));
        wait_thread->start();
        ev->ignore();
        startCloseProcess();
    } else if ( !runningConnExist() &&
Beispiel #9
0
 void show() { changeVisibility( true ); }