Пример #1
0
bool MainWindow::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: buildPalette(); break;
    case 1: buildFont(); break;
    case 2: tunePalette(); break;
    case 3: paletteSelected((int)static_QUType_int.get(_o+1)); break;
    case 4: styleSelected((const QString&)static_QUType_QString.get(_o+1)); break;
    case 5: familySelected((const QString&)static_QUType_QString.get(_o+1)); break;
    case 6: substituteSelected((const QString&)static_QUType_QString.get(_o+1)); break;
    case 7: removeSubstitute(); break;
    case 8: addSubstitute(); break;
    case 9: downSubstitute(); break;
    case 10: upSubstitute(); break;
    case 11: removeLibpath(); break;
    case 12: addLibpath(); break;
    case 13: downLibpath(); break;
    case 14: upLibpath(); break;
    case 15: browseLibpath(); break;
    case 16: removeFontpath(); break;
    case 17: addFontpath(); break;
    case 18: downFontpath(); break;
    case 19: upFontpath(); break;
    case 20: browseFontpath(); break;
    case 21: fileSave(); break;
    case 22: fileExit(); break;
    case 23: somethingModified(); break;
    case 24: helpAbout(); break;
    case 25: helpAboutQt(); break;
    case 26: pageChanged((QWidget*)static_QUType_ptr.get(_o+1)); break;
    default:
	return MainWindowBase::qt_invoke( _id, _o );
    }
    return TRUE;
}
Пример #2
0
QT_BEGIN_NAMESPACE

/*
 *  Constructs a MainWindowBase as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 */
