UIMachineWindowSeamless::UIMachineWindowSeamless(UIMachineLogic *pMachineLogic, ulong uScreenId)
    : QIWithRetranslateUI2<QMainWindow>(0, Qt::FramelessWindowHint)
    , UIMachineWindow(pMachineLogic, uScreenId)
    , m_pMainMenu(0)
#ifndef Q_WS_MAC
    , m_pMiniToolBar(0)
#endif /* Q_WS_MAC */
{
    /* "This" is machine window: */
    m_pMachineWindow = this;

    /* Set the main window in VBoxGlobal: */
    if (uScreenId == 0)
        vboxGlobal().setMainWindow(this);

    /* Prepare seamless window icon: */
    prepareWindowIcon();

    /* Prepare console connections: */
    prepareConsoleConnections();

    /* Prepare seamless window: */
    prepareSeamless();

    /* Prepare seamless menu: */
    prepareMenu();

    /* Prepare machine view container: */
    prepareMachineViewContainer();

    /* Prepare seamless machine view: */
    prepareMachineView();

    /* Prepare handlers: */
    prepareHandlers();

#ifndef Q_WS_MAC
    /* Prepare mini tool-bar: */
    prepareMiniToolBar();
#endif /* Q_WS_MAC */

    /* Retranslate fullscreen window finally: */
    retranslateUi();

#ifdef Q_WS_MAC
    /* Load seamless window settings: */
    loadWindowSettings();
#endif /* Q_WS_MAC */

    /* Update all the elements: */
    updateAppearanceOf(UIVisualElement_AllStuff);

    /* Show window: */
    showSeamless();
}
UIMachineWindowScale::UIMachineWindowScale(UIMachineLogic *pMachineLogic, ulong uScreenId)
    : QIWithRetranslateUI2<QMainWindow>(0, Qt::Window)
    , UIMachineWindow(pMachineLogic, uScreenId)
    , m_pMainMenu(0)
{
    /* "This" is machine window: */
    m_pMachineWindow = this;

    /* Set the main window in VBoxGlobal */
    if (uScreenId == 0)
        vboxGlobal().setMainWindow(this);

    /* Prepare window icon: */
    prepareWindowIcon();

    /* Prepare console connections: */
    prepareConsoleConnections();

    /* Prepare menu: */
    prepareMenu();

    /* Retranslate normal window finally: */
    retranslateUi();

    /* Prepare normal machine view container: */
    prepareMachineViewContainer();

    /* Prepare normal machine view: */
    prepareMachineView();

    /* Prepare handlers: */
    prepareHandlers();

    /* Load normal window settings: */
    loadWindowSettings();

    /* Update all the elements: */
    updateAppearanceOf(UIVisualElement_AllStuff);

#ifdef Q_WS_MAC
    /* Install the resize delegate for keeping the aspect ratio. */
    ::darwinInstallResizeDelegate(this);
    /* Beta label? */
    if (vboxGlobal().isBeta())
    {
        QPixmap betaLabel = ::betaLabel(QSize(100, 16));
        ::darwinLabelWindow(this, &betaLabel, true);
    }
#endif /* Q_WS_MAC */

    /* Show window: */
    showSimple();
}
예제 #3
0
CMDIWindow::CMDIWindow(QWidget* parent)
: CMyWindow(parent, 0, true, WType_TopLevel)
{
#ifdef DEBUG
  qDebug("CMDIWindow::CMDIWindow()");
#endif
  
  setName("MainWindow");
  setMinimumSize(320, 240);
  
  setCaption(QString(APPLICATION) + " " + QString(VERSION) + QString(BRANCH));
  setIcon(getPixmapIcon("applicationIcon"));
  
  setCentralWidget( new QWidget( this, "qt_central_widget" ) );
  CMDIWindowLayout = new QGridLayout( centralWidget(), 1, 1, 2, 2, "CMDIWindowLayout"); 
   
  myApp()->createWorkspace(centralWidget());
  myApp()->workSpace()->setScrollBarsEnabled(true);
  
  CMDIWindowLayout->addWidget(myApp()->workSpace(), 0, 0);
  
  consoleMenu = new QPopupMenu(this, "ConsoleMenu");
  
  QAction * consoleExitAction = new QAction (tr("Exit"), getPixmapIcon("exitIcon"),
    tr("E&xit"), 0, this, "consoleExitAction");  //Exit should not be CAction 
  consoleExitAction->addTo(consoleMenu);
  connect(consoleExitAction, SIGNAL(activated()), this, SLOT(close()));
  
  menuBar()->insertItem(tr("&Console"), consoleMenu);  
   
  new COptionsMenu(this, menuBar(), "OptionsMenu");
#ifndef NO_MYSQLCC_PLUGINS
  new CPluginsMenu(this, menuBar(), "PluginsMenu");
#endif
  new CHotKeyEditorMenu(this, menuBar(), "HotKeyEditor");

  windowMenu = new QPopupMenu(this, "WindowMenu");
  windowMenu->setCheckable(true);
  menuBar()->insertItem(tr("&Window"), windowMenu);
  new CHelpMenu(this, menuBar(), "HelpMenu");

  if (!loadWindowSettings())
    setGeometry((int)(myApp()->desktop()->width() - (myApp()->desktop()->width() - (myApp()->desktop()->width() / 2)) * 1.5) / 2,
    (int)(myApp()->desktop()->height() - (myApp()->desktop()->height() -  (myApp()->desktop()->height() / 2)) * 1.5) / 2,
    (int)((myApp()->desktop()->width() - (myApp()->desktop()->width() / 2)) * 1.5),
    (int)((myApp()->desktop()->height() - (myApp()->desktop()->height() / 2)) * 1.5));
  
  consoleWindow = 0;
  connect(windowMenu, SIGNAL(aboutToShow()), this, SLOT(windowMenuAboutToShow()));
}
예제 #4
0
///////////////////////////////////////////////////////////////////////////////
/// \brief  Deletes the most recent history index of the specified
///         WindowSettings object.
/// 
/// \param  id The AssetId defining the WindowSettings stack to revert.
/// \return The next most recent history index for the WindowSettings object.
///         If there is a problem deleting the most recent window settings or
///         if there is no next most recent history index, a
///         default-constructed WindowSettings object will be returned.
///
/// \ingroup loading
WindowSettings revertWindowSettings(const AssetId& id)
{
   try
   {
      std::shared_ptr<bed::Bed> bed = bed::openWritable(id.bed);
      if (!bed)
         throw std::runtime_error("Could not open bed for writing!");

      bed::Db& db = bed->getDb();
  
      if (db.getInt(BE_WND_WINDOW_SETTINGS_SQL_TABLE_EXISTS, 0) == 0)
         throw std::runtime_error("WindowSettings table does not exist!");

      bed::Transaction transaction(db, bed::Transaction::Immediate);

      int history_index = 0;
      bed::Stmt latest(db, BE_WND_WINDOW_SETTINGS_SQLID_LATEST_INDEX);
      latest.bind(1, id.asset.value());
      if (latest.step())
         history_index = latest.getInt(0);

      bed::Stmt remove(db, BE_WND_WINDOW_SETTINGS_SQLID_REVERT);
      remove.bind(1, id.asset.value());
      remove.bind(2, history_index);
      remove.step();

      transaction.commit();
      return loadWindowSettings(*bed, id.asset);
   }
   catch (const bed::Db::error& err)
   {
      BE_LOG(VWarning) << "Database error while reverting window settings!" << BE_LOG_NL
                       << "              Bed: " << id.bed << BE_LOG_NL
                       << "WindowSettings ID: " << id.asset << BE_LOG_NL
                       << "        Exception: " << err.what() << BE_LOG_NL
                       << "              SQL: " << err.sql() << BE_LOG_END;
   }
   catch (const std::runtime_error& err)
   {
      BE_LOG(VWarning) << "Exception while reverting window settings!" << BE_LOG_NL
                       << "              Bed: " << id.bed << BE_LOG_NL
                       << "WindowSettings ID: " << id.asset << BE_LOG_NL
                       << "        Exception: " << err.what() << BE_LOG_END;
   }

   return WindowSettings();
}
예제 #5
0
MainWindow::MainWindow(bool as_main_window, QWidget* parent, Qt::WindowFlags flags)
: QMainWindow           { parent, flags }
, controller            { nullptr }
, create_menu           { as_main_window }
, show_menu             { create_menu && !mobileMode() }
, shortcuts_blocked     { false }
, general_toolbar       { nullptr }
, file_menu             { nullptr }
, has_opened_file       { false }
, has_unsaved_changes   { false }
, has_autosave_conflict { false }
, maximized_before_fullscreen { false }
, homescreen_disabled   { false }
{
	setWindowIcon(QIcon(QString::fromLatin1(":/images/mapper.png")));
	setAttribute(Qt::WA_DeleteOnClose);
	
	status_label = new QLabel();
	statusBar()->addWidget(status_label, 1);
	statusBar()->setSizeGripEnabled(as_main_window);
	if (mobileMode())
		statusBar()->hide();
	
	central_widget = new QStackedWidget(this);
	QMainWindow::setCentralWidget(central_widget);
	
	if (as_main_window)
		loadWindowSettings();
	
#if defined(Q_OS_ANDROID)
	// Needed to catch Qt::Key_Back, cf. MainWindow::eventFilter()
	qApp->installEventFilter(this);
#else
	installEventFilter(this);
#endif
	
	connect(&Settings::getInstance(), &Settings::settingsChanged, this, &MainWindow::settingsChanged);
}
예제 #6
0
void CellMLModelRepositoryPlugin::loadSettings(QSettings *pSettings)
{
    // Retrieve our CellML Model Repository window settings

    loadWindowSettings(pSettings, mCellmlModelRepositoryWindow);
}