Ejemplo n.º 1
0
ByteViewTab::ByteViewTab(QWidget *parent) :
    QTabWidget(parent)
{
    setAccessibleName(tr("Packet bytes"));
    setTabPosition(QTabWidget::South);
    setDocumentMode(true);
    addTab();
}
Ejemplo n.º 2
0
int QTabWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 12)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 12;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< TabPosition*>(_v) = tabPosition(); break;
        case 1: *reinterpret_cast< TabShape*>(_v) = tabShape(); break;
        case 2: *reinterpret_cast< int*>(_v) = currentIndex(); break;
        case 3: *reinterpret_cast< int*>(_v) = count(); break;
        case 4: *reinterpret_cast< QSize*>(_v) = iconSize(); break;
        case 5: *reinterpret_cast< Qt::TextElideMode*>(_v) = elideMode(); break;
        case 6: *reinterpret_cast< bool*>(_v) = usesScrollButtons(); break;
        case 7: *reinterpret_cast< bool*>(_v) = documentMode(); break;
        case 8: *reinterpret_cast< bool*>(_v) = tabsClosable(); break;
        case 9: *reinterpret_cast< bool*>(_v) = isMovable(); break;
        }
        _id -= 10;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setTabPosition(*reinterpret_cast< TabPosition*>(_v)); break;
        case 1: setTabShape(*reinterpret_cast< TabShape*>(_v)); break;
        case 2: setCurrentIndex(*reinterpret_cast< int*>(_v)); break;
        case 4: setIconSize(*reinterpret_cast< QSize*>(_v)); break;
        case 5: setElideMode(*reinterpret_cast< Qt::TextElideMode*>(_v)); break;
        case 6: setUsesScrollButtons(*reinterpret_cast< bool*>(_v)); break;
        case 7: setDocumentMode(*reinterpret_cast< bool*>(_v)); break;
        case 8: setTabsClosable(*reinterpret_cast< bool*>(_v)); break;
        case 9: setMovable(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 10;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 10;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Ejemplo n.º 3
0
	void MainWindow::setup_views_default()
	{
		// Tabs should be on the top of windows, not at the bottom
		setTabPosition( Qt::LeftDockWidgetArea, QTabWidget::North );
		setTabPosition( Qt::RightDockWidgetArea, QTabWidget::North );
		setTabPosition( Qt::BottomDockWidgetArea, QTabWidget::North );
		setTabPosition( Qt::TopDockWidgetArea, QTabWidget::North );

		addDockWidget( Qt::LeftDockWidgetArea, m_project_view.get() );
		tabifyDockWidget( m_project_view.get(), m_changes_view.get() );
		tabifyDockWidget( m_project_view.get(), m_objects_view.get() );

		addDockWidget( Qt::RightDockWidgetArea, m_libraries_view.get() );
		tabifyDockWidget( m_libraries_view.get(), m_layers_view.get() );
		tabifyDockWidget( m_libraries_view.get(), m_toolbox_view.get() );

		addDockWidget( Qt::BottomDockWidgetArea, m_log_view.get() );

	}
Ejemplo n.º 4
0
ByteViewTab::ByteViewTab(QWidget *parent) :
    QTabWidget(parent),
    cap_file_(0)
{
    setAccessibleName(tr("Packet bytes"));
    setTabPosition(QTabWidget::South);
    setDocumentMode(true);

    connect(wsApp, SIGNAL(appInitialized()), this, SLOT(connectToMainWindow()));
}
Ejemplo n.º 5
0
TabWidget::TabWidget(QWidget *parent) :
    QTabWidget(parent)
{
    setDocumentMode(true);
    setElideMode(Qt::ElideRight);
    setMovable(true);
    setTabsClosable(true);
    setTabShape(QTabWidget::Rounded);
    setTabPosition(QTabWidget::North);
    setUsesScrollButtons(true);
}
Ejemplo n.º 6
0
SideBar::SideBar(QWidget* parent)
: QTabWidget(parent)
, d(new SideBarPrivate)
{
    setFont(KGlobalSettings::smallestReadableFont());
    tabBar()->setDocumentMode(true);
    tabBar()->setUsesScrollButtons(false);
    tabBar()->setFocusPolicy(Qt::NoFocus);
    setTabPosition(QTabWidget::South);
    setElideMode(Qt::ElideRight);
}
Ejemplo n.º 7
0
int QMdiArea::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QAbstractScrollArea::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 14)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 14;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QBrush*>(_v) = background(); break;
        case 1: *reinterpret_cast< WindowOrder*>(_v) = activationOrder(); break;
        case 2: *reinterpret_cast< ViewMode*>(_v) = viewMode(); break;
        case 3: *reinterpret_cast< bool*>(_v) = documentMode(); break;
        case 4: *reinterpret_cast< bool*>(_v) = tabsClosable(); break;
        case 5: *reinterpret_cast< bool*>(_v) = tabsMovable(); break;
        case 6: *reinterpret_cast< QTabWidget::TabShape*>(_v) = tabShape(); break;
        case 7: *reinterpret_cast< QTabWidget::TabPosition*>(_v) = tabPosition(); break;
        }
        _id -= 8;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setBackground(*reinterpret_cast< QBrush*>(_v)); break;
        case 1: setActivationOrder(*reinterpret_cast< WindowOrder*>(_v)); break;
        case 2: setViewMode(*reinterpret_cast< ViewMode*>(_v)); break;
        case 3: setDocumentMode(*reinterpret_cast< bool*>(_v)); break;
        case 4: setTabsClosable(*reinterpret_cast< bool*>(_v)); break;
        case 5: setTabsMovable(*reinterpret_cast< bool*>(_v)); break;
        case 6: setTabShape(*reinterpret_cast< QTabWidget::TabShape*>(_v)); break;
        case 7: setTabPosition(*reinterpret_cast< QTabWidget::TabPosition*>(_v)); break;
        }
        _id -= 8;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 8;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Ejemplo n.º 8