MainWindowBase::MainWindowBase(QWidget* parent, const char* name, Qt::WindowFlags fl)
    : Q3MainWindow(parent, name, fl)
{
    setupUi(this);

    (void)statusBar();

    // signals and slots connections
    connect(fontpathlineedit, SIGNAL(returnPressed()), this, SLOT(addFontpath()));
    connect(PushButton15, SIGNAL(clicked()), this, SLOT(addFontpath()));
    connect(PushButton1, SIGNAL(clicked()), this, SLOT(addSubstitute()));
    connect(PushButton14, SIGNAL(clicked()), this, SLOT(browseFontpath()));
    connect(stylecombo, SIGNAL(activated(int)), this, SLOT(buildFont()));
    connect(psizecombo, SIGNAL(activated(int)), this, SLOT(buildFont()));
    connect(PushButton12, SIGNAL(clicked()), this, SLOT(downFontpath()));
    connect(PushButton3, SIGNAL(clicked()), this, SLOT(downSubstitute()));
    connect(familycombo, SIGNAL(activated(QString)), this, SLOT(familySelected(QString)));
    connect(fileExitAction, SIGNAL(activated()), this, SLOT(fileExit()));
    connect(fileSaveAction, SIGNAL(activated()), this, SLOT(fileSave()));
    connect(helpAboutAction, SIGNAL(activated()), this, SLOT(helpAbout()));
    connect(helpAboutQtAction, SIGNAL(activated()), this, SLOT(helpAboutQt()));
    connect(TabWidget3, SIGNAL(currentChanged(QWidget*)), this, SLOT(pageChanged(QWidget*)));
    connect(paletteCombo, SIGNAL(activated(int)), this, SLOT(paletteSelected(int)));
    connect(PushButton13, SIGNAL(clicked()), this, SLOT(removeFontpath()));
    connect(PushButton4, SIGNAL(clicked()), this, SLOT(removeSubstitute()));
    connect(effectcheckbox, SIGNAL(toggled(bool)), effectbase, SLOT(setEnabled(bool)));
    connect(fontembeddingcheckbox, SIGNAL(toggled(bool)), GroupBox10, SLOT(setEnabled(bool)));
    connect(toolboxeffect, SIGNAL(activated(int)), this, SLOT(somethingModified()));
    connect(dcispin, SIGNAL(valueChanged(int)), this, SLOT(somethingModified()));
    connect(cfispin, SIGNAL(valueChanged(int)), this, SLOT(somethingModified()));
    connect(wslspin, SIGNAL(valueChanged(int)), this, SLOT(somethingModified()));
    connect(menueffect, SIGNAL(activated(int)), this, SLOT(somethingModified()));
    connect(comboeffect, SIGNAL(activated(int)), this, SLOT(somethingModified()));
    connect(audiosinkCombo, SIGNAL(activated(int)), this, SLOT(somethingModified()));
    connect(videomodeCombo, SIGNAL(activated(int)), this, SLOT(somethingModified()));
    connect(tooltipeffect, SIGNAL(activated(int)), this, SLOT(somethingModified()));
    connect(strutwidth, SIGNAL(valueChanged(int)), this, SLOT(somethingModified()));
    connect(strutheight, SIGNAL(valueChanged(int)), this, SLOT(somethingModified()));
    connect(effectcheckbox, SIGNAL(toggled(bool)), this, SLOT(somethingModified()));
    connect(resolvelinks, SIGNAL(toggled(bool)), this, SLOT(somethingModified()));
    connect(fontembeddingcheckbox, SIGNAL(clicked()), this, SLOT(somethingModified()));
    connect(rtlExtensions, SIGNAL(toggled(bool)), this, SLOT(somethingModified()));
    connect(inputStyle, SIGNAL(activated(int)), this, SLOT(somethingModified()));
    connect(inputMethod, SIGNAL(activated(int)), this, SLOT(somethingModified()));
    connect(gstylecombo, SIGNAL(activated(QString)), this, SLOT(styleSelected(QString)));
    connect(familysubcombo, SIGNAL(activated(QString)), this, SLOT(substituteSelected(QString)));
    connect(btnAdvanced, SIGNAL(clicked()), this, SLOT(tunePalette()));
    connect(PushButton11, SIGNAL(clicked()), this, SLOT(upFontpath()));
    connect(PushButton2, SIGNAL(clicked()), this, SLOT(upSubstitute()));
    init();
}
Пример #3
0
void MainWindow::createActions() {
    _fileNewAct = new QAction(tr("&New..."), this);
    _fileNewAct->setShortcut(QKeySequence::New);
    _fileNewAct->setStatusTip(tr("Create new simulation"));
    _fileNewAct->setIcon(QIcon::fromTheme("document-new", QIcon(":/icons/new.png")));
    connect(_fileNewAct, SIGNAL(triggered()), this, SLOT(fileNew()));


    _fileOpenAct = new QAction(tr("&Open..."), this);
    _fileOpenAct->setShortcut(QKeySequence::Open);
    _fileOpenAct->setStatusTip(tr("Load existing simulation data"));
    _fileOpenAct->setIcon(QIcon::fromTheme("document-open", QIcon(":/icons/open.png")));
    connect(_fileOpenAct, SIGNAL(triggered()), this, SLOT(fileOpen()));

    _fileCloseAct = new QAction(tr("&Close..."), this);
    _fileCloseAct->setShortcut(QKeySequence::Close);
    _fileCloseAct->setStatusTip(tr("Exit current simulation"));
    connect(_fileCloseAct, SIGNAL(triggered()), this, SLOT(fileClose()));

    _fileSaveAct = new QAction(tr("&Save"), this);
    _fileSaveAct->setShortcut(QKeySequence::Save);
    _fileSaveAct->setStatusTip(tr("Save simulation data to file"));
    _fileSaveAct->setIcon(QIcon::fromTheme("document-save", QIcon(":/icons/save.png")));
    connect(_fileSaveAct, SIGNAL(triggered()), this, SLOT(fileSave()));

    _fileSaveAsAct = new QAction(tr("Save &as..."), this);
    _fileSaveAsAct->setShortcut(QKeySequence::SaveAs);
    _fileSaveAsAct->setStatusTip(tr("Save simulation data to file"));
    _fileSaveAsAct->setIcon(QIcon::fromTheme("document-save-as", QIcon(":/icons/save.png")));
    connect(_fileSaveAsAct, SIGNAL(triggered()), this, SLOT(fileSaveAs()));

    _fileExitAct = new QAction(tr("E&xit..."), this);
    _fileExitAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X));
    _fileExitAct->setStatusTip(tr("Exit program"));
    _fileExitAct->setIcon(QIcon::fromTheme("application-exit"));
    connect(_fileExitAct, SIGNAL(triggered()), this, SLOT(close()));


    _helpAboutAct = new QAction(tr("&About"), this);
    _helpAboutAct->setStatusTip(tr("About HPC program"));
    _helpAboutAct->setIcon(QIcon::fromTheme("help-about"));
    connect(_helpAboutAct, SIGNAL(triggered()), this, SLOT(helpAbout()));

    _helpAboutQtAct = new QAction(tr("&About Qt"), this);
    _helpAboutQtAct->setStatusTip(tr("About Qt framework"));
    _helpAboutQtAct->setIcon(QIcon::fromTheme("help-about"));
    connect(_helpAboutQtAct, SIGNAL(triggered()), this, SLOT(helpAboutQt()));

    _fileSaveAct->setEnabled(false);
    _fileSaveAsAct->setEnabled(false);
    _fileCloseAct->setEnabled(false);
}
Пример #4
0
QMenus::QMenus(QWidget *parent) 
    : QMainWindow(parent, 0) // QMainWindow's default flag is WType_TopLevel
{
    QAction *action;

    QMenu *file = new QMenu(this);

    action = new QAction(QPixmap((const char**)fileopen), "&Open", this);
    action->setShortcut(tr("CTRL+O"));
    connect(action, SIGNAL(triggered()), this, SLOT(fileOpen()));
    file->addAction(action);

    action = new QAction(QPixmap((const char**)filesave),"&Save", this);
    action->setShortcut(tr("CTRL+S"));
    connect(action, SIGNAL(triggered()), this, SLOT(fileSave()));
    file->addAction(action);

    QMenu *edit = new QMenu(this);

    action = new QAction("&Normal", this);
    action->setShortcut(tr("CTRL+N"));
    action->setToolTip("Normal");
    action->setStatusTip("Toggles Normal");
    action->setCheckable(true);
    connect(action, SIGNAL(triggered()), this, SLOT(editNormal()));
    edit->addAction(action);

    action = new QAction("&Bold", this);
    action->setShortcut(tr("CTRL+B"));
    action->setCheckable(true);
    connect(action, SIGNAL(triggered()), this, SLOT(editBold()));
    edit->addAction(action);

    action = new QAction("&Underline", this);
    action->setShortcut(tr("CTRL+U"));
    action->setCheckable(true);
    connect(action, SIGNAL(triggered()), this, SLOT(editUnderline()));
    edit->addAction(action);

    QMenu *advanced = new QMenu(this);
    action = new QAction("&Font...", this);
    connect(action, SIGNAL(triggered()), this, SLOT(editAdvancedFont()));
    advanced->addAction(action);

    action = new QAction("&Style...", this);
    connect(action, SIGNAL(triggered()), this, SLOT(editAdvancedStyle()));
    advanced->addAction(action);

    edit->addMenu(advanced)->setText("&Advanced");

    edit->addSeparator();

    action = new QAction("Una&vailable", this);
    action->setShortcut(tr("CTRL+V"));
    action->setCheckable(true);
    action->setEnabled(false);
    connect(action, SIGNAL(triggered()), this, SLOT(editUnderline()));
    edit->addAction(action);

    QMenu *help = new QMenu(this);

    action = new QAction("&About...", this);
    action->setShortcut(tr("F1"));
    connect(action, SIGNAL(triggered()), this, SLOT(helpAbout()));
    help->addAction(action);

    action = new QAction("&About Qt...", this);
    connect(action, SIGNAL(triggered()), this, SLOT(helpAboutQt()));
    help->addAction(action);

    if (!QAxFactory::isServer())
        menuBar()->addMenu(file)->setText("&File");
    menuBar()->addMenu(edit)->setText("&Edit");
    menuBar()->addMenu(help)->setText("&Help");

    editor = new QTextEdit(this);
    setCentralWidget(editor);

    statusBar();
}
bool MainWindow::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0:
        showProperties((QObject*)static_QUType_ptr.get(_o+1));
        break;
    case 1:
        updateProperties((QObject*)static_QUType_ptr.get(_o+1));
        break;
    case 2:
        showDialogHelp();
        break;
    case 3:
        showDebugStep((QObject*)static_QUType_ptr.get(_o+1),(int)static_QUType_int.get(_o+2));
        break;
    case 4:
        showStackFrame((QObject*)static_QUType_ptr.get(_o+1),(int)static_QUType_int.get(_o+2));
        break;
    case 5:
        showErrorMessage((QObject*)static_QUType_ptr.get(_o+1),(int)static_QUType_int.get(_o+2),(const QString&)static_QUType_QString.get(_o+3));
        break;
    case 6:
        finishedRun();
        break;
    case 7:
        breakPointsChanged();
        break;
    case 8:
        fileNew();
        break;
    case 9:
        fileNewDialog();
        break;
    case 10:
        fileNewFile();
        break;
    case 11:
        fileClose();
        break;
    case 12:
        fileQuit();
        break;
    case 13:
        fileCloseProject();
        break;
    case 14:
        fileOpen();
        break;
    case 15:
        fileOpen((const QString&)static_QUType_QString.get(_o+1),(const QString&)static_QUType_QString.get(_o+2));
        break;
    case 16:
        fileOpen((const QString&)static_QUType_QString.get(_o+1),(const QString&)static_QUType_QString.get(_o+2),(const QString&)static_QUType_QString.get(_o+3));
        break;
    case 17:
        fileOpen((const QString&)static_QUType_QString.get(_o+1),(const QString&)static_QUType_QString.get(_o+2),(const QString&)static_QUType_QString.get(_o+3),(bool)static_QUType_bool.get(_o+4));
        break;
    case 18:
        static_QUType_bool.set(_o,fileSave());
        break;
    case 19:
        static_QUType_bool.set(_o,fileSaveForm());
        break;
    case 20:
        static_QUType_bool.set(_o,fileSaveProject());
        break;
    case 21:
        static_QUType_bool.set(_o,fileSaveAs());
        break;
    case 22:
        fileSaveAll();
        break;
    case 23:
        fileCreateTemplate();
        break;
    case 24:
        editUndo();
        break;
    case 25:
        editRedo();
        break;
    case 26:
        editCut();
        break;
    case 27:
        editCopy();
        break;
    case 28:
        editPaste();
        break;
    case 29:
        editDelete();
        break;
    case 30:
        editSelectAll();
        break;
    case 31:
        editLower();
        break;
    case 32:
        editRaise();
        break;
    case 33:
        editAdjustSize();
        break;
    case 34:
        editLayoutHorizontal();
        break;
    case 35:
        editLayoutVertical();
        break;
    case 36:
        editLayoutHorizontalSplit();
        break;
    case 37:
        editLayoutVerticalSplit();
        break;
    case 38:
        editLayoutGrid();
        break;
    case 39:
        editLayoutContainerHorizontal();
        break;
    case 40:
        editLayoutContainerVertical();
        break;
    case 41:
        editLayoutContainerGrid();
        break;
    case 42:
        editBreakLayout();
        break;
    case 43:
        editAccels();
        break;
    case 44:
        editFunctions();
        break;
    case 45:
        editConnections();
        break;
    case 46:
        static_QUType_ptr.set(_o,editSource());
        break;
    case 47:
        static_QUType_ptr.set(_o,editSource((SourceFile*)static_QUType_ptr.get(_o+1)));
        break;
    case 48:
        static_QUType_ptr.set(_o,openSourceEditor());
        break;
    case 49:
        static_QUType_ptr.set(_o,createSourceEditor((QObject*)static_QUType_ptr.get(_o+1),(Project*)static_QUType_ptr.get(_o+2)));
        break;
    case 50:
        static_QUType_ptr.set(_o,createSourceEditor((QObject*)static_QUType_ptr.get(_o+1),(Project*)static_QUType_ptr.get(_o+2),(const QString&)static_QUType_QString.get(_o+3)));
        break;
    case 51:
        static_QUType_ptr.set(_o,createSourceEditor((QObject*)static_QUType_ptr.get(_o+1),(Project*)static_QUType_ptr.get(_o+2),(const QString&)static_QUType_QString.get(_o+3),(const QString&)static_QUType_QString.get(_o+4)));
        break;
    case 52:
        static_QUType_ptr.set(_o,createSourceEditor((QObject*)static_QUType_ptr.get(_o+1),(Project*)static_QUType_ptr.get(_o+2),(const QString&)static_QUType_QString.get(_o+3),(const QString&)static_QUType_QString.get(_o+4),(bool)static_QUType_bool.get(_o+5)));
        break;
    case 53:
        editFormSettings();
        break;
    case 54:
        editProjectSettings();
        break;
    case 55:
        editPixmapCollection();
        break;
    case 56:
        editDatabaseConnections();
        break;
    case 57:
        editPreferences();
        break;
    case 58:
        projectInsertFile();
        break;
    case 59:
        searchFind();
        break;
    case 60:
        searchIncremetalFindMenu();
        break;
    case 61:
        searchIncremetalFind();
        break;
    case 62:
        searchIncremetalFindNext();
        break;
    case 63:
        searchReplace();
        break;
    case 64:
        searchGotoLine();
        break;
    case 65:
        previewForm();
        break;
    case 66:
        previewForm((const QString&)static_QUType_QString.get(_o+1));
        break;
    case 67:
        toolsCustomWidget();
        break;
    case 68:
        toolsConfigure();
        break;
    case 69:
        helpContents();
        break;
    case 70:
        helpManual();
        break;
    case 71:
        helpAbout();
        break;
    case 72:
        helpAboutQt();
        break;
    case 73:
        helpRegister();
        break;
    case 74:
        activeWindowChanged((QWidget*)static_QUType_ptr.get(_o+1));
        break;
    case 75:
        updateUndoRedo((bool)static_QUType_bool.get(_o+1),(bool)static_QUType_bool.get(_o+2),(const QString&)static_QUType_QString.get(_o+3),(const QString&)static_QUType_QString.get(_o+4));
        break;
    case 76:
        updateEditorUndoRedo();
        break;
    case 77:
        toolSelected((QAction*)static_QUType_ptr.get(_o+1));
        break;
    case 78:
        clipboardChanged();
        break;
    case 79:
        selectionChanged();
        break;
    case 80:
        windowsMenuActivated((int)static_QUType_int.get(_o+1));
        break;
    case 81:
        setupWindowActions();
        break;
    case 82:
        createNewTemplate();
        break;
    case 83:
        projectSelected((QAction*)static_QUType_ptr.get(_o+1));
        break;
    case 84:
        setupRecentlyFilesMenu();
        break;
    case 85:
        setupRecentlyProjectsMenu();
        break;
    case 86:
        recentlyFilesMenuActivated((int)static_QUType_int.get(_o+1));
        break;
    case 87:
        recentlyProjectsMenuActivated((int)static_QUType_int.get(_o+1));
        break;
    case 88:
        emitProjectSignals();
        break;
    case 89:
        showStartDialog();
        break;
    case 90:
        doFunctionsChanged();
        break;
    case 91:
        static_QUType_bool.set(_o,openProjectSettings((Project*)static_QUType_ptr.get(_o+1)));
        break;
    default:
        return QMainWindow::qt_invoke( _id, _o );
    }
    return TRUE;
}
Пример #6
0
MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
    : QMainWindow(parent, flags)
    , Ui::MainWindow()
{
    setupUi(this);

    // instantiate singleton
    new RobotManager(this);

    QWidget* toolsWidget = new QWidget();
    m_toolsUi = new Ui::ToolWidget();
    m_toolsUi->setupUi(toolsWidget);
    m_toolsUi->cmbTool->addItem("Place Vehicle");        // 0
    m_toolsUi->cmbTool->insertSeparator(1);              // 1
    m_toolsUi->cmbTool->addItem("Modify Obstacles");     // 2
    m_toolsUi->cmbTool->addItem("Modify Explored Area"); // 3
    m_toolsUi->cmbTool->insertSeparator(4);              // 4
    m_toolsUi->cmbTool->addItem("DisCoverage (Orientation-based)"); // 5
    m_toolsUi->cmbTool->addItem("MinDist");              // 6
    m_toolsUi->cmbTool->addItem("DisCoverage (Frontier Weights)"); // 7
	m_toolsUi->cmbTool->addItem("Random"); // 8
	m_toolsUi->cmbTool->addItem("MaxArea"); // 9
	m_toolsUi->cmbTool->addItem("Ruffins"); // 10
    toolBar->insertWidget(actionDummy, toolsWidget);
    toolBar->removeAction(actionDummy);

    m_stats = new Statistics(this);
    dwStatistics->setWidget(m_stats);
    dwStatistics->setVisible(false);

    m_statusProgress = new QLabel("Explored: 0.00%", statusBar());
    statusBar()->addPermanentWidget(m_statusProgress);

    m_statusResolution = new QLabel(statusBar());
    statusBar()->addPermanentWidget(m_statusResolution);
    setStatusResolution(0.2);

    m_statusPosition = new QLabel(statusBar());
    statusBar()->addPermanentWidget(m_statusPosition);
    setStatusPosition(QPoint(0, 0));

    m_scene = new Scene(this, this);
    scrollArea->setWidget(m_scene);
    scrollArea->installEventFilter(this);

    m_robotListView = new RobotListView(this);
    dwRobotManager->setWidget(m_robotListView);


    connect(actionQuit, SIGNAL(triggered()), qApp, SLOT(quit()));
    connect(actionZoomIn, SIGNAL(triggered()), m_scene, SLOT(zoomIn()));
    connect(actionZoomOut, SIGNAL(triggered()), m_scene, SLOT(zoomOut()));
    connect(actionNew, SIGNAL(triggered()), this, SLOT(newScene()));
    connect(actionOpen, SIGNAL(triggered()), this, SLOT(openScene()));
    connect(actionSave, SIGNAL(triggered()), this, SLOT(saveScene()));
    connect(actionSaveAs, SIGNAL(triggered()), this, SLOT(saveSceneAs()));
    connect(actionPartition, SIGNAL(triggered(bool)), Config::self(), SLOT(setShowPartition(bool)));
    connect(actionDensity, SIGNAL(triggered(bool)), Config::self(), SLOT(setShowDensity(bool)));
    connect(actionVectorField, SIGNAL(triggered(bool)), Config::self(), SLOT(setShowVectorField(bool)));
    connect(actionPreview, SIGNAL(triggered(bool)), Config::self(), SLOT(setShowPreviewTrajectory(bool)));
    connect(actionStatistics, SIGNAL(triggered(bool)), dwStatistics, SLOT(setVisible(bool)));
    connect(actionExport, SIGNAL(triggered()), this, SLOT(exportToTikz()));
    connect(actionReload, SIGNAL(triggered()), this, SLOT(reloadScene()));
	connect(actionStep, SIGNAL(triggered()), this, SLOT(tick()));
    connect(m_toolsUi->cmbTool, SIGNAL(currentIndexChanged(int)), m_scene, SLOT(selectTool(int)));
    connect(m_toolsUi->sbRadius, SIGNAL(valueChanged(double)), m_scene, SLOT(setOperationRadius(double)));

    connect(actionAbout, SIGNAL(triggered()), this, SLOT(helpAbout()));
    connect(actionAboutQt, SIGNAL(triggered()), this, SLOT(helpAboutQt()));
}
Пример #7
0
void MainWindow::createActions()
{
    connect(ui->actionAbout_Qt,SIGNAL(triggered()),this,SLOT(helpAboutQt()));
    connect(ui->actionExit,SIGNAL(triggered()),this,SLOT(close()));
    connect(ui->actionNew,SIGNAL(triggered()),this,SLOT(fileNew()));
}
Пример #8
0
MainWindow::MainWindow()
    : ui(new Ui::MainWindow),
      editPalette(palette()),
      previewPalette(palette()),
      previewstyle(0)
{
    ui->setupUi(this);
    statusBar();

    // signals and slots connections
    connect(ui->fontPathLineEdit, SIGNAL(returnPressed()), SLOT(addFontpath()));
    connect(ui->addFontPathButton, SIGNAL(clicked()), SLOT(addFontpath()));
    connect(ui->addSubstitutionButton, SIGNAL(clicked()), SLOT(addSubstitute()));
    connect(ui->browseFontPathButton, SIGNAL(clicked()), SLOT(browseFontpath()));
    connect(ui->fontStyleCombo, SIGNAL(activated(int)), SLOT(buildFont()));
    connect(ui->pointSizeCombo, SIGNAL(activated(int)), SLOT(buildFont()));
    connect(ui->downFontpathButton, SIGNAL(clicked()), SLOT(downFontpath()));
    connect(ui->downSubstitutionButton, SIGNAL(clicked()), SLOT(downSubstitute()));
    connect(ui->fontFamilyCombo, SIGNAL(activated(QString)), SLOT(familySelected(QString)));
    connect(ui->fileExitAction, SIGNAL(triggered()), SLOT(fileExit()));
    connect(ui->fileSaveAction, SIGNAL(triggered()), SLOT(fileSave()));
    connect(ui->helpAboutAction, SIGNAL(triggered()), SLOT(helpAbout()));
    connect(ui->helpAboutQtAction, SIGNAL(triggered()), SLOT(helpAboutQt()));
    connect(ui->mainTabWidget, SIGNAL(currentChanged(int)), SLOT(pageChanged(int)));
    connect(ui->paletteCombo, SIGNAL(activated(int)), SLOT(paletteSelected(int)));
    connect(ui->removeFontpathButton, SIGNAL(clicked()), SLOT(removeFontpath()));
    connect(ui->removeSubstitutionButton, SIGNAL(clicked()), SLOT(removeSubstitute()));
    connect(ui->toolBoxEffectCombo, SIGNAL(activated(int)), SLOT(somethingModified()));
    connect(ui->doubleClickIntervalSpinBox, SIGNAL(valueChanged(int)), SLOT(somethingModified()));
    connect(ui->cursorFlashTimeSpinBox, SIGNAL(valueChanged(int)), SLOT(somethingModified()));
    connect(ui->wheelScrollLinesSpinBox, SIGNAL(valueChanged(int)), SLOT(somethingModified()));
    connect(ui->menuEffectCombo, SIGNAL(activated(int)), SLOT(somethingModified()));
    connect(ui->comboEffectCombo, SIGNAL(activated(int)), SLOT(somethingModified()));
    connect(ui->toolTipEffectCombo, SIGNAL(activated(int)), SLOT(somethingModified()));
    connect(ui->strutWidthSpinBox, SIGNAL(valueChanged(int)), SLOT(somethingModified()));
    connect(ui->strutHeightSpinBox, SIGNAL(valueChanged(int)), SLOT(somethingModified()));
    connect(ui->effectsCheckBox, SIGNAL(toggled(bool)), SLOT(somethingModified()));
    connect(ui->resolveLinksCheckBox, SIGNAL(toggled(bool)), SLOT(somethingModified()));
    connect(ui->fontEmbeddingCheckBox, SIGNAL(clicked()), SLOT(somethingModified()));
    connect(ui->rtlExtensionsCheckBox, SIGNAL(toggled(bool)), SLOT(somethingModified()));
    connect(ui->inputStyleCombo, SIGNAL(activated(int)), SLOT(somethingModified()));
    connect(ui->inputMethodCombo, SIGNAL(activated(int)), SLOT(somethingModified()));
    connect(ui->guiStyleCombo, SIGNAL(activated(QString)), SLOT(styleSelected(QString)));
    connect(ui->familySubstitutionCombo, SIGNAL(activated(QString)), SLOT(substituteSelected(QString)));
    connect(ui->tunePaletteButton, SIGNAL(clicked()), SLOT(tunePalette()));
    connect(ui->upFontpathButton, SIGNAL(clicked()), SLOT(upFontpath()));
    connect(ui->upSubstitutionButton, SIGNAL(clicked()), SLOT(upSubstitute()));

    modified = true;
    desktopThemeName = tr("Desktop Settings (Default)");
    setWindowIcon(QPixmap(":/qt-project.org/qtconfig/images/appicon.png"));
    QStringList gstyles = QStyleFactory::keys();
    gstyles.sort();
    ui->guiStyleCombo->addItem(desktopThemeName);
    ui->guiStyleCombo->setItemData(ui->guiStyleCombo->findText(desktopThemeName),
                                   tr("Choose style and palette based on your desktop settings."),
                                   Qt::ToolTipRole);
    ui->guiStyleCombo->addItems(gstyles);

    QSettings settings(QLatin1String("QtProject"));
    settings.beginGroup(QLatin1String("Qt"));

    QString currentstyle = settings.value(QLatin1String("style")).toString();
    if (currentstyle.isEmpty()) {
        ui->guiStyleCombo->setCurrentIndex(ui->guiStyleCombo->findText(desktopThemeName));
        currentstyle = QApplication::style()->objectName();
    } else {
        int index = ui->guiStyleCombo->findText(currentstyle, Qt::MatchFixedString);
        if (index != -1) {
            ui->guiStyleCombo->setCurrentIndex(index);
        } else { // we give up
            ui->guiStyleCombo->addItem(tr("Unknown"));
            ui->guiStyleCombo->setCurrentIndex(ui->guiStyleCombo->count() - 1);
        }
    }
    ui->buttonMainColor->setColor(palette().color(QPalette::Active, QPalette::Button));
    ui->buttonWindowColor->setColor(palette().color(QPalette::Active, QPalette::Window));
    connect(ui->buttonMainColor, SIGNAL(colorChanged(QColor)), SLOT(buildPalette()));
    connect(ui->buttonWindowColor, SIGNAL(colorChanged(QColor)), SLOT(buildPalette()));

#ifdef Q_WS_X11
    if (X11->desktopEnvironment == DE_KDE)
        ui->colorConfig->hide();
    else
        ui->kdeNoteLabel->hide();
#else
    ui->colorConfig->hide();
    ui->kdeNoteLabel->hide();
#endif

    QFontDatabase db;
    QStringList families = db.families();
    ui->fontFamilyCombo->addItems(families);

    QStringList fs = families;
    QStringList fs2 = QFont::substitutions();
    QStringList::Iterator fsit = fs2.begin();
    while (fsit != fs2.end()) {
        if (!fs.contains(*fsit))
            fs += *fsit;
        fsit++;
    }
    fs.sort();
    ui->familySubstitutionCombo->addItems(fs);

    ui->chooseSubstitutionCombo->addItems(families);
    QList<int> sizes = db.standardSizes();
    foreach(int i, sizes)
        ui->pointSizeCombo->addItem(QString::number(i));

    ui->doubleClickIntervalSpinBox->setValue(QApplication::doubleClickInterval());
    ui->cursorFlashTimeSpinBox->setValue(QApplication::cursorFlashTime());
    ui->wheelScrollLinesSpinBox->setValue(QApplication::wheelScrollLines());
    // #############
    // resolveLinksCheckBox->setChecked(qt_resolve_symlinks);

    ui->effectsCheckBox->setChecked(QApplication::isEffectEnabled(Qt::UI_General));
    ui->effectsFrame->setEnabled(ui->effectsCheckBox->isChecked());

    if (QApplication::isEffectEnabled(Qt::UI_FadeMenu))
        ui->menuEffectCombo->setCurrentIndex(2);
    else if (QApplication::isEffectEnabled(Qt::UI_AnimateMenu))
        ui->menuEffectCombo->setCurrentIndex(1);

    if (QApplication::isEffectEnabled(Qt::UI_AnimateCombo))
        ui->comboEffectCombo->setCurrentIndex(1);

    if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip))
        ui->toolTipEffectCombo->setCurrentIndex(2);
    else if (QApplication::isEffectEnabled(Qt::UI_AnimateTooltip))
        ui->toolTipEffectCombo->setCurrentIndex(1);

    if (QApplication::isEffectEnabled(Qt::UI_AnimateToolBox))
        ui->toolBoxEffectCombo->setCurrentIndex(1);

    QSize globalStrut = QApplication::globalStrut();
    ui->strutWidthSpinBox->setValue(globalStrut.width());
    ui->strutHeightSpinBox->setValue(globalStrut.height());

    // find the default family
    QStringList::Iterator sit = families.begin();
    int i = 0, possible = -1;
    while (sit != families.end()) {
        if (*sit == QApplication::font().family())
            break;
        if ((*sit).contains(QApplication::font().family()))
            possible = i;

        i++;
        sit++;
    }
    if (sit == families.end())
        i = possible;
    if (i == -1) // no clue about the current font
        i = 0;

    ui->fontFamilyCombo->setCurrentIndex(i);

    QStringList styles = db.styles(ui->fontFamilyCombo->currentText());
    ui->fontStyleCombo->addItems(styles);

    QString stylestring = db.styleString(QApplication::font());
    sit = styles.begin();
    i = 0;
    possible = -1;
    while (sit != styles.end()) {
        if (*sit == stylestring)
            break;
        if ((*sit).contains(stylestring))
            possible = i;

        i++;
        sit++;
    }
    if (sit == styles.end())
        i = possible;
    if (i == -1) // no clue about the current font
        i = 0;
    ui->fontStyleCombo->setCurrentIndex(i);

    i = 0;
    for (int psize = QApplication::font().pointSize(); i < ui->pointSizeCombo->count(); ++i) {
        const int sz = ui->pointSizeCombo->itemText(i).toInt();
        if (sz == psize) {
            ui->pointSizeCombo->setCurrentIndex(i);
            break;
        } else if(sz > psize) {
            ui->pointSizeCombo->insertItem(i, QString::number(psize));
            ui->pointSizeCombo->setCurrentIndex(i);
            break;
        }
    }

    QStringList subs = QFont::substitutes(ui->familySubstitutionCombo->currentText());
    ui->substitutionsListBox->clear();
    ui->substitutionsListBox->insertItems(0, subs);

    ui->rtlExtensionsCheckBox->setChecked(settings.value(QLatin1String("useRtlExtensions"), false)
                                          .toBool());

