예제 #1
0
KJumpingCube::KJumpingCube()
  : view(new KCubeBoxWidget(5, this, "KCubeBoxWidget"))
{
   connect(view,SIGNAL(playerChanged(int)),SLOT(changePlayer(int)));
   connect(view,SIGNAL(stoppedMoving()),SLOT(disableStop()));
   connect(view,SIGNAL(stoppedThinking()),SLOT(disableStop()));
   connect(view,SIGNAL(startedMoving()),SLOT(enableStop_Moving()));
   connect(view,SIGNAL(startedThinking()),SLOT(enableStop_Thinking()));
   connect(view,SIGNAL(playerWon(int)),SLOT(showWinner(int)));

   // tell the KMainWindow that this is indeed the main widget
   setCentralWidget(view);

   // init statusbar
   QString s = i18n("Current player:");
   statusBar()->insertItem(s,ID_STATUS_TURN_TEXT, false);
   statusBar()->changeItem(s,ID_STATUS_TURN_TEXT);
   statusBar()->setItemAlignment (ID_STATUS_TURN_TEXT, AlignLeft | AlignVCenter);
   statusBar()->setFixedHeight( statusBar()->sizeHint().height() );
 
   currentPlayer = new QWidget(this, "currentPlayer");
   currentPlayer->setFixedWidth(40);
   statusBar()->addWidget(currentPlayer, ID_STATUS_TURN, false);
   statusBar()->setItemAlignment(ID_STATUS_TURN, AlignLeft | AlignVCenter);

   initKAction();
   changePlayer(1);
}
예제 #2
0
KJumpingCube::KJumpingCube()
{
  // Make a KCubeBoxWidget with the user's currently preferred number of cubes.
   qDebug() << "KJumpingCube::KJumpingCube() CONSTRUCTOR";
   m_view = new KCubeBoxWidget (Prefs::cubeDim(), this);
   m_game = new Game (Prefs::cubeDim(), m_view, this);
   m_view->makeStatusPixmaps (30);

   connect(m_game,SIGNAL(playerChanged(int)),SLOT(changePlayerColor(int)));
   connect(m_game,SIGNAL(buttonChange(bool,bool,QString)),
                  SLOT(changeButton(bool,bool,QString)));
   connect(m_game,SIGNAL(statusMessage(QString,bool)),
                  SLOT(statusMessage(QString,bool)));

   // Tell the KMainWindow that this is indeed the main widget.
   setCentralWidget (m_view);

   // init statusbar
   QString s = i18n("Current player:");
   statusBar()->addPermanentWidget (new QLabel (s));

   currentPlayer = new QLabel ();
   currentPlayer->setFrameStyle (QFrame::NoFrame);
   changePlayerColor(One);
   statusBar()->addPermanentWidget (currentPlayer);

   initKAction();

   connect (m_game, SIGNAL (setAction(Action,bool)),
                    SLOT   (setAction(Action,bool)));
   m_game->gameActions (NEW);		// Start a new game.
}
예제 #3
0
파일: dbgmainwnd.cpp 프로젝트: albfan/kdbg
DebuggerMainWnd::DebuggerMainWnd() :
	KXmlGuiWindow(),
	m_debugger(0),
#ifdef GDB_TRANSCRIPT
	m_transcriptFile(GDB_TRANSCRIPT),