0
TabManager::TabManager(QWidget *parent) :
    QTabWidget(parent)
{
    clear();
    setDocumentMode(true);
    setMovable(true);
    setTabsClosable(true);
    setElideMode(Qt::ElideRight);
    setTabPosition(QTabWidget::East);
    tab_count=1;
    new_file_count=1;
}
Ejemplo n.º 9
0
DateTabWidget::DateTabWidget(QWidget *parent)
	: QTabWidget(parent)
{
	setMinimumSize(QSize(0, 19));
        setMaximumSize(QSize(16777215, 19));
	setTabPosition(QTabWidget::South);
	setTabShape(QTabWidget::Triangular);
	setTabsClosable(true);

	connect( this, SIGNAL( currentChanged(int) ), this, SLOT( selectPage(int) ) );
	connect( this, SIGNAL( tabCloseRequested(int) ), this, SLOT( closePageRequest(int) ) );
}
QDockTabWidget::QDockTabWidget(QWidget *parent)
    :QTabWidget(parent)
{
    QDockTabBar* bar = new QDockTabBar(this);
    bar->setMovable(false);

    connect(bar, SIGNAL(dragTabOut(int)), this, SLOT(onDragTabOut(int)), Qt::QueuedConnection);
    setTabBar(bar);

    setTabPosition(South);

    connect(this, SIGNAL(currentChanged(int)), this, SLOT(onCurrenChanged(int)));
}
Ejemplo n.º 11
0
DockWindowPlace::DockWindowPlace(QWidget *parent,
                                 const QString settingsKey)
    : QTabWidget(parent)
    , pImpl_(new DockWindowPlaceImpl(this, settingsKey))
{
    // qDebug() << "LINE DEBUG: " << QFileInfo(QString(__FILE__)).fileName() << ":" << __LINE__;
    setAutoFillBackground(true);
    // qDebug() << "LINE DEBUG: " << QFileInfo(QString(__FILE__)).fileName() << ":" << __LINE__;
    setTabPosition(QTabWidget::South);
    // qDebug() << "LINE DEBUG: " << QFileInfo(QString(__FILE__)).fileName() << ":" << __LINE__;
    setVisible(false);
    // qDebug() << "LINE DEBUG: " << QFileInfo(QString(__FILE__)).fileName() << ":" << __LINE__;
}
Ejemplo n.º 12
0
ExtendedTabWidget::ExtendedTabWidget(QWidget *parent) :
    QTabWidget(parent)
{
    QTabBar* tb = new QTabBar(this);
    tb->setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab);
    setTabBar(tb);
    setMovable(true);
    setTabPosition(QTabWidget::North);
    setTabShape(QTabWidget::Rounded);
    setTabsClosable(true);
    setIconSize(QSize(32, 32));

    connect(this, SIGNAL(tabCloseRequested(int)), this, SLOT(onClose(int)));
}
Ejemplo n.º 13
0
void NodeEditorWindows::createDocks()
{
    // settings of mdi area
    setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
    setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
    setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::North);

    // cam explorer dock
    _camExplorerDock = new QDockWidget(tr("Node project explorer"), this);
    QWidget *camExplorerContent = new QWidget(_camExplorerDock);
    QLayout *camExplorerLayout = new QVBoxLayout();
    _camExplorerWidget = new CamExplorerWidget();
    camExplorerLayout->addWidget(_camExplorerWidget);
    camExplorerContent->setLayout(camExplorerLayout);
    _camExplorerDock->setWidget(camExplorerContent);
    addDockWidget(Qt::LeftDockWidgetArea, _camExplorerDock);

    // viewer explorer dock
    _viewerExplorerDock = new QDockWidget(tr("Viewers"), this);
    QWidget *viewerExplorerContent = new QWidget(_viewerExplorerDock);
    QLayout *viewerExplorerLayout = new QVBoxLayout();
    _viewerExplorerWidget = new ViewerExplorerWidget();
    viewerExplorerLayout->addWidget(_viewerExplorerWidget);
    viewerExplorerContent->setLayout(viewerExplorerLayout);
    _viewerExplorerDock->setWidget(viewerExplorerContent);
    tabifyDockWidget(_camExplorerDock, _viewerExplorerDock);

    // lib treeview dock
    _libTreeViewDock = new QDockWidget(tr("IP library explorer"), this);
    QWidget *libTreeViewContent = new QWidget(_libTreeViewDock);
    QLayout *libTreeViewLayout = new QVBoxLayout();
    _libTreeView = new LibTreeView();
    _libTreeView->setLib(&Lib::getLib());
    libTreeViewLayout->addWidget(_libTreeView);
    libTreeViewContent->setLayout(libTreeViewLayout);
    _libTreeViewDock->setWidget(libTreeViewContent);
    addDockWidget(Qt::RightDockWidgetArea, _libTreeViewDock);

    // compile log dock
    _compileLogDock = new QDockWidget(tr("Compilation log"), this);
    QWidget *compileLogContent = new QWidget(_compileLogDock);
    QLayout *compileLogLayout = new QVBoxLayout();
    _compileLog = new CompileLogWidget();
    compileLogLayout->addWidget(_compileLog);
    compileLogContent->setLayout(compileLogLayout);
    _compileLogDock->setWidget(compileLogContent);
    addDockWidget(Qt::BottomDockWidgetArea, _compileLogDock);
    connect(_compileLog, SIGNAL(messageSended(QString)), this, SLOT(showMessage(QString)));
}
Ejemplo n.º 14
0
void TabWidget::changeTabPosition(QAction *triggered)
{
    QActionGroup *tabPosition = static_cast<QActionGroup *>(sender());
    if(!tabPosition)
        qFatal("tabPosition is NULL");

    Properties *prop = Properties::Instance();
    /* order is dictated from mainwindow.cpp */
    QTabWidget::TabPosition position =
            (QTabWidget::TabPosition)tabPosition->actions()
            .indexOf(triggered);
    setTabPosition(position);
    prop->tabsPos = position;
    prop->saveSettings();
    return;
}
Ejemplo n.º 15
0
/**
 * Constructor
 */
