/**
 * Client send:
 * 2           - U8          - shared flag
 *
 * Server send:
 * 2           - U16         - framebuffer-width
 * 2           - U16         - framebuffer-height
 * 16          - PixelFormat - server-pixel-format
 * 4           - U32         - name-length
 * name-length - U8 array    - name-string
 */
void RemoteViewerCore::clientAndServerInit()
{
  if (m_sharedFlag) {
    m_logWriter.info(_T("Setting share flag in on..."));
  } else {
    m_logWriter.info(_T("Setting share flag is off..."));
  }
  m_output->writeUInt8(m_sharedFlag);
  m_output->flush();
  m_logWriter.debug(_T("Shared flag is set"));

  UINT16 width = m_input->readUInt16();
  UINT16 height = m_input->readUInt16();
  Dimension screenDimension(width, height);
  PixelFormat serverPixelFormat = readPixelFormat();
  
  {
    AutoLock al(&m_fbLock);
    setFbProperties(&screenDimension, &serverPixelFormat);
  }

  UINT32 sizeInBytes = m_input->readUInt32();
  std::vector<const char> buffer(sizeInBytes + 1);
  m_input->read(&buffer.front(), sizeInBytes);
  buffer[sizeInBytes] = '\0';
  AnsiStringStorage ansiStr;
  ansiStr.setString(&buffer[0]);
  ansiStr.toStringStorage(&m_remoteDesktopName);
  m_logWriter.info(_T("Server remote name: %s"), m_remoteDesktopName.getString());

  if (m_isTight) {
    m_logWriter.detail(_T("Reading tight capabilities"));
    readCapabilities();
  }
}
Example #2
0
OS_Booting::OS_Booting(
        QWidget *parent,
        QString _caps,
        QString _xmlDesc) :
    _Tab(parent), capabilities(_caps), xmlDesc(_xmlDesc)
{
    setObjectName("OS_Booting");
    readCapabilities();
    bootType = new BootType(this);
    bootSet = new QStackedWidget(this);
    bootSet->addWidget(new BIOS_Boot(this, capabilities));
    bootSet->addWidget(new Host_Boot(this));
    bootSet->addWidget(new Direct_Kernel_Boot(this));
    bootSet->addWidget(new LXC_OSBooting(this, capabilities));
    bootSet->widget(0)->setEnabled(type.toLower().compare("lxc")!=0);
    bootSet->widget(1)->setEnabled(type.toLower().compare("lxc")!=0);
    bootSet->widget(2)->setEnabled(type.toLower().compare("lxc")!=0);
    bootSet->widget(3)->setEnabled(type.toLower().compare("lxc")==0);
    bootType->osType->setEnabled(type.toLower().compare("lxc")!=0);
    connect(bootType->bootType, SIGNAL(currentIndexChanged(int)),
            bootSet, SLOT(setCurrentIndex(int)));
    connect(bootType->bootType, SIGNAL(currentIndexChanged(int)),
            this, SLOT(changeBootType()));
    //scrolledLayout = new QVBoxLayout(this);
    //scrolledLayout->addWidget(bootType);
    //scrolledLayout->addWidget(bootSet);
    //scrolledLayout->addStretch(-1);
    //scrolled = new QWidget(this);
    //scrolled->setLayout(scrolledLayout);
    restorePanel = new RestorePanel(this);
    //commonWdg = new QScrollArea(this);
    //commonWdg->setWidget(scrolled);
    //commonWdg->setWidgetResizable(true);
    commonLayout = new QVBoxLayout(this);
    commonLayout->addWidget(restorePanel, 0, Qt::AlignRight);
    //commonLayout->addWidget(commonWdg);
    commonLayout->addWidget(bootType);
    commonLayout->addWidget(bootSet);
    commonLayout->addStretch(-1);
    setLayout(commonLayout);
    readXMLDesciption();
    // dataChanged connections
    connect(this, SIGNAL(dataChanged()),
            restorePanel, SLOT(stateChanged()));
    connect(bootType->osType, SIGNAL(textEdited(QString)),
            this, SLOT(stateChanged()));
    // action connections
    connect(restorePanel, SIGNAL(resetData()),
            this, SLOT(resetData()));
    connect(restorePanel, SIGNAL(revertData()),
            this, SLOT(revertData()));
    connect(restorePanel, SIGNAL(saveData()),
            this, SLOT(saveData()));
    for (int i=0; i<bootSet->count(); i++) {
        connect(bootSet->widget(i), SIGNAL(domainType(const QString&)),
                this, SIGNAL(domainType(const QString&)));
        connect(bootSet->widget(i), SIGNAL(osType(const QString&)),
                this, SLOT(changeOSType(const QString&)));
        connect(bootSet->widget(i), SIGNAL(emulatorType(const QString&)),
                this, SIGNAL(emulatorType(const QString&)));
        connect(bootSet->widget(i), SIGNAL(dataChanged()),
                this, SLOT(stateChanged()));
    };
    BIOS_Boot *wdg = static_cast<BIOS_Boot*>(bootSet->widget(0));
    connect(wdg->architecture, SIGNAL(maxVCPU(const QString&)),
            this, SIGNAL(maxVCPU(const QString&)));
    connect(wdg->architecture, SIGNAL(archType(const QString&)),
            this, SIGNAL(archChanged(const QString&)));
}