#ifdef Q_WS_X11
    QString settingsInputStyle = settings.value(QLatin1String("XIMInputStyle")).toString();
    if (!settingsInputStyle.isEmpty())
      ui->inputStyleCombo->setCurrentIndex(ui->inputStyleCombo->findText(settingsInputStyle));
#else
    ui->inputStyleCombo->hide();
    ui->inputStyleLabel->hide();
#endif

#if defined(Q_WS_X11) && !defined(QT_NO_XIM)
    QStringList inputMethodCombo = QInputContextFactory::keys();
    int inputMethodComboIndex = -1;
    QString defaultInputMethod = settings.value(QLatin1String("DefaultInputMethod"), QLatin1String("xim")).toString();
    for (int i = inputMethodCombo.size()-1; i >= 0; --i) {
        const QString &im = inputMethodCombo.at(i);
        if (im.contains(QLatin1String("imsw"))) {
            inputMethodCombo.removeAt(i);
            if (inputMethodComboIndex > i)
                --inputMethodComboIndex;
        } else if (im == defaultInputMethod) {
            inputMethodComboIndex = i;
        }
    }
    if (inputMethodComboIndex == -1 && !inputMethodCombo.isEmpty())
        inputMethodComboIndex = 0;
    ui->inputMethodCombo->addItems(inputMethodCombo);
    ui->inputMethodCombo->setCurrentIndex(inputMethodComboIndex);
