/**
 * Construct a tabbed main window.
 * @param parent
 * @return
 */
DTabbedMainWindow::DTabbedMainWindow(QWidget *parent) : DMainWindow(parent)
{
    m_tabWidget = new TabWidgetPrivate;

    setupTabWidget( m_tabWidget );
    setCentralWidget(m_tabWidget);

    connect(this, SIGNAL(perspectiveChanged(int)), this, SLOT(setupPerspective(int)));
}
Ejemplo n.º 2
0
ABCentralWidget::ABCentralWidget( QWidget *parent, const char *name )
    : QWidget( parent, name )
{
    mainGrid = new QGridLayout( this, 2, 1, 5, 5 );

    setupTabWidget();
    setupListView();

    mainGrid->setRowStretch( 0, 0 );
    mainGrid->setRowStretch( 1, 1 );
}
/**
 * Sets other tab widget.
 * @param w
 */
void DTabbedMainWindow::setTabWidget(QTabWidget *w)
{
    m_tabWidget->close();

    setupTabWidget( w );

    delete m_tabWidget;
    m_tabWidget = 0;

    setCentralWidget( w );

    m_tabWidget = w;
}
Ejemplo n.º 4
0
void WindowMain::slotUpdateBtnLater()
{
  ui_->mainLayout_v->removeWidget(updateMessage_);
  ui_->mainLayout_v->removeWidget(questionBox_);
  questionBox_->close();
  updateMessage_->close();
  delete questionBox_;
  questionBox_ = NULL;
  delete updateMessage_;
  updateMessage_ = NULL;
  if(pmManager_->vmMaskRegenerationNecessary() )
    regenerateVMMasks();
  else
    setupTabWidget();
}
Ejemplo n.º 5
0
pAcquisitionWindow::pAcquisitionWindow(pRunController &runController)
{  
  setupDaqDisplay();
  setupMessageDisplay();
  setupLoggerConnections();
  setupTransportBar();
  setupTabWidget();
  setupCommentBox();  
  m_runController = &runController;
  // This connection needs to be here in order to intercept error signals.
  connect(m_runController->usbController(),
    SIGNAL(quickusbError(unsigned long)),
    this, SLOT(disableHardwareWidgets()));
  connect(m_runController->usbController(),
	  SIGNAL(connected(QString, QString, QString, QString)),
	  m_usbControlTab,
	  SLOT(updateInfo(QString, QString, QString, QString)));
  m_runController->connectUsb();
  setupConnections();
}
Ejemplo n.º 6
0
bool WindowMain::init(QString parPmInstallPath, QString parVboxDefaultMachineFolder)
{
  // set some window title
  slotRegenerationProgress("startup...");

  // load the application logo from images.qrc
  setWindowIcon(QIcon(":/resources/privacymachine.svg"));

  pmManager_ = new PMManager();
  if(!pmManager_->init_1(parPmInstallPath, parVboxDefaultMachineFolder)) return false;

  bool updateAvailable = false;

  // Does the base-disk exists?
  QString currentVMDK = pmManager_->baseDiskWithPath() + ".vmdk";
  // Especially for Windows try to avoid downloading into Program Files folder.
  // TODO AL: + "/download/", ggF. erstellen
  FvUpdater::sharedUpdater()->setDownloadPath( pmManager_->getPmUserConfigDir() + "/" );
  FvUpdater::sharedUpdater()->setTargetPath( pmManager_->getBaseDiskDirectoryPath() );
  if (!QFile::exists(currentVMDK))
  {
    QMessageBox msgBox;
    msgBox.setIcon(QMessageBox::Information);
    msgBox.setWindowTitle("PrivacyMachine");
    QString message = QCoreApplication::translate("check of software dependencies", "We need to download the initial base disk (650MB).\nThis might take a couple of minutes...\nPress Ok to start.");
    msgBox.setStandardButtons(QMessageBox::Abort | QMessageBox::Ok);
    msgBox.setText(message);
    int ret = msgBox.exec();
    if (ret == QMessageBox::Ok)
    {
      ILOG("Start downloading the base-disk");
    }
    else
    {
      IERR("User canceled download of basedisk -> no way to continue without base-disk");
      return false;
    }

    QString appcastUrl = pmManager_->getUpdateConfig().appcastBaseDisk;

    // We have to download the first base-disk?
    QApplication::setOrganizationName("PrivacyMachine");
    QApplication::setOrganizationDomain("privacymachine.eu");
    FvUpdater::sharedUpdater()->SetComponentVersion( ComponentVersion( 1, 0, 0, 0 ) );
    FvUpdater::sharedUpdater()->SetFeedURL( appcastUrl );
    updateAvailable = FvUpdater::sharedUpdater()->CheckForUpdateBlocking( 5, Verbosity::Interactive );

    // The rest of the program depends on having the initial base disk, so, if we cannot get it, the only option is to
    // gracefully shut down.
    // FIXME AL will block if base disk cannot be found.
    if( updateAvailable )
    {
      /*
        QString statusMessage = "Downloading initial base disk. This might take a couple of minutes...";
        ILOG(statusMessage);
        updateMessage_ = new QLabel(this);
        updateMessage_->setText( statusMessage );
        updateMessage_->setFont(QFont("Sans",18));
        updateMessage_->setAlignment(Qt::AlignHCenter);
        ui_->mainLayout_v->setAlignment(Qt::AlignHCenter);
        ui_->mainLayout_v->addWidget(updateMessage_);
        */



      FvUpdater::sharedUpdater()->InstallUpdateBlocking( );
    }
    else
    {
      QString errorMessage = 
        "Could not find initial base disk, which is required to run the PrivacyMachine. " 
        "Seems that we could not find '" + appcastUrl + "'.";
      IERR(errorMessage);
      updateMessage_ = new QLabel(this);
      updateMessage_->setText( errorMessage );
      updateMessage_->setFont(QFont("Sans",18));
      updateMessage_->setAlignment(Qt::AlignHCenter);
      ui_->mainLayout_v->setAlignment(Qt::AlignHCenter);
      ui_->mainLayout_v->addWidget(updateMessage_);
      questionBox_ = new QDialogButtonBox(this);
      questionBox_->addButton(QDialogButtonBox::Ok);
      ui_->mainLayout_v->addWidget(questionBox_);

      connect(questionBox_,
              SIGNAL(accepted()),
              this,
              SLOT(slotUpdateNotFoundBtnOK()));

      return false;

    }

  }
  else
  {
    FvUpdater::sharedUpdater()->SetComponentVersion( ComponentVersion( 1, 0, 0, 0 ) );
    QString appcastUrl = pmManager_->getUpdateConfig().appcastPM;
    FvUpdater::sharedUpdater()->SetFeedURL( appcastUrl );
    #ifdef PM_WINDOWS
      QString releaseUrl = "https://update.privacymachine.eu/ReleaseNotes_0.10.0.0_WIN64_EN.html";
    #else
      QString releaseUrl = "https://update.privacymachine.eu/ReleaseNotes_0.10.0.0_LINUX_EN.html";
    #endif
    updateAvailable = showReleaseNotes( releaseUrl, 2000 );

//    if(updateAvailable)
//    {
//      #ifdef PM_WINDOWS
//        updateMessage_ = new QLabel(this);
//        updateMessage_->setText("An update is available!\nInstall now?");
//        updateMessage_->setFont(QFont("Sans",18));
//        updateMessage_->setAlignment(Qt::AlignHCenter);
//        ui_->mainLayout_v->setAlignment(Qt::AlignHCenter);
//        ui_->mainLayout_v->addWidget(updateMessage_);
//        questionBox_ = new QDialogButtonBox(this);
//        questionBox_->addButton(QDialogButtonBox::Ok);
//        questionBox_->addButton(tr("&Later"),QDialogButtonBox::RejectRole);
//        ui_->mainLayout_v->addWidget(questionBox_);
//
//        connect(questionBox_,
//          SIGNAL(accepted()),
//          this,
//          SLOT(slotUpdateBtnOK()));
//
//        connect(questionBox_,
//          SIGNAL(rejected()),
//          this,
//          SLOT(slotUpdateBtnLater()));
//
//        connect(questionBox_,
//          SIGNAL(destroyed()),
//          this,
//          SLOT(slotEnableMenueEntryForceCleanup()));
//        
//        return true;
//
//      #else
//        updateMessage_ = new QLabel(this);
//        // HACK AL: URL hardcoded for now
//        updateMessage_->setText(
//          "An update is available.\nYou can get it here: https://www.privacymachine.eu/de/download/." );
//        updateMessage_->setFont(QFont("Sans",18));
//        updateMessage_->setAlignment(Qt::AlignHCenter);
//        ui_->mainLayout_v->setAlignment(Qt::AlignHCenter);
//        ui_->mainLayout_v->addWidget(updateMessage_);
//        questionBox_ = new QDialogButtonBox(this);
//        questionBox_->addButton(QDialogButtonBox::Ok);
//        ui_->mainLayout_v->addWidget(questionBox_);
//
//        connect(questionBox_,
//          SIGNAL(accepted()),
//          this,
//          SLOT(slotUpdateBtnOK()));
//
//        connect(questionBox_,
//          SIGNAL(destroyed()),
//          this,
//          SLOT(slotEnableMenueEntryForceCleanup()));
//        
//        return true;
//
//      #endif
//
//    }
//    else
//      slotEnableMenueEntryForceCleanup();
  }

  // Now we can be sure to have the initial base disk, can we initialize pmManager_
  if(!pmManager_->init_2()) return false;

  if(pmManager_->vmMaskRegenerationNecessary() )
  {
    regenerateVMMasks();
    return true;
  }

  return setupTabWidget();

}