Example #1
0
Workspace::Workspace(PreviewFrame *parent)
    : QMdiArea(parent)
{
    previewFrame = parent;
    PreviewWidget *previewWidget = previewFrame->widget();
    QMdiSubWindow *frame = addSubWindow(previewWidget, Qt::Window);
    frame->move(10, 10);
    frame->show();
}
Workspace::Workspace(PreviewFrame* parent, const char* name)
    : QMdiArea(parent)
{
    previewFrame = parent;
    PreviewWidget *previewWidget = previewFrame->widget();
    setObjectName(QLatin1String(name));
    QMdiSubWindow *frame = addSubWindow(previewWidget, Qt::Window);
    frame->move(10,10);
    frame->show();
}
/*!
    Tile the windows. There is one window for digital signal generation
    and one window for analog signal generation.
*/
void UiGeneratorArea::tileSubWindows()
{
    QList<QMdiSubWindow*> windows = subWindowList();

    if (windows.size() == 0) return;

    int wHeight = (height()) / windows.size();

    int y = 0;
    for (int i = 0; i < windows.size(); i++) {
        QMdiSubWindow* win = windows.at(i);
        win->resize(width(), wHeight);
        win->move(0, y);
        y += wHeight;
    }

    mIsSubWindowsTiled = true;
}
Example #4
0
/**
 * @brief MainWindow::openMap Initialize and opens the given map.
 * @param map
 * @param notify Notifies all the clients that a new map has been opened if true.
 */
void MainWindow::openMap(Map *map, bool notify) {
    QListWidget *tokenList = ui->tokenPage->getUi()->m_tokenList;

    // Initialize Map with the MapServer
    if (m_Server != NULL) {
        Receiver *mapServerReceiver = m_Server->getReceiver(TargetCode::MAP_SERVER);
        MapServer *mapServer = dynamic_cast<MapServer*>(mapServerReceiver);
        map->setSenderServer(mapServer);
    }

    // Initialize Map with the MapClient
    Receiver *mapClientReceiver = m_Client->getReceiver(TargetCode::MAP_CLIENT);
    MapClient *mapClient = dynamic_cast<MapClient*>(mapClientReceiver);
    mapClient->addMapToList(map);
    map->setSenderClient(mapClient);

    QMdiSubWindow *subwindow = ui->tableArea->addSubWindow(map);
    subwindow->show();
    subwindow->move(0, 0);

    connect(tokenList, SIGNAL(currentItemChanged(QListWidgetItem*,  QListWidgetItem *)),
            map->getMapLayer(), SLOT(setTokenItem(QListWidgetItem*))
    );

    if (notify) {
        // Notifies all the clients that a new map has been opened
        Receiver *mapClientReceiver = m_Client->getReceiver(TargetCode::MAP_CLIENT);
        MapClient *mapClient = dynamic_cast<MapClient*>(mapClientReceiver);
        QString msg = QString("%1").arg(map->id());
        mapClient->sendMessageToServer(msg, (quint16) MapCodes::OPEN_MAP);
    }

    m_NotificationStacker.pushNotification("Une carte a été ouverte");

    // Connect to the LogClient
    TargetCode logClientCode(TargetCode::LOGGER_CLIENT);
    Receiver *logClientReceiver = m_Client->getReceiver(logClientCode);
    LogClient *logClient = dynamic_cast<LogClient*>(logClientReceiver);
    map->connectToLogger(logClient);
}
Example #5
0
void TopWin::setIsMdiWin(bool val)
{
	if (MusEGlobal::unityWorkaround)
		return;
	
	if (val)
	{
		if (!isMdiWin())
		{
			_savedToolbarState = saveState();
			int width_temp=width();
			int height_temp=height();
			bool vis=isVisible();
			
			QMdiSubWindow* subwin = createMdiWrapper();
			muse->addMdiSubWindow(subwin);
			subwin->resize(width_temp, height_temp);
			subwin->move(0,0);
			subwin->setVisible(vis);
			this->QMainWindow::show(); //bypass the delegation to the subwin
			
			if (_sharesToolsAndMenu == _sharesWhenFree[_type])
				shareToolsAndMenu(_sharesWhenSubwin[_type]);
			
			fullscreenAction->setEnabled(false);
			fullscreenAction->setChecked(false);
			subwinAction->setChecked(true);
			muse->updateWindowMenu();
		}
		else
		{
			if (MusEGlobal::debugMsg) printf("TopWin::setIsMdiWin(true) called, but window is already a MDI win\n");
		}
	}
	else
	{
		if (isMdiWin())
		{
			int width_temp=width();
			int height_temp=height();
			bool vis=isVisible();

			QMdiSubWindow* mdisubwin_temp=mdisubwin;
			mdisubwin=NULL;
			setParent(NULL);
			mdisubwin_temp->hide();
			delete mdisubwin_temp;
			
			resize(width_temp, height_temp);
			setVisible(vis);

			if (_sharesToolsAndMenu == _sharesWhenSubwin[_type])
				shareToolsAndMenu(_sharesWhenFree[_type]);
						
			fullscreenAction->setEnabled(true);
			subwinAction->setChecked(false);
			muse->updateWindowMenu();
		}
		else
		{
			if (MusEGlobal::debugMsg) printf("TopWin::setIsMdiWin(false) called, but window is not a MDI win\n");
		}
	}
}