#else
    ui->inputMethodCombo->hide();
    ui->inputMethodLabel->hide();
#endif

    ui->fontEmbeddingCheckBox->setChecked(settings.value(QLatin1String("embedFonts"), true)
                                          .toBool());
    fontpaths = settings.value(QLatin1String("fontPath")).toStringList();
    ui->fontpathListBox->insertItems(0, fontpaths);

    settings.endGroup(); // Qt

    ui->helpView->setText(tr(appearance_text));

    setModified(false);
    updateStyleLayout();
}
Пример #9
0
LDViewMainWindow::LDViewMainWindow(QApplication *a)
	:QMainWindow(),Ui::LDView(),
	fileSeparatorIndex(-1),
	toolbarMaxStep(new QLabel),
	toolbarCurrentStep(new QLabel),
	toolbarStepLabel(new QLabel("Step :")),
	toolbarViewAngle(NULL),
	toolbarWireframeMenu(new QMenu(this)),
	edgeMenu(new QMenu(this)),
	bfcMenu(new QMenu(this)),
	primitiveMenu(new QMenu(this))
{
    setupUi(this);
	toolbar->insertWidget(toolbarFirstStep,toolbarStepLabel);
	toolbar->insertWidget(toolbarFirstStep,toolbarCurrentStep);
	toolbar->insertWidget(toolbarFirstStep,toolbarMaxStep);
    if (modelViewer) modelViewer->setMainWindow(this);
    connect( fileOpenAction, SIGNAL( triggered() ), this, SLOT( fileOpen() ) );
    connect( fileSaveSettingsAction, SIGNAL( triggered() ), this, SLOT( fileSaveSettings() ) );
    connect( fileExportAction, SIGNAL( triggered() ), this, SLOT( fileExport() ) );
    connect( fileExportOptionAction, SIGNAL( triggered() ), this, SLOT( fileExportOption() ) );
	connect( file3DSExportOptionAction, SIGNAL( triggered() ), this, SLOT( file3DSExportOption() ) );
    connect( fileJPEGOptionsAction, SIGNAL( triggered() ), this, SLOT( fileJPEGOptions() ) );
    connect( fileSaveAction, SIGNAL( triggered() ), this, SLOT( fileSave() ) );
    connect( filePrintAction, SIGNAL( triggered() ), this, SLOT( filePrint() ) );
    connect( fileExitAction, SIGNAL( triggered() ), this, SLOT( fileExit() ) );
    connect( helpContentsAction, SIGNAL( triggered() ), this, SLOT( helpContents() ) );
    connect( helpAboutAction, SIGNAL( triggered() ), this, SLOT( helpAbout() ) );
    connect( helpAboutQtAction, SIGNAL( triggered() ), this, SLOT( helpAboutQt() ) );
    connect( editPreferencesAction, SIGNAL( triggered() ), this, SLOT( editPreferences() ) );
    connect( viewToolBarAction, SIGNAL( toggled(bool) ), this, SLOT( viewToolBar(bool) ) );
    connect( toolbarWireframeAction, SIGNAL( toggled(bool) ), this, SLOT( toolbarWireframe(bool) ) );
    connect( toolbarEdgeAction, SIGNAL( toggled(bool) ), this, SLOT( toolbarEdge(bool) ) );
    connect( toolbarPrimitiveSubstitutionAction, SIGNAL( toggled(bool) ), this, SLOT( toolbarPrimitiveSubstitution(bool) ) );
    connect( toolbarLightingAction, SIGNAL( toggled(bool) ), this, SLOT( toolbarLighting(bool) ) );
    connect( toolbarBFCAction, SIGNAL( toggled(bool) ), this, SLOT( toolbarBFC(bool) ) );
    connect( toolbarAxesAction, SIGNAL( toggled(bool) ), this, SLOT( toolbarAxes(bool) ) );
    connect( toolbarSeamsAction, SIGNAL( toggled(bool) ), this, SLOT( toolbarSeams(bool) ) );
    connect( viewStatusBarAction, SIGNAL( toggled(bool) ), this, SLOT( viewStatusBar(bool) ) );
    connect( viewLatitudeRotationAction, SIGNAL( toggled(bool) ), this, SLOT( latitudeRotation(bool) ) );
    connect( viewKeepRightSideUpAction, SIGNAL( toggled(bool) ), this, SLOT( keepRightSideUp(bool) ) );
    connect( viewFullScreenAction, SIGNAL( triggered() ), this, SLOT( viewFullScreen() ) );
    connect( viewResetViewAction, SIGNAL( triggered() ), this, SLOT( viewResetView() ) );
    connect( helpOpenGLDriverInfoAction, SIGNAL( triggered() ), this, SLOT( helpOpenGLDriverInfo() ) );
    connect( fileLDrawDirAction, SIGNAL( triggered() ), this, SLOT( fileLDrawDir() ) );
    connect( fileExtraDirAction, SIGNAL( triggered() ), this, SLOT( fileExtraDir() ) );
    connect( fileCheckForUpdatesAction, SIGNAL( triggered() ), this, SLOT( fileCheckForUpdates() ) );
    connect( fileReloadAction, SIGNAL( triggered() ), this, SLOT( fileReload() ) );
    connect( viewShowErrorsAction, SIGNAL( triggered() ), this, SLOT( viewShowErrors() ) );
    connect( pollActionGroup, SIGNAL( triggered(QAction*) ), this, SLOT( pollChanged(QAction*) ) );
    connect( viewZoomToFitAction, SIGNAL( triggered() ), this, SLOT( viewZoomToFit() ) );
	connect( viewRightSideUpAction, SIGNAL( triggered() ), this, SLOT( viewRightSideUp() ) );
    connect( viewModeActionGroup, SIGNAL( triggered(QAction*) ), this, SLOT( viewModeChanged(QAction*) ) );
    connect( frontViewAngleAction, SIGNAL( triggered() ), this, SLOT( frontViewAngle() ) );
    connect( backViewAngleAction, SIGNAL( triggered() ), this, SLOT( backViewAngle() ) );
    connect( leftViewAngleAction, SIGNAL( triggered() ), this, SLOT( leftViewAngle() ) );
    connect( rightViewAngleAction, SIGNAL( triggered() ), this, SLOT( rightViewAngle() ) );
    connect( topViewAngleAction, SIGNAL( triggered() ), this, SLOT( topViewAngle() ) );
    connect( bottomViewAngleAction, SIGNAL( triggered() ), this, SLOT( bottomViewAngle() ) );
    connect( latLongViewAngleAction, SIGNAL( triggered() ), this, SLOT( latLongViewAngle() ) );
    connect( isoViewAngleAction, SIGNAL( triggered() ), this, SLOT( isoViewAngle() ) );
    connect( saveDefaultViewAngleAction, SIGNAL( triggered() ), this, SLOT( saveDefaultViewAngle() ) );
    connect( fileCancelLoadAction, SIGNAL( triggered() ), this, SLOT( fileCancelLoad() ) );
    connect( showViewInfoAction, SIGNAL( triggered() ), this, SLOT( showViewInfo() ) );
    connect( showPovCameraAction, SIGNAL( triggered() ), this, SLOT( showPovCamera() ) );
    connect( showPovAspectRatioAction, SIGNAL( toggled(bool) ), this, SLOT( showPovAspectRatio(bool) ) );
    connect( toolsPartListAction, SIGNAL( triggered() ), this, SLOT( toolsPartList() ) );
    connect( toolbarPrevStep, SIGNAL( triggered() ), this, SLOT( prevStep() ) );
    connect( toolbarNextStep, SIGNAL( triggered() ), this, SLOT( nextStep() ) );
    connect( toolbarFirstStep, SIGNAL( triggered() ), this, SLOT( firstStep() ) );
    connect( toolbarLastStep, SIGNAL( triggered() ), this, SLOT( lastStep() ) );
    connect( stepGoto, SIGNAL( triggered() ), this, SLOT( gotoStep() ) );
    connect( toolsModelTreeAction, SIGNAL( triggered() ), this, SLOT( toolsModelTree() ) );
    connect( toolsBoundingBoxAction, SIGNAL( triggered() ), this, SLOT( toolsBoundingBox() ) );
    connect( toolsMpdModelSelectionAction, SIGNAL( triggered() ), this, SLOT( toolsMpdModelSelection() ) );

    connect(fileMenu, SIGNAL(aboutToShow()), this, SLOT(doFileMenuAboutToShow()));
    connect(editMenu, SIGNAL(aboutToShow()), this, SLOT(doEditMenuAboutToShow()));
    connect(viewMenu, SIGNAL(aboutToShow()), this, SLOT(doViewMenuAboutToShow()));
    connect(toolsMenu,SIGNAL(aboutToShow()), this, SLOT(doToolsMenuAboutToShow()));
    connect(helpMenu, SIGNAL(aboutToShow()), this, SLOT(doHelpMenuAboutToShow()));

	int cnt,i;
	QAction *item;
    for ( cnt = i = 0; ; i++)
    {
        item = fileMenu->actions()[i];
        if (item->isSeparator())
        {
            if (++cnt == 2)
                break;
        }
    }
    fileSeparatorIndex = i;
#ifdef __APPLE__
    fileMenu->removeItemAt(fileSeparatorIndex);
    fileSeparatorIndex = -1;
    openRecentMenu = new QMenu(this, "openRecentMenu");
    fileMenu->insertItem("Open Recent", openRecentMenu, -1, 1);
#endif // __APPLE__
    if (!recentFiles)
    {
        recentFiles = new TCStringArray(10);
        populateRecentFiles();
    }
    populateRecentFileMenuItems();
	setupStandardSizes();
#ifdef __APPLE__
        // Since Preferences is the only item in the edit menu, we need to
        // delete the edit menu on the Mac, since the item is going to get
        // magically moved to the LDView menu.  The problem is, if we delete
        // the edit menu, the magic stops working, since it's apparently all
        // done on the fly.  So, we're going to create a new fully-functional
        // Preferences menu item at the top of the File menu, and THEN delete
        // the edit menu.  This newly created menu item won't be visible to the
        // user, but it will make the other one continue to function after the
        // deletion of the edit menu.
        fileMenu->insertItem("Preferences", this, SLOT(doPreferences()),
            0, -1, 0);
        // Remove the (empty without Preferences) edit menu.
        menuBar->removeItem(menuBar->idAt(1));
#endif //__APPLE__
	toolbarViewAngle = new QToolButton(toolbar);
	toolbarViewAngle->setMenu(viewingAnglePopupMenu);
	toolbarViewAngle->setPopupMode(QToolButton::InstantPopup);
	toolbarViewAngle->setIcon(QPixmap( ":/images/images/toolbar_view.png"));
	toolbarViewAngle->setEnabled(false);
	toolbar->insertWidget(editPreferencesAction,toolbarViewAngle);
	connect( wireframeFogAction, SIGNAL( toggled(bool) ), this, SLOT( toolbarWireframeFog(bool) ) );
	connect( wireframeRemoveHiddenLinesAction, SIGNAL( toggled(bool) ), this, SLOT( toolbarWireframeRemoveHiddenLines(bool) ) );
	toolbarWireframeMenu->addAction(wireframeFogAction);
	toolbarWireframeMenu->addAction(wireframeRemoveHiddenLinesAction);
	QToolButton *toolbarWireframe =
		(QToolButton *)toolbar->widgetForAction(toolbarWireframeAction);	
	if (toolbarWireframe != NULL)
	{
		toolbarWireframe->setMenu(toolbarWireframeMenu);
		toolbarWireframe->setPopupMode(QToolButton::MenuButtonPopup);
	}
	connect( textureStudAction, SIGNAL( toggled(bool) ), this, SLOT( textureStud(bool) ) );
	primitiveMenu->addAction(textureStudAction);
	QToolButton *toolbarPrimitives =
		(QToolButton *)toolbar->widgetForAction(toolbarPrimitiveSubstitutionAction);
	if (toolbarPrimitives)
	{
		toolbarPrimitives->setMenu(primitiveMenu);
		toolbarPrimitives->setPopupMode(QToolButton::MenuButtonPopup);
	}
	connect( edgeShowEdgeOnlyAction, SIGNAL( toggled(bool) ), this, SLOT( edgeShowEdgeOnly(bool) ) );
	connect( edgeConditionalLineAction, SIGNAL( toggled(bool) ), this, SLOT( edgeConditionalLine(bool) ) );
	connect( edgeHighQualityAction, SIGNAL( toggled(bool) ), this, SLOT( edgeHighQuality(bool) ) );
	connect( edgeAlwaysBlackAction, SIGNAL( toggled(bool) ), this, SLOT( edgeAlwaysBlack(bool) ) );
	edgeMenu->addAction(edgeShowEdgeOnlyAction);
	edgeMenu->addAction(edgeConditionalLineAction);
	edgeMenu->addAction(edgeHighQualityAction);
	edgeMenu->addAction(edgeAlwaysBlackAction);
	QToolButton *toolbarEdge =
		(QToolButton *)toolbar->widgetForAction(toolbarEdgeAction);
	if (toolbarEdge)
	{
		toolbarEdge->setMenu(edgeMenu);
		toolbarEdge->setPopupMode(QToolButton::MenuButtonPopup);
	}
	connect( bfcRedBackFacesAction, SIGNAL( toggled(bool) ), this, SLOT( bfcRedBackFaces(bool) ) );
	connect( bfcGreenFrontFacesAction, SIGNAL( toggled(bool) ), this, SLOT( bfcGreenFrontFaces(bool) ) );
	connect( bfcBlueNeutralFacesAction, SIGNAL( toggled(bool) ), this, SLOT( bfcBlueNeutralFaces(bool) ) );
	bfcMenu->addAction(bfcRedBackFacesAction);
	bfcMenu->addAction(bfcGreenFrontFacesAction);
	bfcMenu->addAction(bfcBlueNeutralFacesAction);
	QToolButton *toolbarBfc =
		(QToolButton *)toolbar->widgetForAction(toolbarBFCAction);
	if (toolbarBfc)
	{
		toolbarBfc->setMenu(bfcMenu);
		toolbarBfc->setPopupMode(QToolButton::MenuButtonPopup);
	}
    modelViewer->setApplication(a);
}