void LayoutUpdater::onKeyPressed(const Key &key)
{
    Q_D(LayoutUpdater);

    if (not d->layout) {
        return;
    }

    d->layout->appendActiveKey(MaliitKeyboard::Logic::modifyKey(key, KeyDescription::PressedState,
                                                                d->activeStyleAttributes()));

    if (d->layout->activePanel() == LayoutHelper::CenterPanel) {
        d->layout->setMagnifierKey(magnifyKey(key, d->activeStyleAttributes(), d->layout->orientation(),
                                              d->layout->centerPanel().rect()));
    }

    switch (key.action()) {
    case Key::ActionShift:
        Q_EMIT shiftPressed();
        break;

    case Key::ActionDead:
        Q_EMIT deadkeyPressed();
        break;

    default:
        break;
    }
}
Exemple #2
0
void FaceScene::wheelEvent(QGraphicsSceneWheelEvent *wheelEvent) {
  qreal delta = .1 * (wheelEvent->delta() > 0 ? 1 : -1);
  if (ctrlPressed())
    delta /= 10;
  else if (shiftPressed())
    delta *= 2;
  m_picture->setScale(m_picture->scale() * (1 + delta));
}
Exemple #3
0
void FaceScene::mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent) {
  QGraphicsScene::mouseMoveEvent(mouseEvent);
  m_mousePos = mouseEvent->scenePos();
  if (!m_rotateOrigin.isNull()) {
    const QLineF &line = QLineF(m_rotateOrigin, m_mousePos);
    qreal dist = line.dy();
    if (ctrlPressed())
      dist /= 10;
    else if (shiftPressed())
      dist = -m_rotateBase + qIntCast(dist / snap) * snap;
    m_picture->setRotation(m_rotateBase + dist);
  }
}
Exemple #4
0
void AppWindow::keyPressEvent(QKeyEvent *event) {
    
    if(m_viewer->gameStatus>=0){
        if (event->key() == Qt::Key_Escape) {
            QCoreApplication::instance()->quit();
        } else if (event->key() == Qt::Key_Right) {
            moveRight();
        } else if (event->key() == Qt::Key_Left) {
            moveLeft();
        } else if (event->key() == Qt::Key_Down) {
            rotateCW();
        } else if (event->key() == Qt::Key_Up) {
            rotateCCW();
        } else if (event->key() == Qt::Key_Space) {
            dropPiece();
        } else if (event->key() == Qt::Key_Shift) {
           shiftPressed();
        }
    }




    if (event->key() == Qt::Key_1) {
        slowSpeed();
        slowSpeedAct->setChecked(true);
    }else if (event->key() == Qt::Key_2) {
        normalSpeed();
        normalSpeedAct->setChecked(true);
    }else if (event->key() == Qt::Key_3) {
        fastSpeed();
        fastSpeedAct->setChecked(true);
    }else if (event->key() == Qt::Key_W) {
        wire_frame();
        wireAct->setChecked(true);
    }else if (event->key() == Qt::Key_F) {
        face();
        faceAct->setChecked(true);
    }else if (event->key() == Qt::Key_M) {
        multi_coloured();
        multiAct->setChecked(true);
    }else if (event->key() == Qt::Key_N) {
        new_game();
    }else if (event->key() == Qt::Key_R) {
        reset();
    }else if (event->key() == Qt::Key_Q) {
        close();
    }else {
        QWidget::keyPressEvent(event);
    }
}
Exemple #5
0
void ShiftMachine::setup(LayoutUpdater *updater)
{
    if (not updater) {
        qCritical() << __PRETTY_FUNCTION__
                    << "No updater specified. Aborting setup.";
        return;
    }

    setChildMode(QState::ExclusiveStates);

    QState *no_shift = 0;
    QState *latched_shift = 0;
    QState *caps_lock = 0;

    // addState makes state machine to be a parent of passed state,
    // so we don't have to care about deleting states explicitly.
    addState(no_shift = new QState);
    addState(latched_shift = new QState);
    addState(caps_lock = new QState);
    setInitialState(no_shift);

    no_shift->setObjectName(no_shift_state);
    latched_shift->setObjectName(latched_shift_state);
    caps_lock->setObjectName(caps_lock_state);

    connect(no_shift, SIGNAL(entered()),
            updater,  SLOT(syncLayoutToView()));
    connect(latched_shift, SIGNAL(entered()),
            updater,       SLOT(syncLayoutToView()));
    connect(caps_lock, SIGNAL(entered()),
            updater,   SLOT(syncLayoutToView()));

    no_shift->addTransition(updater, SIGNAL(shiftPressed()), latched_shift);
    no_shift->addTransition(updater, SIGNAL(autoCapsActivated()), latched_shift);
    latched_shift->addTransition(updater, SIGNAL(shiftCancelled()), no_shift);
    latched_shift->addTransition(updater, SIGNAL(shiftReleased()), caps_lock);
    caps_lock->addTransition(updater, SIGNAL(shiftReleased()), no_shift);

    // Defer to first main loop iteration:
    QTimer::singleShot(0, this, SLOT(start()));
}
Exemple #6
0
uchar getch1(uchar noWait) {
  register uchar i, u, b;

  KEYB3 = 0x91; 

retry:
  while(1) {
    i = 6;
    while(1) {
      --i;
      KEYB1 = scan[i];
      b = KEYB0;
      if(b != 0xFF) { u = 4; break; }
      b = KEYB2 | 0xF0;
      if(b != 0xFF) { u = -4; break; }
      if(i) continue;
      i = 6;
      prevCh = -1;
      if(noWait) return 0;
    }
    b = numberOfBit(b) + u + i $ 12;
    if(noWait) break;
    if(prevCh != b) break;
  }

  prevCh = b;

  if(b==12) {
    rus = !rus;
    goto retry;
  }

  if(b>=24) {
    if(shiftPressed()) b += 12*4;
    if(rus) b += 12*8;
  }

  return scanCodes[b];
}
// private
void kpAbstractSelectionTool::drawMove (const QPoint &thisPoint, const QRect &/*normalizedRect*/)
{
#if DEBUG_KP_TOOL_SELECTION && 1
    qCDebug(kpLogTools) << "\tmoving selection";
#endif

    kpAbstractSelection *sel = document ()->selection ();

    QRect targetSelRect (thisPoint.x () - d->startMoveDragFromSelectionTopLeft.x (),
                         thisPoint.y () - d->startMoveDragFromSelectionTopLeft.y (),
                         sel->width (),
                         sel->height ());

#if DEBUG_KP_TOOL_SELECTION && 1
    qCDebug(kpLogTools) << "\t\tstartPoint=" << startPoint ()
                        << " thisPoint=" << thisPoint
                        << " startDragFromSel=" << d->startMoveDragFromSelectionTopLeft
                        << " targetSelRect=" << targetSelRect
                        << endl;
#endif

    // Try to make sure selection still intersects document so that it's
    // reachable.

    if (targetSelRect.right () < 0)
        targetSelRect.translate (-targetSelRect.right (), 0);
    else if (targetSelRect.left () >= document ()->width ())
        targetSelRect.translate (document ()->width () - targetSelRect.left () - 1, 0);

    if (targetSelRect.bottom () < 0)
        targetSelRect.translate (0, -targetSelRect.bottom ());
    else if (targetSelRect.top () >= document ()->height ())
        targetSelRect.translate (0, document ()->height () - targetSelRect.top () - 1);

#if DEBUG_KP_TOOL_SELECTION && 1
    qCDebug(kpLogTools) << "\t\t\tafter ensure sel rect clickable=" << targetSelRect;
#endif


    if (!d->dragAccepted &&
            targetSelRect.topLeft () + d->startMoveDragFromSelectionTopLeft == startPoint ())
    {
#if DEBUG_KP_TOOL_SELECTION && 1
        qCDebug(kpLogTools) << "\t\t\t\tnop";
#endif


        if (!d->RMBMoveUpdateGUITimer->isActive ())
        {
            // (slotRMBMoveUpdateGUI() calls similar line)
            setUserShapePoints (sel->topLeft ());
        }

        // Prevent both NOP drag-moves
        return;
    }


    if (d->RMBMoveUpdateGUITimer->isActive ())
    {
        d->RMBMoveUpdateGUITimer->stop ();
        slotRMBMoveUpdateGUI ();
    }


    giveContentIfNeeded ();


    if (!d->currentMoveCommand)
    {
        d->currentMoveCommand = new kpToolSelectionMoveCommand (
            QString()/*uninteresting child of macro cmd*/,
            environ ()->commandEnvironment ());
        d->currentMoveCommandIsSmear = false;
    }


    //viewManager ()->setQueueUpdates ();
    //viewManager ()->setFastUpdates ();

    if (shiftPressed ())
        d->currentMoveCommandIsSmear = true;

    if (!d->dragAccepted && (controlPressed () || shiftPressed ()))
        d->currentMoveCommand->copyOntoDocument ();

    d->currentMoveCommand->moveTo (targetSelRect.topLeft ());

    if (shiftPressed ())
        d->currentMoveCommand->copyOntoDocument ();

    //viewManager ()->restoreFastUpdates ();
    //viewManager ()->restoreQueueUpdates ();

    // REFACTOR: yuck, yuck
    kpAbstractSelection *orgSel = d->currentMoveCommand->originalSelectionClone ();
    QPoint start = orgSel->topLeft ();
    delete orgSel;
    QPoint end = targetSelRect.topLeft ();
    setUserShapePoints (start, end, false/*don't set size*/);
    setUserShapeSize (end.x () - start.x (), end.y () - start.y ());


    d->dragAccepted = true;
}
bool CmdPromptInput::eventFilter(QObject* obj, QEvent* event)
{
    if(event->type() == QEvent::KeyPress)
    {
        if(isBlinking) emit stopBlinking();

        QKeyEvent* pressedKey = (QKeyEvent*)event;

        //NOTE: These shortcuts need to be caught since QLineEdit uses them
        if(pressedKey->matches(QKeySequence::Cut))
        {
            pressedKey->accept();
            emit cutPressed();
            return true;
        }
        else if(pressedKey->matches(QKeySequence::Copy))
        {
            pressedKey->accept();
            emit copyPressed();
            return true;
        }
        else if(pressedKey->matches(QKeySequence::Paste))
        {
            pressedKey->accept();
            emit pastePressed();
            return true;
        }
        else if(pressedKey->matches(QKeySequence::SelectAll))
        {
            pressedKey->accept();
            emit selectAllPressed();
            return true;
        }
        else if(pressedKey->matches(QKeySequence::Undo))
        {
            pressedKey->accept();
            emit undoPressed();
            return true;
        }
        else if(pressedKey->matches(QKeySequence::Redo))
        {
            pressedKey->accept();
            emit redoPressed();
            return true;
        }

        int key = pressedKey->key();
        switch(key)
        {
            case Qt::Key_Enter:
            case Qt::Key_Return:
            case Qt::Key_Space:
                pressedKey->accept();
                processInput(QChar(key));
                return true;
                break;
            case Qt::Key_Delete:
                pressedKey->accept();
                emit deletePressed();
                return true;
                break;
            case Qt::Key_Tab:
                pressedKey->accept();
                emit tabPressed();
                return true;
                break;
            case Qt::Key_Escape:
                pressedKey->accept();
                prefix = "Command: ";
                clear();
                emit appendHistory(curText + tr("*Cancel*"));
                emit escapePressed();
                return true;
                break;
            case Qt::Key_F1:
                pressedKey->accept();
                emit F1Pressed();
                return true;
                break;
            case Qt::Key_F2:
                pressedKey->accept();
                emit F2Pressed();
                return true;
                break;
            case Qt::Key_F3:
                pressedKey->accept();
                emit F3Pressed();
                return true;
                break;
            case Qt::Key_F4:
                pressedKey->accept();
                emit F4Pressed();
                return true;
                break;
            case Qt::Key_F5:
                emit F5Pressed();
                pressedKey->accept();
                return true;
                break;
            case Qt::Key_F6:
                pressedKey->accept();
                emit F6Pressed();
                return true;
                break;
            case Qt::Key_F7:
                pressedKey->accept();
                emit F7Pressed();
                return true;
                break;
            case Qt::Key_F8:
                pressedKey->accept();
                emit F8Pressed();
                return true;
                break;
            case Qt::Key_F9:
                pressedKey->accept();
                emit F9Pressed();
                return true;
                break;
            case Qt::Key_F10:
                pressedKey->accept();
                emit F10Pressed();
                return true;
                break;
            case Qt::Key_F11:
                pressedKey->accept();
                emit F11Pressed();
                return true;
                break;
            case Qt::Key_F12:
                pressedKey->accept();
                emit F12Pressed();
                return true;
                break;
            case Qt::Key_Shift:
                pressedKey->ignore(); //we don't want to eat it, we just want to keep track of it
                emit shiftPressed();
                break;
            default:
                pressedKey->ignore();
        }
    }

    if(event->type() == QEvent::KeyRelease)
    {
        QKeyEvent* releasedKey = (QKeyEvent*)event;
        int key = releasedKey->key();
        switch(key)
        {
            case Qt::Key_Shift:
                releasedKey->ignore(); //we don't want to eat it, we just want to keep track of it
                emit shiftReleased();
                break;
            default:
                releasedKey->ignore();
        }
    }
    return QObject::eventFilter(obj, event);
}
CmdPrompt::CmdPrompt(QWidget* parent) : QWidget(parent)
{
    qDebug("CmdPrompt Constructor");
    setObjectName("Command Prompt");

    promptInput = new CmdPromptInput(this);
    promptHistory = new CmdPromptHistory();
    promptDivider = new QFrame(this);
    promptVBoxLayout = new QVBoxLayout(this);

    promptSplitter = new CmdPromptSplitter(this);

    this->setFocusProxy(promptInput);
    promptHistory->setFocusProxy(promptInput);

    promptDivider->setLineWidth(1);
    promptDivider->setFrameStyle(QFrame::HLine);
    promptDivider->setMaximumSize(QWIDGETSIZE_MAX, 1);

    promptVBoxLayout->addWidget(promptSplitter);
    promptVBoxLayout->addWidget(promptHistory);
    promptVBoxLayout->addWidget(promptDivider);
    promptVBoxLayout->addWidget(promptInput);

    promptVBoxLayout->setSpacing(0);
    promptVBoxLayout->setContentsMargins(0,0,0,0);

    this->setLayout(promptVBoxLayout);

    styleHash = new QHash<QString, QString>();
    styleHash->insert("color",                      "#000000"); // Match -------|
    styleHash->insert("background-color",           "#FFFFFF"); //              |
    styleHash->insert("selection-color",            "#FFFFFF"); //              |
    styleHash->insert("selection-background-color", "#000000"); // Match -------|
    styleHash->insert("font-family",              "Monospace");
    styleHash->insert("font-style",                  "normal");
    styleHash->insert("font-size",                     "12px");

    updateStyle();

    blinkState = false;
    blinkTimer = new QTimer(this);
    connect(blinkTimer, SIGNAL(timeout()), this, SLOT(blink()));

    this->show();

    connect(promptInput, SIGNAL(stopBlinking()), this, SLOT(stopBlinking()));
    connect(promptInput, SIGNAL(appendHistory(const QString&)), promptHistory, SLOT(appendHistory(const QString&)));
    connect(this, SIGNAL(appendTheHistory(const QString&)), promptHistory, SLOT(appendHistory(const QString&)));

    //For use outside of command prompt
    connect(promptInput, SIGNAL(startCommand(const QString&)), this, SIGNAL(startCommand(const QString&)));
    connect(promptInput, SIGNAL(runCommand(const QString&, const QString&)), this, SIGNAL(runCommand(const QString&, const QString&)));
    connect(promptInput, SIGNAL(deletePressed()),    this, SIGNAL(deletePressed()));
    connect(promptInput, SIGNAL(tabPressed()),       this, SIGNAL(tabPressed()));
    connect(promptInput, SIGNAL(escapePressed()),    this, SIGNAL(escapePressed()));
    connect(promptInput, SIGNAL(F1Pressed()),        this, SIGNAL(F1Pressed()));
    connect(promptInput, SIGNAL(F2Pressed()),        this, SIGNAL(F2Pressed()));
    connect(promptInput, SIGNAL(F3Pressed()),        this, SIGNAL(F3Pressed()));
    connect(promptInput, SIGNAL(F4Pressed()),        this, SIGNAL(F4Pressed()));
    connect(promptInput, SIGNAL(F5Pressed()),        this, SIGNAL(F5Pressed()));
    connect(promptInput, SIGNAL(F6Pressed()),        this, SIGNAL(F6Pressed()));
    connect(promptInput, SIGNAL(F7Pressed()),        this, SIGNAL(F7Pressed()));
    connect(promptInput, SIGNAL(F8Pressed()),        this, SIGNAL(F8Pressed()));
    connect(promptInput, SIGNAL(F9Pressed()),        this, SIGNAL(F9Pressed()));
    connect(promptInput, SIGNAL(F10Pressed()),       this, SIGNAL(F10Pressed()));
    connect(promptInput, SIGNAL(F11Pressed()),       this, SIGNAL(F11Pressed()));
    connect(promptInput, SIGNAL(F12Pressed()),       this, SIGNAL(F12Pressed()));
    connect(promptInput, SIGNAL(cutPressed()),       this, SIGNAL(cutPressed()));
    connect(promptInput, SIGNAL(copyPressed()),      this, SIGNAL(copyPressed()));
    connect(promptInput, SIGNAL(pastePressed()),     this, SIGNAL(pastePressed()));
    connect(promptInput, SIGNAL(selectAllPressed()), this, SIGNAL(selectAllPressed()));
    connect(promptInput, SIGNAL(undoPressed()),      this, SIGNAL(undoPressed()));
    connect(promptInput, SIGNAL(redoPressed()),      this, SIGNAL(redoPressed()));

    connect(promptInput, SIGNAL(shiftPressed()),     this, SIGNAL(shiftPressed()));
    connect(promptInput, SIGNAL(shiftReleased()),    this, SIGNAL(shiftReleased()));
}
MainWindow::MainWindow() : QMainWindow(0)
{
    readSettings();

    QString lang = getSettingsGeneralLanguage();
    qDebug("language: %s", qPrintable(lang));
    if(lang == "system")
        lang = QLocale::system().languageToString(QLocale::system().language()).toLower();

    //Load translations for the Embroidermodder 2 GUI
    QTranslator translatorEmb;
    translatorEmb.load("translations/" + lang + "/embroidermodder2_" + lang);
    qApp->installTranslator(&translatorEmb);

    //Load translations for the commands
    QTranslator translatorCmd;
    translatorCmd.load("translations/" + lang + "/commands_" + lang);
    qApp->installTranslator(&translatorCmd);

    //Load translations provided by Qt - this covers dialog buttons and other common things.
    QTranslator translatorQt;
    translatorQt.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
    qApp->installTranslator(&translatorQt);

    //Init
    mainWin = this;
    //Menus
    fileMenu     = new QMenu(tr("&File"),     this);
    editMenu     = new QMenu(tr("&Edit"),     this);
    viewMenu     = new QMenu(tr("&View"),     this);
    settingsMenu = new QMenu(tr("&Settings"), this);
    windowMenu   = new QMenu(tr("&Window"),   this);
    helpMenu     = new QMenu(tr("&Help"),     this);
    //SubMenus
    recentMenu   = new QMenu(tr("Open &Recent"), this);
    zoomMenu     = new QMenu(tr("&Zoom"),        this);
    panMenu      = new QMenu(tr("&Pan"),         this);
    //Toolbars
    toolbarFile       = addToolBar(tr("File"));
    toolbarEdit       = addToolBar(tr("Edit"));
    toolbarView       = addToolBar(tr("View"));
    toolbarZoom       = addToolBar(tr("Zoom"));
    toolbarPan        = addToolBar(tr("Pan"));
    toolbarIcon       = addToolBar(tr("Icon"));
    toolbarHelp       = addToolBar(tr("Help"));
    toolbarLayer      = addToolBar(tr("Layer"));
    toolbarProperties = addToolBar(tr("Properties"));
    toolbarText       = addToolBar(tr("Text"));
    toolbarPrompt     = addToolBar(tr("Command Prompt"));
    //Selectors
    layerSelector      = new QComboBox(this);
    colorSelector      = new QComboBox(this);
    linetypeSelector   = new QComboBox(this);
    lineweightSelector = new QComboBox(this);
    textFontSelector   = new QFontComboBox(this);
    textSizeSelector   = new QComboBox(this);

    numOfDocs = 0;
    docIndex = 0;

    shiftKeyPressedState = false;

    setWindowIcon(QIcon("icons/" + getSettingsGeneralIconTheme() + "/" + "app" + ".png"));

    //create the mdiArea
    QFrame* vbox = new QFrame(this);
    QVBoxLayout* layout = new QVBoxLayout(vbox);
    layout->setMargin(0);
    vbox->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
    mdiArea = new MdiArea(this, vbox);
    mdiArea->useBackgroundLogo(getSettingsGeneralMdiBGUseLogo());
    mdiArea->useBackgroundTexture(getSettingsGeneralMdiBGUseTexture());
    mdiArea->useBackgroundColor(getSettingsGeneralMdiBGUseColor());
    mdiArea->setBackgroundLogo(getSettingsGeneralMdiBGLogo());
    mdiArea->setBackgroundTexture(getSettingsGeneralMdiBGTexture());
    mdiArea->setBackgroundColor(QColor(getSettingsGeneralMdiBGColor()));
    mdiArea->setViewMode(QMdiArea::TabbedView);
    mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    mdiArea->setActivationOrder(QMdiArea::ActivationHistoryOrder);
    layout->addWidget(mdiArea);
    setCentralWidget(vbox);

    //create the Command Prompt
    prompt = new CmdPrompt(this);
    prompt->setFocus(Qt::OtherFocusReason);
    this->setFocusProxy(prompt);
    mdiArea->setFocusProxy(prompt);

    prompt->setPromptTextColor(QColor(getSettingsPromptTextColor()));
    prompt->setPromptBackgroundColor(QColor(getSettingsPromptBGColor()));

    connect(prompt, SIGNAL(startCommand(const QString&)), this, SLOT(runCommandMain(const QString&)));
    connect(prompt, SIGNAL(runCommand(const QString&, const QString&)), this, SLOT(runCommandPrompt(const QString&, const QString&)));

            connect(prompt, SIGNAL(deletePressed()),    this, SLOT(deletePressed()));
    //TODO: connect(prompt, SIGNAL(tabPressed()),       this, SLOT(someUnknownSlot()));
            connect(prompt, SIGNAL(escapePressed()),    this, SLOT(escapePressed()));
            connect(prompt, SIGNAL(F1Pressed()),        this, SLOT(help()));
    //TODO: connect(prompt, SIGNAL(F2Pressed()),        this, SLOT(floatHistory()));
    //TODO: connect(prompt, SIGNAL(F3Pressed()),        this, SLOT(toggleQSNAP()));
            connect(prompt, SIGNAL(F4Pressed()),        this, SLOT(toggleLwt())); //TODO: typically this is toggleTablet(), make F-Keys customizable thru settings
    //TODO: connect(prompt, SIGNAL(F5Pressed()),        this, SLOT(toggleISO()));
    //TODO: connect(prompt, SIGNAL(F6Pressed()),        this, SLOT(toggleCoords()));
            connect(prompt, SIGNAL(F7Pressed()),        this, SLOT(toggleGrid()));
    //TODO: connect(prompt, SIGNAL(F8Pressed()),        this, SLOT(toggleORTHO()));
    //TODO: connect(prompt, SIGNAL(F9Pressed()),        this, SLOT(toggleSNAP()));
    //TODO: connect(prompt, SIGNAL(F10Pressed()),       this, SLOT(togglePOLAR()));
    //TODO: connect(prompt, SIGNAL(F11Pressed()),       this, SLOT(toggleQTRACK()));
            connect(prompt, SIGNAL(F12Pressed()),       this, SLOT(toggleRuler()));
            connect(prompt, SIGNAL(cutPressed()),       this, SLOT(cut()));
            connect(prompt, SIGNAL(copyPressed()),      this, SLOT(copy()));
            connect(prompt, SIGNAL(pastePressed()),     this, SLOT(paste()));
            connect(prompt, SIGNAL(selectAllPressed()), this, SLOT(selectAll()));
            connect(prompt, SIGNAL(undoPressed()),      this, SLOT(undo()));
            connect(prompt, SIGNAL(redoPressed()),      this, SLOT(redo()));

            connect(prompt, SIGNAL(shiftPressed()),     this, SLOT(setShiftPressed()));
            connect(prompt, SIGNAL(shiftReleased()),    this, SLOT(setShiftReleased()));

    //create the Object Property Editor
    dockPropEdit = new PropertyEditor("icons/" + getSettingsGeneralIconTheme(), getSettingsSelectionModePickAdd(), prompt, this);
    addDockWidget(Qt::LeftDockWidgetArea, dockPropEdit);
    connect(dockPropEdit, SIGNAL(pickAddModeToggled()), this, SLOT(pickAddModeToggled()));

    //create the Command History Undo Editor
    dockUndoEdit = new UndoEditor("icons/" + getSettingsGeneralIconTheme(), prompt, this);
    addDockWidget(Qt::LeftDockWidgetArea, dockUndoEdit);

    //setDockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowTabbedDocks | QMainWindow::VerticalTabs); //TODO: Load these from settings
    //tabifyDockWidget(dockPropEdit, dockUndoEdit); //TODO: load this from settings

    //Javascript
    initMainWinPointer(this);

    engine = new QScriptEngine(this);
    engine->installTranslatorFunctions();
    debugger = new QScriptEngineDebugger(this);
    debugger->attachTo(engine);
    javaInitNatives(engine);

    //Load all commands in a loop
    QDir commandDir("commands");
    QStringList cmdList = commandDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
    foreach(QString cmdName, cmdList)
    {
        javaLoadCommand(cmdName);
    }