PsiTabWidget::PsiTabWidget(QWidget *parent)
		: QWidget(parent) {
	tabsPosition_ = QTabWidget::East; // impossible => uninitialised state
	tabBar_ = new PsiTabBar(this);
	tabBar_->setUsesScrollButtons(true);
	layout_ = new QVBoxLayout(this);
	layout_->setMargin(0);
	layout_->setSpacing(0);
	barLayout_ = new QHBoxLayout;
	layout_->addLayout(barLayout_);
	barLayout_->setMargin(0);
	barLayout_->setSpacing(0);
	barLayout_->addWidget(tabBar_, 2);
	barLayout_->setAlignment(Qt::AlignLeft);

	int buttonwidth = qMax(tabBar_->style()->pixelMetric(QStyle::PM_TabBarScrollButtonWidth, 0, tabBar_),
		QApplication::globalStrut().width());

	downButton_ = new QToolButton(this);
	downButton_->setMinimumSize(3,3);
	downButton_->setFixedWidth(buttonwidth);
	downButton_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
	menu_ = new QMenu(this);
	downButton_->setMenu(menu_);
	downButton_->setStyleSheet(" QToolButton::menu-indicator { image:none } ");
	connect(menu_, SIGNAL(aboutToShow()), SLOT(menu_aboutToShow()));
	connect(menu_, SIGNAL(triggered(QAction*)), SLOT(menu_triggered(QAction*)));
	barLayout_->addWidget(downButton_);

	closeButton_ = new QToolButton(this);
	closeButton_->setMinimumSize(3,3);
	closeButton_->setFixedWidth(buttonwidth);
	closeButton_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
	barLayout_->addWidget(closeButton_);
	closeButton_->setText("x");
	downButton_->setArrowType(Qt::DownArrow);
	downButton_->setPopupMode(QToolButton::InstantPopup);
	stacked_ = new QStackedLayout(layout_);

	setTabPosition(QTabWidget::North);

	connect( tabBar_, SIGNAL(mouseDoubleClickTab(int)), SLOT(mouseDoubleClickTab(int)));
	connect( tabBar_, SIGNAL(mouseMiddleClickTab(int)), SLOT(mouseMiddleClickTab(int)));
	connect( tabBar_, SIGNAL( currentChanged(int)), SLOT(tab_currentChanged(int)));
	connect( tabBar_, SIGNAL( contextMenu(QContextMenuEvent*,int)), SLOT( tab_contextMenu(QContextMenuEvent*,int)));
	connect( closeButton_, SIGNAL(clicked()), SIGNAL(closeButtonClicked()));
}
Ejemplo n.º 16
0
ByteViewTab::ByteViewTab(QWidget *parent, epan_dissect_t *edt_fixed) :
    QTabWidget(parent),
    cap_file_(0),
    is_fixed_packet_(edt_fixed != NULL),
    edt_(edt_fixed)
{
    setAccessibleName(tr("Packet bytes"));
    setTabPosition(QTabWidget::South);
    setDocumentMode(true);

    // Shrink down to a small but nonzero size in the main splitter.
    int one_em = fontMetrics().height();
    setMinimumSize(one_em, one_em);

    if (!edt_fixed) {
        connect(wsApp, SIGNAL(appInitialized()), this, SLOT(connectToMainWindow()));
    }
}
Ejemplo n.º 17
0
void KueueApp::settingsChanged()
{
    #ifndef IS_WIN32
    #ifndef IS_OSX
    
        mSystray->destroy();
        createSystray();
    
    #endif
    #endif

    mDataThread = &mDataThread->restart();
    connectDataThread();
    
    mTabWidget->refreshTabs();
    setTabPosition();
    updateUiData();
}
bool QTabWidget::qt_property( int id, int f, QVariant* v)
{
    switch ( id - staticMetaObject()->propertyOffset() ) {
    case 0: switch( f ) {
	case 0: setTabPosition((TabPosition&)v->asInt()); break;
	case 1: *v = QVariant( (int)this->tabPosition() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 1: switch( f ) {
	case 0: setTabShape((TabShape&)v->asInt()); break;
	case 1: *v = QVariant( (int)this->tabShape() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 2: switch( f ) {
	case 0: setMargin(v->asInt()); break;
	case 1: *v = QVariant( this->margin() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 3: switch( f ) {
	case 0: setCurrentPage(v->asInt()); break;
	case 1: *v = QVariant( this->currentPageIndex() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 4: switch( f ) {
	case 1: *v = QVariant( this->count() ); break;
	case 3: case 4: case 5: break;
	default: return FALSE;
    } break;
    case 5: switch( f ) {
	case 0: case 1: case 5: goto resolve;
	case 3: case 4: break;
	default: return FALSE;
    } break;
    default:
	return QWidget::qt_property( id, f, v );
    }
    return TRUE;
resolve:
    return QWidget::qt_property( staticMetaObject()->resolveProperty(id), f, v );
}
Ejemplo n.º 19
0
void TabEditor::displayEditor(RCore *rExe,std::string name, DataEditor *dataEditor, VariableEditor *variableEditor){
    qDebug("Display Editor");
    rExe->diplayData(name);
    //----Update
    dataEditor->setVarTypes(rExe->getVarTypes());
    QStringList varNames;
    Rcpp::StringVector sv = rExe->getColNames();
    for(int i = 0; i < sv.size();i++){
        varNames.push_back(QString(sv[i]));
    }
    dataEditor->setVarNames(varNames);
    dataEditor->loadData(rExe->getDataFrame(),rExe->getColNames());
    //---
    variableEditor->loadVariable(rExe,rExe->getColNames());

    addTab(dataEditor,"Data");
    addTab(variableEditor, "Variable");
    setTabPosition(West);
    //Update 30 Juni
    connect(this, SIGNAL(currentChanged(int)), variableEditor, SLOT(checkWidgetVisibility()));
}
Ejemplo n.º 20
0
Panel::Panel(QWidget *parent):QTabWidget(parent){

    setTabPosition( QTabWidget::West );

    addTab( createPlotTab( this ), "Plot" );
    addTab( createCanvasTab( this ), "Canvas" );
    addTab( createCurveTab( this ), "Curve" );

     connect( Xfrom, SIGNAL( valueChanged( int ) ), SIGNAL( edited() ) );
     connect( Xto, SIGNAL( valueChanged( int ) ), SIGNAL( edited() ) );
     connect( Yfrom, SIGNAL( valueChanged( int ) ), SIGNAL( edited() ) );
     connect( Yto, SIGNAL( valueChanged( int ) ), SIGNAL( edited() ) );
     connect(x_lineEdit, SIGNAL(textChanged(QString) ), SIGNAL( edited() ) );
     connect(y_lineEdit, SIGNAL(textChanged(QString) ), SIGNAL( edited() ) );
     connect(title, SIGNAL(textChanged(QString) ), SIGNAL( edited() ) );
     connect(colorPanel, SIGNAL(currentIndexChanged(QString) ), SIGNAL( edited() ) );
     connect(grid, SIGNAL(currentIndexChanged(QString) ), SIGNAL( edited() ) );
     connect(curveStyle, SIGNAL(currentIndexChanged(QString) ), SIGNAL( edited() ) );
     connect(colorCurve, SIGNAL(currentIndexChanged(QString) ), SIGNAL( edited() ) );
   //  connect( d_curveWidth, SIGNAL( valueChanged( int ) ), SIGNAL( edited() ) );
}
Ejemplo n.º 21
0
DJContact::DJContact( DJHallController* hallController, const QString& selfUserName, QWidget * parent )
	:QTabWidget( parent ),m_hallController(hallController),m_selfUserName(selfUserName)
{
	djDebug() << "DJContact constructor" << selfUserName;
	m_selfUserId	= 0;
	
    m_friendsTree	= new QTreeWidget;
    PaintBackground( m_friendsTree, QPoint(100,0), QPoint(0,100) );
    m_friendsTree->setHeaderLabels( QStringList( selfUserName + tr("'s") + tr("friend list") ) );
    m_friendsTree->setRootIsDecorated( false );
    m_friendsTree->setSortingEnabled( true );
    m_friendsTree->setContextMenuPolicy( Qt::CustomContextMenu );
	connect(m_friendsTree, SIGNAL(customContextMenuRequested ( const QPoint & )), SLOT( contextMenuOfFriend ( const QPoint & ) ) );
	connect(m_friendsTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem *,int)), SLOT( friendDoubleClicked(QTreeWidgetItem *,int)));
	m_actRemoveFriend	= new QAction( tr("remove"), m_friendsTree );
	connect(m_actRemoveFriend, SIGNAL(triggered()),SLOT(removeFriendItem()));
	m_menuFriend	= new QMenu( m_friendsTree );
	m_menuFriend->addAction( m_actRemoveFriend );
    
    m_unwelcomesTree	= new QTreeWidget;
    PaintBackground( m_unwelcomesTree, QPoint(100,0), QPoint(0,100) );
    m_unwelcomesTree->setHeaderLabels( QStringList( selfUserName + tr("'s") + tr("blacklist") ) );
    m_unwelcomesTree->setRootIsDecorated( false );
    m_unwelcomesTree->setContextMenuPolicy( Qt::CustomContextMenu );
	connect(m_unwelcomesTree, SIGNAL(customContextMenuRequested ( const QPoint & )), SLOT( contextMenuOfUnwelcome ( const QPoint & ) ) );
	m_actRemoveUnwelcome	= new QAction( tr("remove"), m_unwelcomesTree );
	connect(m_actRemoveUnwelcome, SIGNAL(triggered()),SLOT(removeUnwelcomeItem()));
	m_menuUnwelcome	= new QMenu( m_unwelcomesTree );
	m_menuUnwelcome->addAction( m_actRemoveUnwelcome );
	
    setTabPosition( QTabWidget::North );
    addTab( m_friendsTree, tr("friend") );
    addTab( m_unwelcomesTree, tr("blacklist") );
	
	m_timer	= new QTimer(this);
	connect(m_timer, SIGNAL(timeout()), this, SLOT(checkPendingChats()));
	m_timer->start(1000);
	
	m_toggle = true;
}
Ejemplo n.º 22
0
void UIHexEditor::rebuildTabs()
{
    QList<QString> tabList;
    QList<u32> startList;
    QList<u32> endList;

    clear();
    //if (proc == UIDebugCPU::PROC_MSH2 || proc == UIDebugCPU::PROC_SSH2)
    if (proc != UIDebugCPU::PROC_SH1)
    {
        tabList   << "All"      << "BIOS"     << "LWRAM"    << "HWRAM"     <<
                  "CS0"      << "CS1"      << "CS2"      << "68K RAM"   <<
                  "VDP1 RAM" << "VDP1 FB"  << "VDP2 RAM" << "VDP2 CRAM";
        startList << 0x00000000 << 0x00000000 << 0x00200000 << 0x06000000 <<
                  0x02000000 << 0x04000000 << 0x05800000 << 0x05A00000 <<
                  0x05C00000 << 0x05C80000 << 0x05E00000 << 0x05F00000;
        endList   << 0x07FFFFFF << 0x0017FFFF << 0x002FFFFF << 0x060FFFFF <<
                  0x03FFFFFF << 0x04FFFFFF << 0x058FFFFF << 0x05AFFFFF <<
                  0x05C7FFFF << 0x05CFFFFF << 0x05EFFFFF << 0x05F7FFFF;
    }
    else
    {
        tabList   << "All" << "ROM" << "REG" << "DRAM" << "CS2" << "RAM Mirror";
        startList << 0x00000000 << 0x00000000 << 0x05FFFE00 << 0x09000000 <<
                  0x0A000000 << 0x0F000000;
        endList   << 0xFFFFFFFF << 0x0000FFFF << 0x05FFFFFF << 0x0907FFFF <<
                  0x0A1FFFFF << 0x0F07FFFF;
    }
    for (int i=0; i < tabList.count(); i++)
    {
        UIHexEditorWnd *hexEditorWnd = new UIHexEditorWnd (this);
        hexEditorWnd->setProc(proc);
        hexEditorWnd->setStartAddress(startList[i]);
        hexEditorWnd->setEndAddress(endList[i]);
        addTab(hexEditorWnd, tabList[i]);
    }
    setTabPosition(QTabWidget::South);
}
Ejemplo n.º 23
0
UIHexEditor::UIHexEditor( QWidget* p )
{
   QList<QString> tabList;
   QList<u32> startList;
   QList<u32> endList;
   tabList   << "All"      << "BIOS"     << "LWRAM"    << "HWRAM"     << 
                "CS0"      << "CS1"      << "CS2"      << "68K RAM"   << 
                "VDP1 RAM" << "VDP1 FB"  << "VDP2 RAM" << "VDP2 CRAM";
   startList << 0x00000000 << 0x00000000 << 0x00200000 << 0x06000000 <<
                0x02000000 << 0x04000000 << 0x05800000 << 0x05A00000 <<
                0x05C00000 << 0x05C80000 << 0x05E00000 << 0x05F00000;
   endList   << 0x07FFFFFF << 0x0017FFFF << 0x002FFFFF << 0x060FFFFF <<
                0x03FFFFFF << 0x04FFFFFF << 0x058FFFFF << 0x05AFFFFF <<
                0x05C7FFFF << 0x05CFFFFF << 0x05EFFFFF << 0x05F7FFFF;
   for (int i=0; i < tabList.count(); i++)
   {
      UIHexEditorWnd *hexEditorWnd = new UIHexEditorWnd (this);
      hexEditorWnd->setStartAddress(startList[i]);
      hexEditorWnd->setEndAddress(endList[i]);
      addTab(hexEditorWnd, tabList[i]);
   }
   setTabPosition(QTabWidget::South);
}
Ejemplo n.º 24
0
void ImprovedWorkspace::setTabbedMode(bool isTabbed)
{
    if(isTabbed)
    {
        setViewMode(QMdiArea::TabbedView);
        //setTabsClosable ( true );
        setTabsMovable ( true );
        setTabPosition(QTabWidget::North);

        /// make all subwindows visible.
        foreach(QMdiSubWindow* tmp, subWindowList())
        {
            tmp->setVisible(true);
            QAction* tmpAct = m_map->key(tmp);
            if(NULL!=tmpAct)
            {
                tmpAct->setChecked(true);
            }
            if(NULL!=tmp->widget())
            {
                tmp->widget()->setVisible(true);
            }
        }
    }
Ejemplo n.º 25
0
QT_BEGIN_NAMESPACE

MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent)
    : QMainWindow(parent)
    , m_bookmarkWidget(0)
    , m_filterCombo(0)
    , m_toolBarMenu(0)
    , m_cmdLine(cmdLine)
    , m_progressWidget(0)
    , m_qtDocInstaller(0)
    , m_connectedInitSignals(false)
{
    TRACE_OBJ

    setToolButtonStyle(Qt::ToolButtonFollowStyle);
    setDockOptions(dockOptions() | AllowNestedDocks);

    QString collectionFile;
    if (usesDefaultCollection()) {
        MainWindow::collectionFileDirectory(true);
        collectionFile = MainWindow::defaultHelpCollectionFileName();
    } else {
        collectionFile = cmdLine->collectionFile();
    }
    HelpEngineWrapper &helpEngineWrapper =
        HelpEngineWrapper::instance(collectionFile);
    BookmarkManager *bookMarkManager = BookmarkManager::instance();

    if (!initHelpDB(!cmdLine->collectionFileGiven())) {
        qDebug("Fatal error: Help engine initialization failed. "
            "Error message was: %s\nAssistant will now exit.",
            qPrintable(HelpEngineWrapper::instance().error()));
        std::exit(1);
    }

    m_centralWidget = new CentralWidget(this);
    setCentralWidget(m_centralWidget);

    m_indexWindow = new IndexWindow(this);
    QDockWidget *indexDock = new QDockWidget(tr("Index"), this);
    indexDock->setObjectName(QLatin1String("IndexWindow"));
    indexDock->setWidget(m_indexWindow);
    addDockWidget(Qt::LeftDockWidgetArea, indexDock);

    m_contentWindow = new ContentWindow;
    QDockWidget *contentDock = new QDockWidget(tr("Contents"), this);
    contentDock->setObjectName(QLatin1String("ContentWindow"));
    contentDock->setWidget(m_contentWindow);
    addDockWidget(Qt::LeftDockWidgetArea, contentDock);

    m_searchWindow = new SearchWidget(helpEngineWrapper.searchEngine());
    m_searchWindow->setFont(!helpEngineWrapper.usesBrowserFont() ? qApp->font()
        : helpEngineWrapper.browserFont());
    QDockWidget *searchDock = new QDockWidget(tr("Search"), this);
    searchDock->setObjectName(QLatin1String("SearchWindow"));
    searchDock->setWidget(m_searchWindow);
    addDockWidget(Qt::LeftDockWidgetArea, searchDock);

    QDockWidget *bookmarkDock = new QDockWidget(tr("Bookmarks"), this);
    bookmarkDock->setObjectName(QLatin1String("BookmarkWindow"));
    bookmarkDock->setWidget(m_bookmarkWidget
        = bookMarkManager->bookmarkDockWidget());
    addDockWidget(Qt::LeftDockWidgetArea, bookmarkDock);

    QDockWidget *openPagesDock = new QDockWidget(tr("Open Pages"), this);
    openPagesDock->setObjectName(QLatin1String("Open Pages"));
    OpenPagesManager *openPagesManager
        = OpenPagesManager::createInstance(this, usesDefaultCollection(), m_cmdLine->url());
    openPagesDock->setWidget(openPagesManager->openPagesWidget());
    addDockWidget(Qt::LeftDockWidgetArea, openPagesDock);

    connect(m_centralWidget, SIGNAL(addBookmark(QString, QString)),
        bookMarkManager, SLOT(addBookmark(QString, QString)));
    connect(bookMarkManager, SIGNAL(escapePressed()), this,
            SLOT(activateCurrentCentralWidgetTab()));
    connect(bookMarkManager, SIGNAL(setSource(QUrl)), m_centralWidget,
            SLOT(setSource(QUrl)));
    connect(bookMarkManager, SIGNAL(setSourceInNewTab(QUrl)),
        openPagesManager, SLOT(createPage(QUrl)));

    QHelpSearchEngine *searchEngine = helpEngineWrapper.searchEngine();
    connect(searchEngine, SIGNAL(indexingStarted()), this, SLOT(indexingStarted()));
    connect(searchEngine, SIGNAL(indexingFinished()), this, SLOT(indexingFinished()));

    QString defWindowTitle = tr("Qt Assistant");
    setWindowTitle(defWindowTitle);

    setupActions();
    statusBar()->show();
    m_centralWidget->connectTabBar();

    setupFilterToolbar();
    setupAddressToolbar();

    const QString windowTitle = helpEngineWrapper.windowTitle();
    setWindowTitle(windowTitle.isEmpty() ? defWindowTitle : windowTitle);
    QByteArray iconArray = helpEngineWrapper.applicationIcon();
    if (iconArray.size() > 0) {
        QPixmap pix;
        pix.loadFromData(iconArray);
        QIcon appIcon(pix);
        qApp->setWindowIcon(appIcon);
    } else {
        QIcon appIcon(QLatin1String(":/trolltech/assistant/images/assistant-128.png"));
        qApp->setWindowIcon(appIcon);
    }

    QToolBar *toolBar = addToolBar(tr("Bookmark Toolbar"));
    toolBar->setObjectName(QLatin1String("Bookmark Toolbar"));
    bookMarkManager->setBookmarksToolbar(toolBar);

    // Show the widget here, otherwise the restore geometry and state won't work
    // on x11.
    show();

    toolBar->hide();
    toolBarMenu()->addAction(toolBar->toggleViewAction());

    QByteArray ba(helpEngineWrapper.mainWindow());
    if (!ba.isEmpty())
        restoreState(ba);

    ba = helpEngineWrapper.mainWindowGeometry();
    if (!ba.isEmpty()) {
        restoreGeometry(ba);
    } else {
        tabifyDockWidget(contentDock, indexDock);
        tabifyDockWidget(indexDock, bookmarkDock);
        tabifyDockWidget(bookmarkDock, searchDock);
        contentDock->raise();
        const QRect screen = QApplication::desktop()->screenGeometry();
        resize(4*screen.width()/5, 4*screen.height()/5);
    }

    if (!helpEngineWrapper.hasFontSettings()) {
        helpEngineWrapper.setUseAppFont(false);
        helpEngineWrapper.setUseBrowserFont(false);
        helpEngineWrapper.setAppFont(qApp->font());
        helpEngineWrapper.setAppWritingSystem(QFontDatabase::Latin);
        helpEngineWrapper.setBrowserFont(qApp->font());
        helpEngineWrapper.setBrowserWritingSystem(QFontDatabase::Latin);
    } else {
        updateApplicationFont();
    }

    updateAboutMenuText();

    QTimer::singleShot(0, this, SLOT(insertLastPages()));
    if (m_cmdLine->enableRemoteControl())
        (void)new RemoteControl(this);

    if (m_cmdLine->contents() == CmdLineParser::Show)
        showContents();
    else if (m_cmdLine->contents() == CmdLineParser::Hide)
        hideContents();

    if (m_cmdLine->index() == CmdLineParser::Show)
        showIndex();
    else if (m_cmdLine->index() == CmdLineParser::Hide)
        hideIndex();

    if (m_cmdLine->bookmarks() == CmdLineParser::Show)
        showBookmarksDockWidget();
    else if (m_cmdLine->bookmarks() == CmdLineParser::Hide)
        hideBookmarksDockWidget();

    if (m_cmdLine->search() == CmdLineParser::Show)
        showSearch();
    else if (m_cmdLine->search() == CmdLineParser::Hide)
        hideSearch();

    if (m_cmdLine->contents() == CmdLineParser::Activate)
        showContents();
    else if (m_cmdLine->index() == CmdLineParser::Activate)
        showIndex();
    else if (m_cmdLine->bookmarks() == CmdLineParser::Activate)
        showBookmarksDockWidget();

    if (!m_cmdLine->currentFilter().isEmpty()) {
        const QString &curFilter = m_cmdLine->currentFilter();
        if (helpEngineWrapper.customFilters().contains(curFilter))
            helpEngineWrapper.setCurrentFilter(curFilter);
    }

    if (usesDefaultCollection())
        QTimer::singleShot(0, this, SLOT(lookForNewQtDocumentation()));
    else
        checkInitState();

    connect(&helpEngineWrapper, SIGNAL(documentationRemoved(QString)),
            this, SLOT(documentationRemoved(QString)));
    connect(&helpEngineWrapper, SIGNAL(documentationUpdated(QString)),
            this, SLOT(documentationUpdated(QString)));

    setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North);
    GlobalActions::instance()->updateActions();
    if (helpEngineWrapper.addressBarEnabled())
        showNewAddress();
}
Ejemplo n.º 26
0
KonqFrameTabs::KonqFrameTabs(QWidget *parent, KonqFrameContainerBase *parentContainer,
                             KonqViewManager *viewManager)
    : KTabWidget(parent),
      m_pPopupMenu(0),
      m_pSubPopupMenuTab(0),
      m_rightWidget(0), m_leftWidget(0), m_alwaysTabBar(false)
{
    // Set an object name so the widget style can identify this widget.
    setObjectName(QStringLiteral("kde_konq_tabwidget"));
    setDocumentMode(true);

    KAcceleratorManager::setNoAccel(this);

    tabBar()->setWhatsThis(i18n("This bar contains the list of currently open tabs. Click on a tab to make it "
                                "active. You can also use keyboard shortcuts to "
                                "navigate through tabs. The text on the tab shows the content "
                                "currently open in it; place your mouse over the tab to see the full title, in "
                                "case it has been shortened to fit the tab width."));
    //qDebug() << "KonqFrameTabs::KonqFrameTabs()";

    m_pParentContainer = parentContainer;
    m_pActiveChild = 0L;
    m_pViewManager = viewManager;

    m_permanentCloseButtons = KonqSettings::permanentCloseButton();
    if (m_permanentCloseButtons) {
        setTabsClosable(true);
    }
    tabBar()->setSelectionBehaviorOnRemove(
        KonqSettings::tabCloseActivatePrevious() ? QTabBar::SelectPreviousTab : QTabBar::SelectRightTab);

    if (KonqSettings::tabPosition() == QLatin1String("Bottom")) {
        setTabPosition(QTabWidget::South);
    }
    connect(this, SIGNAL(closeRequest(QWidget*)), SLOT(slotCloseRequest(QWidget*)));
    connect(this, SIGNAL(removeTabPopup()),
            m_pViewManager->mainWindow(), SLOT(slotRemoveTabPopup()));

    if (KonqSettings::addTabButton()) {
        m_leftWidget = new NewTabToolButton(this);
        connect(m_leftWidget, SIGNAL(clicked()),
                m_pViewManager->mainWindow(), SLOT(slotAddTab()));
        connect(m_leftWidget, SIGNAL(testCanDecode(const QDragMoveEvent*,bool&)),
                SLOT(slotTestCanDecode(const QDragMoveEvent*,bool&)));
        connect(m_leftWidget, SIGNAL(receivedDropEvent(QDropEvent*)),
                SLOT(slotReceivedDropEvent(QDropEvent*)));
        m_leftWidget->setIcon(QIcon::fromTheme(QStringLiteral("tab-new")));
        m_leftWidget->adjustSize();
        m_leftWidget->setToolTip(i18n("Open a new tab"));
        setCornerWidget(m_leftWidget, Qt::TopLeftCorner);
    }
    if (KonqSettings::closeTabButton()) {
        m_rightWidget = new QToolButton(this);
        connect(m_rightWidget, SIGNAL(clicked()),
                m_pViewManager->mainWindow(), SLOT(slotRemoveTab()));
        m_rightWidget->setIcon(QIcon::fromTheme(QStringLiteral("tab-close")));
        m_rightWidget->adjustSize();
        m_rightWidget->setToolTip(i18n("Close the current tab"));
        setCornerWidget(m_rightWidget, Qt::TopRightCorner);
    }

    setAutomaticResizeTabs(true);
    setMovable(true);

    connect(tabBar(), SIGNAL(tabMoved(int,int)),
            SLOT(slotMovedTab(int,int)));
    connect(this, SIGNAL(movedTab(int,int)),
            SLOT(slotMovedTab(int,int)));
    connect(this, SIGNAL(mouseMiddleClick()),
            SLOT(slotMouseMiddleClick()));
    connect(this, SIGNAL(mouseMiddleClick(QWidget*)),
            SLOT(slotMouseMiddleClick(QWidget*)));
    connect(this, SIGNAL(mouseDoubleClick()),
            m_pViewManager->mainWindow(), SLOT(slotAddTab()));

    connect(this, SIGNAL(testCanDecode(const QDragMoveEvent*,bool&)),
            SLOT(slotTestCanDecode(const QDragMoveEvent*,bool&)));
    connect(this, SIGNAL(receivedDropEvent(QDropEvent*)),
            SLOT(slotReceivedDropEvent(QDropEvent*)));
    connect(this, SIGNAL(receivedDropEvent(QWidget*,QDropEvent*)),
            SLOT(slotReceivedDropEvent(QWidget*,QDropEvent*)));
    connect(this, SIGNAL(initiateDrag(QWidget*)),
            SLOT(slotInitiateDrag(QWidget*)));

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#pragma message("KF5: revert the commit that introduced this line")
#endif
    tabBar()->installEventFilter(this);
    initPopupMenu();
}
Ejemplo n.º 27
0
void VolumeViewer::initUserInterfaceWidgets()
{
  // Create a toolbar at the top of the window.
  QToolBar *toolbar = addToolBar("toolbar");

  // Add preferences widget and callback.
  PreferencesDialog *preferencesDialog = new PreferencesDialog(this, boundingBox);
  QAction *showPreferencesAction = new QAction("Preferences", this);
  connect(showPreferencesAction, SIGNAL(triggered()), preferencesDialog, SLOT(show()));
  toolbar->addAction(showPreferencesAction);

  // Add the "auto rotate" widget and callback.
  autoRotateAction = new QAction("Auto rotate", this);
  autoRotateAction->setCheckable(true);
  connect(autoRotateAction, SIGNAL(toggled(bool)), this, SLOT(autoRotate(bool)));
  toolbar->addAction(autoRotateAction);

  // Add the "next timestep" widget and callback.
  QAction *nextTimeStepAction = new QAction("Next timestep", this);
  connect(nextTimeStepAction, SIGNAL(triggered()), this, SLOT(nextTimeStep()));
  toolbar->addAction(nextTimeStepAction);

  // Add the "play timesteps" widget and callback.
  QAction *playTimeStepsAction = new QAction("Play timesteps", this);
  playTimeStepsAction->setCheckable(true);
  connect(playTimeStepsAction, SIGNAL(toggled(bool)), this, SLOT(playTimeSteps(bool)));
  toolbar->addAction(playTimeStepsAction);

  // Connect the "play timesteps" timer.
  connect(&playTimeStepsTimer, SIGNAL(timeout()), this, SLOT(nextTimeStep()));

  // Add the "add geometry" widget and callback.
  QAction *addGeometryAction = new QAction("Add geometry", this);
  connect(addGeometryAction, SIGNAL(triggered()), this, SLOT(addGeometry()));
  toolbar->addAction(addGeometryAction);

  // Add the "screenshot" widget and callback.
  QAction *screenshotAction = new QAction("Screenshot", this);
  connect(screenshotAction, SIGNAL(triggered()), this, SLOT(screenshot()));
  toolbar->addAction(screenshotAction);

  // Create the transfer function editor dock widget, this widget modifies the transfer function directly.
  QDockWidget *transferFunctionEditorDockWidget = new QDockWidget("Transfer Function", this);
  transferFunctionEditor = new TransferFunctionEditor(transferFunction);
  transferFunctionEditorDockWidget->setWidget(transferFunctionEditor);
  connect(transferFunctionEditor, SIGNAL(committed()), this, SLOT(commitVolumes()));
  connect(transferFunctionEditor, SIGNAL(committed()), this, SLOT(render()));
  addDockWidget(Qt::LeftDockWidgetArea, transferFunctionEditorDockWidget);

  // Set the transfer function editor widget to its minimum allowed height, to leave room for other dock widgets.
  transferFunctionEditor->setMaximumHeight(transferFunctionEditor->minimumSize().height());

  // Create slice editor dock widget.
  QDockWidget *sliceEditorDockWidget = new QDockWidget("Slices", this);
  sliceEditor = new SliceEditor(boundingBox);
  sliceEditorDockWidget->setWidget(sliceEditor);
  connect(sliceEditor, SIGNAL(slicesChanged(std::vector<SliceParameters>)), this, SLOT(setSlices(std::vector<SliceParameters>)));
  addDockWidget(Qt::LeftDockWidgetArea, sliceEditorDockWidget);

  // Create isosurface editor dock widget.
  QDockWidget *isosurfaceEditorDockWidget = new QDockWidget("Isosurfaces", this);
  isosurfaceEditor = new IsosurfaceEditor();
  isosurfaceEditorDockWidget->setWidget(isosurfaceEditor);
  connect(isosurfaceEditor, SIGNAL(isovaluesChanged(std::vector<float>)), this, SLOT(setIsovalues(std::vector<float>)));
  addDockWidget(Qt::LeftDockWidgetArea, isosurfaceEditorDockWidget);

  // Create the light editor dock widget, this widget modifies the light directly.
  QDockWidget *lightEditorDockWidget = new QDockWidget("Lights", this);
  LightEditor *lightEditor = new LightEditor(ambientLight, directionalLight);
  lightEditorDockWidget->setWidget(lightEditor);
  connect(lightEditor, SIGNAL(lightsChanged()), this, SLOT(render()));
  addDockWidget(Qt::LeftDockWidgetArea, lightEditorDockWidget);

  // Create the probe dock widget.
  QDockWidget *probeDockWidget = new QDockWidget("Probe", this);
  probeWidget = new ProbeWidget(this);
  probeDockWidget->setWidget(probeWidget);
  addDockWidget(Qt::LeftDockWidgetArea, probeDockWidget);

  // Tabify dock widgets.
  tabifyDockWidget(transferFunctionEditorDockWidget, sliceEditorDockWidget);
  tabifyDockWidget(transferFunctionEditorDockWidget, isosurfaceEditorDockWidget);
  tabifyDockWidget(transferFunctionEditorDockWidget, lightEditorDockWidget);
  tabifyDockWidget(transferFunctionEditorDockWidget, probeDockWidget);

  // Tabs on top.
  setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::North);

  // Default to showing transfer function tab widget.
  transferFunctionEditorDockWidget->raise();

  // Add the current OSPRay object file label to the bottom status bar.
  statusBar()->addWidget(&currentFilenameInfoLabel);
}
Ejemplo n.º 28
0
/**
 * Constructor
 */
PsiTabWidget::PsiTabWidget(QWidget *parent)
    : QWidget(parent) {
    tabsPosition_ = QTabWidget::East; // impossible => uninitialised state
    tabBar_ = new PsiTabBar(this);

    bool multiRow = PsiOptions::instance()->getOption("options.ui.tabs.multi-rows", true).toBool();
    tabBar_->setMultiRow(multiRow);
    tabBar_->setUsesScrollButtons(!multiRow);
    layout_ = new QVBoxLayout(this);
    layout_->setMargin(0);
    layout_->setSpacing(0);
    barLayout_ = new QHBoxLayout;
    layout_->addLayout(barLayout_);
    barLayout_->setMargin(0);
    barLayout_->setSpacing(0);
    barLayout_->addWidget(tabBar_, 2);
    barLayout_->setAlignment(Qt::AlignLeft);

    int buttonwidth = qMax(tabBar_->style()->pixelMetric(QStyle::PM_TabBarScrollButtonWidth, 0, tabBar_),
                           QApplication::globalStrut().width());

    downButton_ = new QToolButton(this);
    downButton_->setMinimumSize(3,3);
    downButton_->setFixedWidth(buttonwidth);
    downButton_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    menu_ = new QMenu(this);
    downButton_->setMenu(menu_);
    downButton_->setStyleSheet(" QToolButton::menu-indicator { image:none } ");
    connect(menu_, SIGNAL(aboutToShow()), SLOT(menu_aboutToShow()));
    connect(menu_, SIGNAL(triggered(QAction*)), SLOT(menu_triggered(QAction*)));
    barLayout_->addWidget(downButton_);
    barLayout_->setAlignment(downButton_, Qt::AlignBottom);

    closeButton_ = new QToolButton(this);
    closeButton_->setMinimumSize(3,3);
    closeButton_->setFixedWidth(buttonwidth);
    closeButton_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    barLayout_->addWidget(closeButton_);
    barLayout_->setAlignment(closeButton_, Qt::AlignBottom);
    closeButton_->setText("x");
    downButton_->setArrowType(Qt::DownArrow);
    downButton_->setPopupMode(QToolButton::InstantPopup);
    stacked_ = new QStackedLayout(layout_);

    setTabPosition(QTabWidget::North);
    setLooks();

    if (!PsiOptions::instance()->getOption("options.ui.tabs.show-tab-buttons").toBool()) {
        closeButton_->hide();
        downButton_->hide();
    }
#if QT_VERSION >= 0x040500
    if (!PsiOptions::instance()->getOption("options.ui.tabs.show-tab-close-buttons").toBool()) {
        tabBar_->setTabsClosable(false);
    }
#endif
    connect( tabBar_, SIGNAL(mouseDoubleClickTab(int)), SLOT(mouseDoubleClickTab(int)));
    connect( tabBar_, SIGNAL(mouseMiddleClickTab(int)), SLOT(mouseMiddleClickTab(int)));
    connect( tabBar_, SIGNAL( currentChanged(int)), SLOT(tab_currentChanged(int)));
    connect( tabBar_, SIGNAL( contextMenu(QContextMenuEvent*,int)), SLOT( tab_contextMenu(QContextMenuEvent*,int)));
    connect( closeButton_, SIGNAL(clicked()), SIGNAL(closeButtonClicked()));
    connect(tabBar_, SIGNAL(tabMoved(int,int)),SLOT(widgetMoved(int,int)));
    connect(tabBar_, SIGNAL(tabCloseRequested(int)),SIGNAL(tabCloseRequested(int)));
}
Ejemplo n.º 29
0
void MainWindow::initWidgets()
{
	setTabPosition(Qt::RightDockWidgetArea, QTabWidget::West);
	_viewerWidget = new ViewerWidget(osgViewer::ViewerBase::SingleThreaded);
	setCentralWidget(_viewerWidget);
	_projectObject = new ProjectObject(DEFAULT_VIEWID, _viewerWidget);
	//init default show dockwidget
	_propertyDockWidget = new PropertyDockWidget(this);
	_propertyDockWidget->setObjectName("PropertyDockWidget");
	_propertyDockWidget->setWindowTitle(QWidget::tr("属性窗"));
	_propertyDockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
	_propertyDockWidget->setAllowedAreas(Qt::RightDockWidgetArea);
	_propertyDockWidget->setDisabled(true);
	addDockWidget(Qt::RightDockWidgetArea, _propertyDockWidget);
	_builtinResourcesDockWidget = new BuiltinResourcesDockWidget(this);
	_builtinResourcesDockWidget->setObjectName("BuiltinResourcesDockWidget");
	_builtinResourcesDockWidget->setWindowTitle(QWidget::tr("内置资源列表"));
	_builtinResourcesDockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
	_builtinResourcesDockWidget->setAllowedAreas(Qt::RightDockWidgetArea);
	_builtinResourcesDockWidget->setDisabled(true);
	addDockWidget(Qt::RightDockWidgetArea, _builtinResourcesDockWidget);
	tabifyDockWidget(_propertyDockWidget, _builtinResourcesDockWidget);
	_vdsResourcesDockWidget = new VDSResourcesDockWidget(this);
	_vdsResourcesDockWidget->setObjectName("VDSResourcesDockWidget");
	_vdsResourcesDockWidget->setWindowTitle(QWidget::tr("资源列表"));
	_vdsResourcesDockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
	_vdsResourcesDockWidget->setAllowedAreas(Qt::RightDockWidgetArea);
	_vdsResourcesDockWidget->setDisabled(true);
	addDockWidget(Qt::RightDockWidgetArea, _vdsResourcesDockWidget);
	tabifyDockWidget(_propertyDockWidget, _vdsResourcesDockWidget);
	connect(&SignalsSlotsCenter::instance(), SIGNAL(signalActiveWidget(QWidget*, bool)), this, SLOT(slotActiveWidget(QWidget*, bool)));
	connect(&SignalsSlotsCenter::instance(), SIGNAL(signalProjectChanged(const QString&)), this, SLOT(slotProjectChanged(const QString&)));
	connect(&SignalsSlotsCenter::instance(), SIGNAL(signalUpdateUndoRedoState(int, bool)), this, SLOT(slotUpdateUndoRedoState(int, bool)));
	_csharpAssemblyDockWidget = new CSharpAssemblyDockWidget(this);
	_csharpAssemblyDockWidget->setObjectName("CSharpAssemblyDockWidget");
	_csharpAssemblyDockWidget->setWindowTitle(QWidget::tr("脚本列表"));
	_csharpAssemblyDockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
	_csharpAssemblyDockWidget->setAllowedAreas(Qt::BottomDockWidgetArea);
	_csharpAssemblyDockWidget->setDisabled(true);
	addDockWidget(Qt::BottomDockWidgetArea, _csharpAssemblyDockWidget);
	//init hide dockwidget
	_objectsTreeDockWidget = new ObjectsTreeDockWidget(this);
	_objectsTreeDockWidget->setObjectName("ObjectsTreeDockWidget");
	_objectsTreeDockWidget->setWindowTitle(QWidget::tr("场景树"));
	_objectsTreeDockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
	_objectsTreeDockWidget->setAllowedAreas(Qt::RightDockWidgetArea);
	addDockWidget(Qt::RightDockWidgetArea, _objectsTreeDockWidget);
	_objectsTreeDockWidget->setDisabled(true);
	_objectsTreeDockWidget->hide();
	_viewPointDockWidget = new ViewPointWidget(this);
	_viewPointDockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
	_viewPointDockWidget->setAllowedAreas(Qt::RightDockWidgetArea);
	_viewPointDockWidget->setObjectName("ViewPointDockWidget");
	_viewPointDockWidget->setWindowTitle(QWidget::tr("视点编辑"));
	addDockWidget(Qt::RightDockWidgetArea, _viewPointDockWidget);
	_viewPointDockWidget->setDisabled(true);
	_viewPointDockWidget->hide();
	_viewPointAnimationWidget = new ViewPointAnimationWidget(this);
	_viewPointAnimationWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
	_viewPointAnimationWidget->setAllowedAreas(Qt::RightDockWidgetArea);
	_viewPointAnimationWidget->setObjectName("ViewPointAnimationWidget");
	_viewPointAnimationWidget->setWindowTitle(QWidget::tr("视点动画编辑"));
	addDockWidget(Qt::RightDockWidgetArea, _viewPointAnimationWidget);
	_viewPointAnimationWidget->setDisabled(true);
	_viewPointAnimationWidget->hide();
	_physicalEditDockWidget = new PhysicalEditDockWidget(this);
	_physicalEditDockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
	_physicalEditDockWidget->setAllowedAreas(Qt::RightDockWidgetArea);
	_physicalEditDockWidget->setObjectName("PhysicalEditDockWidget");
	_physicalEditDockWidget->setWindowTitle(QWidget::tr("物理编辑"));
	addDockWidget(Qt::RightDockWidgetArea, _physicalEditDockWidget);
	_physicalEditDockWidget->setDisabled(true);
	_physicalEditDockWidget->hide();
	_riverEditDockWidget = new RiverEditDockWidget(this);
	_riverEditDockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
	_riverEditDockWidget->setAllowedAreas(Qt::RightDockWidgetArea);
	_riverEditDockWidget->setObjectName("RiverEditDockWidget");
	_riverEditDockWidget->setWindowTitle(QWidget::tr("河流编辑"));
	addDockWidget(Qt::RightDockWidgetArea, _riverEditDockWidget);
	_riverEditDockWidget->setDisabled(true);
	_riverEditDockWidget->hide();
	_plotEditDockWidget = new PlotEditDockWidget(this);
	_plotEditDockWidget->setObjectName("PlotEditDockWidget");
	_plotEditDockWidget->setWindowTitle(QWidget::tr("剧情编辑窗口"));
	_plotEditDockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
	_plotEditDockWidget->setAllowedAreas(Qt::BottomDockWidgetArea);
	_plotEditDockWidget->setDisabled(true);
	addDockWidget(Qt::BottomDockWidgetArea, _plotEditDockWidget);
	_plotEditDockWidget->hide();
	_plantBrushDockWidget = new PlantBrushDockWidget(this);
	_plantBrushDockWidget->setObjectName("PlantBrushDockWidget");
	_plantBrushDockWidget->setWindowTitle(QWidget::tr("植被编辑"));
	_plantBrushDockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
	_plantBrushDockWidget->setAllowedAreas(Qt::RightDockWidgetArea);
	_plantBrushDockWidget->setDisabled(true);
	_plantBrushDockWidget->hide();
	addDockWidget(Qt::RightDockWidgetArea, _plantBrushDockWidget);
}
Ejemplo n.º 30
0
MapEditor::MapEditor(QWidget* par, const QString& map, const QString& ressourceList):QMainWindow(par)
{
    m_mapWidget = NULL; m_currentItemIndex=0;

    pgrdia=new QProgressDialog(tr("Chargement en cours..."), tr("Veuillez patienter.."), 0, 100, this);
    pgrdia->setWindowModality(Qt::WindowModal);
    pgrdia->setMinimumDuration(100);
    pgrdia->hide();

    setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North);
    setDockNestingEnabled(true);

    m_rsRegExp.setPatternSyntax(QRegExp::Wildcard);

    setWindowTitle(tr("Éditeur de carte"));

    { ///MAP PROPERTIES DOCK
    QDockWidget* dw_mapProperties = new QDockWidget(tr("Propriétés de la carte"), this);
    dw_mapProperties->setWhatsThis(tr("Un dock regroupant quelques propriétés de la carte"));
    dw_mapProperties->setFeatures(QDockWidget::NoDockWidgetFeatures);
    dw_mapProperties->setFeatures(QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable);
    QWidget *w_mapProperties = new QWidget(dw_mapProperties);
    dw_mapProperties->setWidget(w_mapProperties);

    addDockWidget(Qt::TopDockWidgetArea, dw_mapProperties);

    QVBoxLayout *l_mapProperties = new QVBoxLayout(w_mapProperties);
    w_mapProperties->setLayout(l_mapProperties);

    {
        QHBoxLayout *lay=new QHBoxLayout();
        l_mapProperties->addLayout(lay);
        m_mapSizeX = new QSpinBox(this);
        m_mapSizeX->setRange(0,MAP_MAX_SIZE);
        m_mapSizeX->setEnabled(false);
        lay->addWidget(m_mapSizeX);


        m_mapSizeY = new QSpinBox(this);
        m_mapSizeY->setRange(0,MAP_MAX_SIZE);
        m_mapSizeY->setEnabled(false);
        lay->addWidget(m_mapSizeY);
    }
    {
        m_mapNameLabel=new QLabel(this);
        l_mapProperties->addWidget(m_mapNameLabel);
        m_sendingBtn=new QPushButton(tr("(MJ) Envoyer la carte au serveur"), this);
        l_mapProperties->addWidget(m_sendingBtn);
        setSendingButtonEnabled(false);
        connect(m_sendingBtn, SIGNAL(pressed()), this, SLOT(btnMapSend()));
    }
    }

    { ///CASE PROPERTIES DOCK
    QDockWidget* dw_caseProperties = new QDockWidget(tr("Propriétés de la case"), this);
    dw_caseProperties->setWhatsThis(tr("Un dock regroupant quelques propriétés de la case sélectionnée"));
    dw_caseProperties->setFeatures(QDockWidget::NoDockWidgetFeatures);
    dw_caseProperties->setFeatures(QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable);
    QWidget *w_caseProperties = new QWidget(dw_caseProperties);
    dw_caseProperties->setWidget(w_caseProperties);

    addDockWidget(Qt::RightDockWidgetArea, dw_caseProperties);

    QVBoxLayout *l_caseProperties = new QVBoxLayout(w_caseProperties);
    w_caseProperties->setLayout(l_caseProperties);

    {

        m_selectedCaseLabel = new QLabel(this);
        l_caseProperties->addWidget(m_selectedCaseLabel);

        m_selectedCaseRSID = new QSpinBox(this);
        m_selectedCaseRSID->setRange(0,MAX_LOADED_RESSOURCES);
        m_selectedCaseRSID->setEnabled(false);
        l_caseProperties->addWidget(m_selectedCaseRSID);
        connect(m_selectedCaseRSID, SIGNAL(valueChanged(int)), this, SLOT(changeCurrentCaseRSID(int)));

        {
            QGroupBox* gb = new QGroupBox(tr("Objets sur la case :"), this);
            m_mapCaseItemList = new QListWidget(this);
            connect(m_mapCaseItemList, SIGNAL(clicked(const QModelIndex&)), this, SLOT(selectMapItem(const QModelIndex&)));
            m_addItem = new QPushButton(tr("Ajouter un objet"), this);
            m_addItem->setEnabled(false);
            connect(m_addItem, SIGNAL(pressed()), this, SLOT(addMapObject()));
            QVBoxLayout* lyt = new QVBoxLayout();
            gb->setLayout(lyt); lyt->addWidget(m_mapCaseItemList); lyt->addWidget(m_addItem);
            l_caseProperties->addWidget(gb);
        }
    }
    }

    { ///MAPITEMS DOCK
    QDockWidget* dw_mapItems = new QDockWidget(tr("Objets de la carte"), this);
    dw_mapItems->setWhatsThis(tr("Un dock permettant la gestion des objets de la carte"));
    dw_mapItems->setFeatures(QDockWidget::NoDockWidgetFeatures);
    dw_mapItems->setFeatures(QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable);
    QWidget *w_mapItems = new QWidget(dw_mapItems);
    dw_mapItems->setWidget(w_mapItems);

    addDockWidget(Qt::RightDockWidgetArea, dw_mapItems);

    QVBoxLayout *l_mapItems = new QVBoxLayout(w_mapItems);
    w_mapItems->setLayout(l_mapItems);
    {
        m_mapItemList = new QListWidget(this);
        connect(m_mapItemList, SIGNAL(clicked(const QModelIndex&)), this, SLOT(selectMapItem(const QModelIndex&)));
        l_mapItems->addWidget(m_mapItemList);
        m_mapItemName = new QLabel(this);
        l_mapItems->addWidget(m_mapItemName);
        m_mapItemRSID = new QSpinBox(this); m_mapItemRSID->setRange(0,MAX_LOADED_RESSOURCES); m_mapItemRSID->setPrefix(tr("RSID : ")); m_mapItemRSID->setEnabled(false);
        l_mapItems->addWidget(m_mapItemRSID);
        m_mapItemPos = new QLabel(this);
        l_mapItems->addWidget(m_mapItemPos);
        l_mapItems->addWidget(new QLabel(tr("Teinte :"), this));
        m_mapItemColorViewer = new QColorViewer(this);
        l_mapItems->addWidget(m_mapItemColorViewer);
        m_removeItem = new QPushButton(tr("Supprimer l'objet"), this);
        l_mapItems->addWidget(m_removeItem);
        connect(m_removeItem, SIGNAL(pressed()), this, SLOT(removeMapObject()));
    }

    }

    { ///RSSMNGR PROPERTIES DOCK
    QDockWidget* dw_rssMngrProperties = new QDockWidget(tr("Gestionnaire de ressources"), this);
    dw_rssMngrProperties->setWhatsThis(tr("Un dock regroupant les différentes ressources chargées dans l'éditeur"));
    dw_rssMngrProperties->setFeatures(QDockWidget::NoDockWidgetFeatures);
    dw_rssMngrProperties->setFeatures(QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable);
    QWidget *w_rssMngrProperties = new QWidget(dw_rssMngrProperties);
    dw_rssMngrProperties->setWidget(w_rssMngrProperties);

    addDockWidget(Qt::RightDockWidgetArea, dw_rssMngrProperties);
    QVBoxLayout *l_rssMngrProperties = new QVBoxLayout(w_rssMngrProperties);
    w_rssMngrProperties->setLayout(l_rssMngrProperties);
    {
        m_rsMngrFilter = new QLineEdit(this); m_rsMngrFilter->setPlaceholderText(tr("Filtre..."));
        connect(m_rsMngrFilter, SIGNAL(textEdited(const QString&)),this, SLOT(changeRsMngrFilter(const QString&)));
        l_rssMngrProperties->addWidget(m_rsMngrFilter);

        m_rsMngrWidget = new QTableWidget(0,2, this);
        m_rsMngrWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
        m_rsMngrWidget->setSelectionMode(QAbstractItemView::SingleSelection);
        m_rsMngrWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
        m_rsMngrWidget->setSortingEnabled(true);
        m_rsMngrWidget->verticalHeader()->hide();
        l_rssMngrProperties->addWidget(m_rsMngrWidget);

        m_rsMngrEdit = new QPushButton(tr("Modifier..."), this);
        m_rsMngrEdit->setEnabled(false);
        l_rssMngrProperties->addWidget(m_rsMngrEdit);

        connect(m_rsMngrEdit, SIGNAL(pressed()), this, SLOT(modifyRssMngr()));

        m_rsMngrAdd = new QPushButton(tr("Ajouter..."), this);
        m_rsMngrAdd->setEnabled(false);
        l_rssMngrProperties->addWidget(m_rsMngrAdd);

        connect(m_rsMngrAdd, SIGNAL(pressed()), this, SLOT(addRssMngr()));
    }
    }

    QMenu *fileMenu = menuBar()->addMenu(tr("&Fichier"));

    QAction *ac_new= fileMenu->addAction(tr("&Nouvelle carte..."));
    connect(ac_new, SIGNAL(triggered()), this, SLOT(newMap()));

    QAction *ac_open= fileMenu->addAction(tr("&Charger une carte..."));
    connect(ac_open, SIGNAL(triggered()), this, SLOT(loadMap()));

    QAction *ac_save = fileMenu->addAction(tr("Sauvegarder &la carte..."));
    connect(ac_save, SIGNAL(triggered()), this, SLOT(saveMap()));

    QAction *ac_saveAs = fileMenu->addAction(tr("Sa&uvegarder la carte sous..."));
    connect(ac_saveAs, SIGNAL(triggered()), this, SLOT(saveMapAs()));

    QAction *ac_quit = fileMenu->addAction(tr("&Quitter..."));
    connect(ac_quit, SIGNAL(triggered()), this, SLOT(close()));


    QMenu *toolMenu = menuBar()->addMenu(tr("&Outils"));
    QAction *ac_replace= toolMenu->addAction(tr("&Remplacer..."));
    connect(ac_replace, SIGNAL(triggered()), this, SLOT(replaceRSID()));
    QAction *ac_copy= toolMenu->addAction(tr("Copier...")); ac_copy->setShortcut(QKeySequence::Copy);
    connect(ac_copy, SIGNAL(triggered()), this, SLOT(copy()));
    QAction *ac_paste= toolMenu->addAction(tr("Coller...")); ac_paste->setShortcut(QKeySequence::Paste);
    connect(ac_paste, SIGNAL(triggered()), this, SLOT(paste()));

    QMenu *exportMenu = menuBar()->addMenu(tr("&Export"));
    QAction *ac_ex_rss= exportMenu->addAction(tr("... la liste de ressources"));
    connect(ac_ex_rss,SIGNAL(triggered()),this,SLOT(exportRss()));
    QAction *ac_ex_map= exportMenu->addAction(tr("... la matrice de la carte"));
    connect(ac_ex_map,SIGNAL(triggered()),this,SLOT(exportMap()));


    m_hoveredCaseLabel = new QLabel(this);
    statusBar()->addWidget(m_hoveredCaseLabel);

    m_mapName=map;
    m_ressourcePackName=ressourceList;
    if(!map.isEmpty())
    {
        loadMap(map,m_ressourcePackName);
    }

    enableMapSystem(false);
}