#endif
	m_outputTermCmdStr(defaultTermCmdStr),
	m_outputTermProc(new QProcess),
	m_ttyLevel(-1),			/* no tty yet */
	m_popForeground(false),
	m_backTimeout(1000),
	m_tabWidth(0),
	m_sourceFilter(defaultSourceFilter),
	m_headerFilter(defaultHeaderFilter),
	m_animation(0),
	m_statusActive(i18n("active"))
{
    setDockNestingEnabled(true);

    m_filesWindow = new WinStack(this);
    setCentralWidget(m_filesWindow);

    QDockWidget* dw1 = createDockWidget("Stack", i18n("Stack"));
    m_btWindow = new QListWidget(dw1);
    dw1->setWidget(m_btWindow);
    QDockWidget* dw2 = createDockWidget("Locals", i18n("Locals"));
    m_localVariables = new ExprWnd(dw2, i18n("Variable"));
    dw2->setWidget(m_localVariables);
    QDockWidget* dw3 = createDockWidget("Watches", i18n("Watches"));
    m_watches = new WatchWindow(dw3);
    dw3->setWidget(m_watches);
    QDockWidget* dw4 = createDockWidget("Registers", i18n("Registers"));
    m_registers = new RegisterView(dw4);
    dw4->setWidget(m_registers);
    QDockWidget* dw5 = createDockWidget("Breakpoints", i18n("Breakpoints"));
    m_bpTable = new BreakpointTable(dw5);
    dw5->setWidget(m_bpTable);
    QDockWidget* dw6 = createDockWidget("Output", i18n("Output"));
    m_ttyWindow = new TTYWindow(dw6);
    dw6->setWidget(m_ttyWindow);
    QDockWidget* dw7 = createDockWidget("Threads", i18n("Threads"));
    m_threads = new ThreadList(dw7);
    dw7->setWidget(m_threads);
    QDockWidget* dw8 = createDockWidget("Memory", i18n("Memory"));
    m_memoryWindow = new MemoryWindow(dw8);
    dw8->setWidget(m_memoryWindow);

    m_debugger = new KDebugger(this, m_localVariables, m_watches->watchVariables(), m_btWindow);

    connect(m_debugger, SIGNAL(updateStatusMessage()), SLOT(slotNewStatusMsg()));
    connect(m_debugger, SIGNAL(updateUI()), SLOT(updateUI()));
    connect(m_debugger, SIGNAL(breakpointsChanged()), SLOT(updateLineItems()));
    connect(m_debugger, SIGNAL(debuggerStarting()), SLOT(slotDebuggerStarting()));
    m_bpTable->setDebugger(m_debugger);
    m_memoryWindow->setDebugger(m_debugger);

    setStandardToolBarMenuEnabled(true);
    initKAction();
    initStatusBar();

    connect(m_watches, SIGNAL(addWatch()), SLOT(slotAddWatch()));
    connect(m_watches, SIGNAL(deleteWatch()), m_debugger, SLOT(slotDeleteWatch()));
    connect(m_watches, SIGNAL(textDropped(const QString&)), SLOT(slotAddWatch(const QString&)));

    connect(&m_filesWindow->m_findDlg, SIGNAL(closed()), SLOT(updateUI()));
    connect(m_filesWindow, SIGNAL(newFileLoaded()),
	    SLOT(slotNewFileLoaded()));
    connect(m_filesWindow, SIGNAL(toggleBreak(const QString&,int,const DbgAddr&,bool)),
	    this, SLOT(slotToggleBreak(const QString&,int,const DbgAddr&,bool)));
    connect(m_filesWindow, SIGNAL(enadisBreak(const QString&,int,const DbgAddr&)),
	    this, SLOT(slotEnaDisBreak(const QString&,int,const DbgAddr&)));
    connect(m_debugger, SIGNAL(activateFileLine(const QString&,int,const DbgAddr&)),
	    m_filesWindow, SLOT(activate(const QString&,int,const DbgAddr&)));
    connect(m_debugger, SIGNAL(executableUpdated()),
	    m_filesWindow, SLOT(reloadAllFiles()));
    connect(m_debugger, SIGNAL(updatePC(const QString&,int,const DbgAddr&,int)),
	    m_filesWindow, SLOT(updatePC(const QString&,int,const DbgAddr&,int)));
    // value popup communication
    connect(m_filesWindow, SIGNAL(initiateValuePopup(const QString&)),
	    m_debugger, SLOT(slotValuePopup(const QString&)));
    connect(m_debugger, SIGNAL(valuePopup(const QString&)),
	    m_filesWindow, SLOT(slotShowValueTip(const QString&)));
    // disassembling
    connect(m_filesWindow, SIGNAL(disassemble(const QString&, int)),
	    m_debugger, SLOT(slotDisassemble(const QString&, int)));
    connect(m_debugger, SIGNAL(disassembled(const QString&,int,const std::list<DisassembledCode>&)),
	    m_filesWindow, SLOT(slotDisassembled(const QString&,int,const std::list<DisassembledCode>&)));
    connect(m_filesWindow, SIGNAL(moveProgramCounter(const QString&,int,const DbgAddr&)),
	    m_debugger, SLOT(setProgramCounter(const QString&,int,const DbgAddr&)));
    // program stopped
    connect(m_debugger, SIGNAL(programStopped()), SLOT(slotProgramStopped()));
    connect(&m_backTimer, SIGNAL(timeout()), SLOT(slotBackTimer()));
    // tab width
    connect(this, SIGNAL(setTabWidth(int)), m_filesWindow, SIGNAL(setTabWidth(int)));

    // connect breakpoint table
    connect(m_bpTable, SIGNAL(activateFileLine(const QString&,int,const DbgAddr&)),
	    m_filesWindow, SLOT(activate(const QString&,int,const DbgAddr&)));
    connect(m_debugger, SIGNAL(updateUI()), m_bpTable, SLOT(updateUI()));
    connect(m_debugger, SIGNAL(breakpointsChanged()), m_bpTable, SLOT(updateBreakList()));
    connect(m_debugger, SIGNAL(breakpointsChanged()), m_bpTable, SLOT(updateUI()));

    connect(m_debugger, SIGNAL(registersChanged(const std::list<RegisterInfo>&)),
	    m_registers, SLOT(updateRegisters(const std::list<RegisterInfo>&)));

    connect(m_debugger, SIGNAL(memoryDumpChanged(const QString&, const std::list<MemoryDump>&)),
	    m_memoryWindow, SLOT(slotNewMemoryDump(const QString&, const std::list<MemoryDump>&)));
    connect(m_debugger, SIGNAL(saveProgramSpecific(KConfigBase*)),
	    m_memoryWindow, SLOT(saveProgramSpecific(KConfigBase*)));
    connect(m_debugger, SIGNAL(restoreProgramSpecific(KConfigBase*)),
	    m_memoryWindow, SLOT(restoreProgramSpecific(KConfigBase*)));

    // thread window
    connect(m_debugger, SIGNAL(threadsChanged(const std::list<ThreadInfo>&)),
	    m_threads, SLOT(updateThreads(const std::list<ThreadInfo>&)));
    connect(m_threads, SIGNAL(setThread(int)),
	    m_debugger, SLOT(setThread(int)));

    // popup menu of the local variables window
    m_localVariables->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(m_localVariables, SIGNAL(customContextMenuRequested(const QPoint&)),
	    this, SLOT(slotLocalsPopup(const QPoint&)));

    makeDefaultLayout();
    setupGUI(KXmlGuiWindow::Default, "kdbgui.rc");
    restoreSettings(KGlobal::config());

    // The animation button is not part of the restored window state.
    // We must create it after the toolbar was loaded.
    initAnimation();

    updateUI();
    m_bpTable->updateUI();
}