Ejemplo n.º 1
0
QWidget *NavFichiers::nouvelOnglet()
{
	QSettings settings(Multiuso::appDirPath() + "/ini/nav_fichiers.ini", QSettings::IniFormat);

	QString welcomeFolder = settings.value("dossier_accueil").toString();

	if (!QDir(welcomeFolder).exists())
		welcomeFolder = QDir::homePath();

	VueDossier *vue = new VueDossier(this);
		connect(vue, SIGNAL(debutChargement()), this, SLOT(slotDebutChargement()));
		connect(vue, SIGNAL(finChargement()), this, SLOT(slotFinChargement()));
		connect(vue, SIGNAL(demandeUpdate()), this, SLOT(slotUpdateAffichage()));
		connect(vue, SIGNAL(openFileRequested(QString)), this, SLOT(slotOpenFile(QString)));
		vue->setChemin(welcomeFolder);
		vue->setViewMode(selectView->currentText());
		vue->lister();

	QVBoxLayout *layout = new QVBoxLayout;
		layout->addWidget(vue);
		layout->setContentsMargins(0, 0, 0, 0);

	QWidget *page = new QWidget;
		page->setLayout(layout);

	return page;
}
Ejemplo n.º 2
0
void ShowFoto::setupActions()
{
    Digikam::ThemeManager::instance()->setThemeMenuAction(new QMenu(i18n("&Themes"), this));
    setupStandardActions();

    // Extra 'File' menu actions ---------------------------------------------

    d->fileOpenAction = buildStdAction(StdOpenAction, this, SLOT(slotOpenFile()), this);
    actionCollection()->addAction(QLatin1String("showfoto_open_file"), d->fileOpenAction);

    d->openFilesInFolderAction = new QAction(QIcon::fromTheme(QLatin1String("folder-pictures")), i18n("Open folder"), this);
    actionCollection()->setDefaultShortcut(d->openFilesInFolderAction, Qt::CTRL+Qt::SHIFT+Qt::Key_O);

    connect(d->openFilesInFolderAction, &QAction::triggered,
            this, &ShowFoto::slotOpenFilesInFolder);

    actionCollection()->addAction(QLatin1String("showfoto_open_folder"), d->openFilesInFolderAction);

    QAction* const quit = buildStdAction(StdQuitAction, this, SLOT(close()), this);
    actionCollection()->addAction(QLatin1String("showfoto_quit"), quit);

    // -- Standard 'Help' menu actions ---------------------------------------------

    createHelpActions(false);
}
Ejemplo n.º 3
0
void MainWindow::createMenu()
{
    QMenu *fileMenu = menuBar()->addMenu(tr("File"));
    
    QAction *openAct = new QAction(tr("Open"),this);
    connect(openAct,SIGNAL(triggered()),this,SLOT(slotOpenFile()));
    fileMenu->addAction(openAct);
}
Ejemplo n.º 4
0
MainWindow::MainWindow(QWidget *parent) :
  QMainWindow(parent),
  ui(new Ui::MainWindow)
{
  ui->setupUi(this);
  connect(ui->send,SIGNAL(clicked()),this,SLOT(slotSend()));
  connect(ui->open_attach,SIGNAL(clicked()),this,SLOT(slotOpenFile()));
}
Ejemplo n.º 5
0
void MainWindow::setupActions()
{
  //file menu
  KStdAction::openNew(this, SLOT(slotNewFile()), actionCollection());
  KStdAction::open(this, SLOT(slotOpenFile()), actionCollection());

  m_actionRecent = KStdAction::openRecent(this, SLOT(slotFileRecent(const KURL&)), actionCollection());
  m_actionRecent->loadEntries(kapp->config());//,"Recent Files");

  KStdAction::save(this, SLOT(slotSaveCurrentFile()), actionCollection());
  KStdAction::saveAs(this, SLOT(slotSaveCurrentFileAs()), actionCollection());

  KStdAction::close(this, SLOT(slotCloseFile()), actionCollection());

  (void)new KAction(i18n("Close All"), 0, this, SLOT(slotCloseAllFiles()), actionCollection(), "file_close_all");

  KStdAction::quit(this, SLOT(slotQuit()), actionCollection());

  KStdAction::keyBindings(this, SLOT(slotEditKeys()), actionCollection());
  KStdAction::configureToolbars(this, SLOT(slotEditToolbars()), actionCollection());
  KStdAction::preferences(this, SLOT(slotShowSettings()), actionCollection(), "settings_gpteditor");


  (void)new KAction(i18n("Compile"), "make_kdevelop", "F10", m_debugger_manager,
                    SLOT(slotCompileApplication()), actionCollection(), "compile_application");

  (void)new KAction(i18n("Run"), "gear", "F9", m_debugger_manager,
                    SLOT(slotRunApplication()), actionCollection(), "run_application");

  (void)new KAction(i18n("Start Debug"), "dbgstart", "F5", m_debugger_manager,
                    SLOT(slotDebugStart()), actionCollection(), "debug_start");

  (void)new KAction(i18n("Stop Debug"), "stop", "Escape", m_debugger_manager,
                    SLOT(slotDebugStop()), actionCollection(), "debug_stop");

  (void)new KAction(i18n("Step Over"), "dbgnext", "F6", m_debugger_manager,
                    SLOT(slotDebugStepOver()), actionCollection(), "debug_step_over");

  (void)new KAction(i18n("Step Into"), "dbgstep", "F7", m_debugger_manager,
                    SLOT(slotDebugStepInto()), actionCollection(), "debug_step_into");

  (void)new KAction(i18n("Step Out"), "dbgstepout", "F8", m_debugger_manager,
                    SLOT(slotDebugStepOut()), actionCollection(), "debug_step_out");

//   (void)new KAction(i18n("Profile (DBG only)"), "math_sum", "Alt+P", m_debugger_manager,
//                     SLOT(slotProfile()), actionCollection(), "script_profile");

  (void)new KAction(i18n("Toggle Breakpoint"), "activebreakpoint", "Alt+B", m_debugger_manager,
                    SLOT(slotDebugToggleBp()), actionCollection(), "debug_toggle_bp");

//   (void)new KAction("", "math_brace", 0, m_tabEditor,
//                     SLOT(slotAddWatch()), actionCollection(), "editor_add_watch");


  // Editor default action

  setStandardToolBarMenuEnabled(true);
}
Ejemplo n.º 6
0
void ImageWorkShop::initImageWorkShop(){
	//imagewidget = new ImageWidget(ui.centralWidget);
	loadImage = false;
	connect(ui.actionOpen, SIGNAL(triggered()), this, SLOT(slotOpenFile()));
	connect(ui.actionSave_as, SIGNAL(triggered()), this, SLOT(slotSaveFile()));
	connect(ui.actionImage_last_saved, SIGNAL(triggered()), this, SLOT(slotCompare()));
	connect(ui.actionStageSave, SIGNAL(triggered()), this, SLOT(slotStageSave()));
	connect(ui.actionStageBack, SIGNAL(triggered()), this, SLOT(slotStageBack()));
	connect(ui.horizontalSliderVignette, SIGNAL(actionTriggered(int)), this, SLOT(slotVignetteFactor()));
	connect(ui.pushButtonMedian, SIGNAL(clicked()), this, SLOT(slotMedian()));
	connect(ui.horizontalSliderGauss, SIGNAL(actionTriggered(int)), this, SLOT(slotGauss()));
	connect(ui.horizontalSliderBalance, SIGNAL(actionTriggered(int)), this, SLOT(slotWhiteBalance()));
	connect(ui.horizontalSliderSaturation, SIGNAL(actionTriggered(int)), this, SLOT(slotSaturation()));

	connect(ui.pushButtonSharp, SIGNAL(clicked()), this, SLOT(slotSharp()));

	connect(ui.pushButtonLiquify, SIGNAL(clicked()), this, SLOT(slotLiquify()));
	connect(ui.pushButtonLiquifyRadius, SIGNAL(clicked()), this, SLOT(slotLiquifySetRadius()));

	connect(ui.comboBox_Lomo, SIGNAL(currentIndexChanged(int)), this, SLOT(slotLomo()));
	connect(ui.horizontalSliderLomoR, SIGNAL(actionTriggered(int)), this, SLOT(slotLomoR()));
	connect(ui.horizontalSliderLomoG, SIGNAL(actionTriggered(int)), this, SLOT(slotLomoG()));
	connect(ui.horizontalSliderLomoB, SIGNAL(actionTriggered(int)), this, SLOT(slotLomoB()));

	connect(ui.pushButton_Exfoliating, SIGNAL(clicked()), this, SLOT(slotExfoliating()));

	connect(ui.horizontalSliderWhitenSkin, SIGNAL(actionTriggered(int)), this, SLOT(slotWhitenSkin()));

	connect(ui.horizontalSliderWhitenSkinMask, SIGNAL(actionTriggered(int)), this, SLOT(slotDrawSkinMaskRadius()));
	connect(ui.horizontalSliderThreshold, SIGNAL(actionTriggered(int)), this, SLOT(slotWhitenThreshold()));

	connect(ui.pushButton_Source, SIGNAL(clicked()), this, SLOT(slotColorMapSource()));
	connect(ui.pushButton_Target, SIGNAL(clicked()), this, SLOT(slotColorMapTarget()));
	connect(ui.pushButton_Result, SIGNAL(clicked()), this, SLOT(slotColorMapResult()));
	connect(ui.pushButton_ResultGrayToRGB, SIGNAL(clicked()), this, SLOT(slotColorMapGrayToRGB()));


	connect(ui.horizontalSliderBrushRadiusImageCopy, SIGNAL(actionTriggered(int)), this, SLOT(slotImageCopyRadius()));
	connect(ui.pushButtonMovePatch, SIGNAL(clicked()), this, SLOT(slotImageCopyMovePatch()));

	connect(ui.horizontalSliderBrushRadiusImageInpaintHole, SIGNAL(actionTriggered(int)), this, SLOT(slotImageInpaintRadius()));
	connect(ui.pushButtonImageInpaintHoleResult, SIGNAL(clicked()), this, SLOT(slotImageInpaintResult()));

	connect(ui.horizontalSliderBrushRadiusImageInpaintHoleRestrict, SIGNAL(actionTriggered(int)), this, SLOT(slotImageInpaintRestrictRadius()));
	connect(ui.pushButtonImageInpaintHoleRestrictResult, SIGNAL(clicked()), this, SLOT(slotImageInpaintRestrictResult()));
	connect(ui.pushButtonImageInpaintHoleRestrictResultOut, SIGNAL(clicked()), this, SLOT(slotImageInpaintRestrictResultOut()));
	connect(ui.pushButtonErodeRadius, SIGNAL(clicked()), this, SLOT(slotRrodeRadius()));
	connect(ui.comboBox_ifGpu, SIGNAL(currentIndexChanged(int)), this, SLOT(slotPatchMatchIfGpu()));

	connect(ui.pushButton_ClearRestrict, SIGNAL(clicked()), this, SLOT(slotClearRestrict()));
	connect(ui.pushButton_ClearRegion, SIGNAL(clicked()), this, SLOT(slotClearRegion()));
	
}
Ejemplo n.º 7
0
// Constructor
SimpleView::SimpleView() 
{
  this->ui = new Ui_SimpleView;
  this->ui->setupUi(this);

  // Qt Table View
  this->TableView = vtkSmartPointer<vtkQtTableView>::New();

  // Place the table view in the designer form
  this->ui->tableFrame->layout()->addWidget(this->TableView->GetWidget());

  // Geometry
  VTK_CREATE(vtkVectorText, text);
  text->SetText("VTK and Qt!");
  VTK_CREATE(vtkElevationFilter, elevation);
  elevation->SetInputConnection(text->GetOutputPort());
  elevation->SetLowPoint(0,0,0);
  elevation->SetHighPoint(10,0,0);

  // Mapper
  VTK_CREATE(vtkPolyDataMapper, mapper);
  mapper->ImmediateModeRenderingOn();
  mapper->SetInputConnection(elevation->GetOutputPort());

  // Actor in scene
  VTK_CREATE(vtkActor, actor);
  actor->SetMapper(mapper);

  // VTK Renderer
  VTK_CREATE(vtkRenderer, ren);

  // Add Actor to renderer
  ren->AddActor(actor);

  // VTK/Qt wedded
  this->ui->qvtkWidget->GetRenderWindow()->AddRenderer(ren);

  // Just a bit of Qt interest: Culling off the
  // point data and handing it to a vtkQtTableView
  VTK_CREATE(vtkDataObjectToTable, toTable);
  toTable->SetInputConnection(elevation->GetOutputPort());
  toTable->SetFieldType(vtkDataObjectToTable::POINT_DATA);

  // Here we take the end of the VTK pipeline and give it to a Qt View
  this->TableView->SetRepresentationFromInputConnection(toTable->GetOutputPort());

  // Set up action signals and slots
  connect(this->ui->actionOpenFile, SIGNAL(triggered()), this, SLOT(slotOpenFile()));
  connect(this->ui->actionExit, SIGNAL(triggered()), this, SLOT(slotExit()));

};
Ejemplo n.º 8
0
void
MainWindow::createActions()
{
	
    // file open action
    fileOpenAction = new QAction(QIcon(":/images/open.png"),tr("Open"),this);	// 打开文件
    fileOpenAction->setShortcut(tr("Ctrl+O"));
    fileOpenAction->setStatusTip(tr("open a file"));
    connect(fileOpenAction,SIGNAL(triggered()),this,SLOT(slotOpenFile()));

    
    // file new action
    fileNewAction = new QAction(QIcon(":/images/new.png"),tr("New"),this);	// 新建文件
    fileNewAction->setShortcut(tr("Ctrl+N"));
    fileNewAction->setStatusTip(tr("new file"));
    connect(fileNewAction,SIGNAL(triggered()),this,SLOT(slotNewFile()));

    // save file action
    fileSaveAction = new QAction(QPixmap(":/images/save.png"),tr("Save"),this);	// 保存文件 
    fileSaveAction->setShortcut(tr("Ctrl+S"));
    fileSaveAction->setStatusTip(tr("save file"));
    connect(fileSaveAction,SIGNAL(activated()),this,SLOT(slotSaveFile()));

    // exit action
    exitAction = new QAction(tr("Exit"), this);	// 退出
    exitAction->setShortcut(tr("Ctrl+Q"));
    exitAction->setStatusTip(tr("exit"));
    connect(exitAction, SIGNAL(triggered()), this, SLOT(close()));

    cutAction = new QAction(QIcon(":/images/cut.png"), tr("Cut"), this);		// 剪切
    cutAction->setShortcut(tr("Ctrl+X"));
    cutAction->setStatusTip(tr("cut to clipboard"));
    connect(cutAction, SIGNAL(triggered()), text, SLOT(cut()));

    copyAction = new QAction(QIcon(":/images/copy.png"), tr("Copy"), this);		// 复制
    copyAction->setShortcut(tr("Ctrl+C"));
    copyAction->setStatusTip(tr("copy to clipboard"));
    connect(copyAction, SIGNAL(triggered()), text, SLOT(copy()));

    pasteAction = new QAction(QIcon(":/images/paste.png"), tr("Paste"), this);		// 粘贴
    pasteAction->setShortcut(tr("Ctrl+V"));
    pasteAction->setStatusTip(tr("paste clipboard to selection"));
    connect(pasteAction, SIGNAL(triggered()), text, SLOT(paste()));

    aboutAction = new QAction(tr("About"), this);		// 关于
    connect(aboutAction, SIGNAL(triggered()), this, SLOT(slotAbout()));
}
Ejemplo n.º 9
0
void Shell::setupActions()
{
    //File menu
    open = KStandardAction::open(this, SLOT(slotOpenFile()), actionCollection());
    actionCollection()->addAction("open", open);

    openNewTab = new KAction(this);
    openNewTab->setText(i18n("Open file(s) in new tab(s)"));
    actionCollection()->addAction("openNewTab", openNewTab);
    connect(openNewTab, SIGNAL(triggered(bool)),
            this, SLOT(slotOpenFileNewTab()));

    //since we only need to provide a print action for use with browserExtensions
    //create and disable it right away
    print = actionCollection()->addAction(KStandardAction::Print, "print", 0, 0);
    print->setDisabled(true);

    KStandardAction::quit(kapp, SLOT(quit()),
                          actionCollection());
    //Window menu
    showCollection = new KToggleAction(this);
    showCollection->setText(i18n("Collection Manager"));
    actionCollection()->addAction("showCollection", showCollection);
    connect(showCollection, SIGNAL(triggered()),
            this, SLOT(slotToggleCollection()));
    
    saveSession = new KAction(this);
    saveSession->setText(i18n("Save current session"));
    saveSession->setIcon(KIcon("document-save.png"));
    actionCollection()->addAction("saveSession", saveSession);
    connect(saveSession, SIGNAL(triggered()), SLOT(slotSaveSession()));
    
    openSession = new KAction(this);
    openSession->setText(i18n("Open session"));
    openSession->setIcon(KIcon("document-open.png"));
    actionCollection()->addAction("openSession", openSession);
    connect(openSession, SIGNAL(triggered()), SLOT(slotOpenSession()));
    
    removeSession = new KAction(this);
    removeSession->setText(i18n("Remove session"));
    removeSession->setIcon(KIcon("list-remove.png"));
    actionCollection()->addAction("removeSession", removeSession);
    connect(removeSession, SIGNAL(triggered()), SLOT(slotRemoveSession()));

    setupGUI();
}
Ejemplo n.º 10
0
ActivityWidget::ActivityWidget(QWidget *parent) :
    QWidget(parent),
    _ui(new Ui::ActivityWidget),
    _notificationRequestsRunning(0)
{
    _ui->setupUi(this);

    // Adjust copyToClipboard() when making changes here!
#if defined(Q_OS_MAC)
    _ui->_activityList->setMinimumWidth(400);
#endif

    _model = new ActivityListModel(this);
    ActivityItemDelegate *delegate = new ActivityItemDelegate;
    delegate->setParent(this);
    _ui->_activityList->setItemDelegate(delegate);
    _ui->_activityList->setAlternatingRowColors(true);
    _ui->_activityList->setModel(_model);

    _ui->_notifyLabel->hide();
    _ui->_notifyScroll->hide();

    // Create a widget container for the notifications. The ui file defines
    // a scroll area that get a widget with a layout as children
    QWidget *w = new QWidget(this);
    _notificationsLayout = new QVBoxLayout(this);
    w->setLayout(_notificationsLayout);
    _ui->_notifyScroll->setWidget(w);

    showLabels();

    connect(_model, SIGNAL(activityJobStatusCode(AccountState*,int)),
            this, SLOT(slotAccountActivityStatus(AccountState*,int)));

    _copyBtn = _ui->_dialogButtonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole);
    _copyBtn->setToolTip( tr("Copy the activity list to the clipboard."));
    connect(_copyBtn, SIGNAL(clicked()), SIGNAL(copyToClipboard()));

    connect(_model, SIGNAL(rowsInserted(QModelIndex,int,int)), SIGNAL(rowsInserted()));

    connect( _ui->_activityList, SIGNAL(activated(QModelIndex)), this,
             SLOT(slotOpenFile(QModelIndex)));

    connect( &_removeTimer, SIGNAL(timeout()), this, SLOT(slotCheckToCleanWidgets()) );
    _removeTimer.setInterval(1000);
}
Ejemplo n.º 11
0
CCreateMapFineTune::CCreateMapFineTune(QWidget * parent)
: QWidget(parent)
{
    setupUi(this);

    toolUp->setIcon(QIcon(":/icons/iconUpload16x16.png"));
    toolDown->setIcon(QIcon(":/icons/iconDownload16x16.png"));
    toolLeft->setIcon(QIcon(":/icons/iconLeft16x16.png"));
    toolRight->setIcon(QIcon(":/icons/iconRight16x16.png"));

    connect(pushOpenFile, SIGNAL(clicked()), this, SLOT(slotOpenFile()));
    connect(toolUp, SIGNAL(clicked()), this, SLOT(slotUp()));
    connect(toolDown, SIGNAL(clicked()), this, SLOT(slotDown()));
    connect(toolLeft, SIGNAL(clicked()), this, SLOT(slotLeft()));
    connect(toolRight, SIGNAL(clicked()), this, SLOT(slotRight()));

    connect(pushSave, SIGNAL(clicked()), this, SLOT(slotSave()));
    progressBar->hide();

}
Ejemplo n.º 12
0
void MainWindow::createActions()
{
	//通过图片路径来实现添加Qt资源文件目的
	fileOpenAction = new QAction(QIcon("C:/qt/Mwindow/open.png"),tr("Open"),this);
	fileOpenAction->setShortcut(tr("Ctrl+O"));
	fileOpenAction->setStatusTip(tr("Open a file"));
	connect(fileOpenAction,SIGNAL(triggered()),this,SLOT(slotOpenFile()));

	fileNewAction = new QAction(QIcon("C:/qt/Mwindow/new.png"),tr("New"),this);
	fileNewAction->setShortcut(tr("Ctrl+N"));
	fileNewAction->setStatusTip(tr("new file"));
	connect(fileNewAction,SIGNAL(triggered()),this,SLOT(slotNewFile()));
  
	fileSaveAction = new QAction(QIcon("C:/qt/Mwindow/save.png"),tr("Save"),this);
	fileSaveAction->setShortcut(tr("Ctrl+S"));
	fileNewAction->setStatusTip(tr("save file"));
	connect(fileNewAction,SIGNAL(triggered()),this,SLOT(slotSaveFile()));

	exitAction = new QAction(tr("Exit"),this);
	exitAction->setShortcut(tr("Ctrl+Q"));
	exitAction->setStatusTip(tr("exit"));
	connect(exitAction,SIGNAL(triggered()),this,SLOT(close()));

	cutAction = new QAction(QIcon("C:/qt/Mwindow/cut.png"),tr("Cut"),this);
	cutAction->setShortcut(tr("Ctrl+X"));
	cutAction->setStatusTip(tr("cut to clipboard"));
	connect(cutAction,SIGNAL(triggered()),text,SLOT(cut()));

	copyAction = new QAction(QIcon("C:/qt/Mwindow/copy.png"),tr("Copy"),this);
	copyAction->setShortcut(tr("Ctrl+C"));
	copyAction->setStatusTip(tr("copy to clipboard"));
	connect(copyAction,SIGNAL(triggered()),this,SLOT(copy()));

	pasteAction = new QAction(QIcon("C:/qt/Mwindow/paste.png"),tr("paste"),this);
	pasteAction->setShortcut(tr("Ctrl+V"));
	pasteAction->setStatusTip(tr("paste clipboard to selection"));
	connect(pasteAction,SIGNAL(triggered()),this,SLOT(paste()));

	aboutAction = new QAction(tr("About"),this);
	connect(aboutAction,SIGNAL(triggered()),this,SLOT(slotAbout()));
}
Ejemplo n.º 13
0
FileTransferDlg::FileTransferDlg(const FileTransfer& transfer, QWidget* parent)
: QDialog(parent, QT_DEFAULT_DIALOG_HINTS | Qt::WindowMinMaxButtonsHint | Qt::WindowSystemMenuHint)
, m_transferid(transfer.nTransferID)
, m_lastTransferred(0)
{
    ui.setupUi(this);
    setWindowIcon(QIcon(APPICON));

    connect(ui.cancelButton, SIGNAL(clicked()), 
            SLOT(slotCancelTransfer()));
    connect(ui.openButton, SIGNAL(clicked()),
        SLOT(slotOpenFile()));

    m_start = QTime::currentTime();

    ui.openButton->setEnabled(false);

    m_timerid = startTimer(1000);

    updateFileTransfer(transfer);
}
Ejemplo n.º 14
0
void MainWindow::createMenu()
{
    QMenu *fileMenu = menuBar()->addMenu(tr("File"));
    
    QAction *openAct = new QAction(tr("Open"),this);
    connect(openAct,SIGNAL(triggered()),this,SLOT(slotOpenFile()));
    fileMenu->addAction(openAct);
    
    QAction *saveAct = new QAction(tr("Save"),this);
    connect(saveAct,SIGNAL(triggered()),this,SLOT(slotSaveFile()));
    fileMenu->addAction(saveAct);
    
    QMenu *editMenu = menuBar()->addMenu(tr("Edit"));
    
    QAction *insertAct = new QAction(tr("Insert"),this);
    connect(insertAct,SIGNAL(triggered()),this,SLOT(slotInsertRows()));
    editMenu->addAction(insertAct);
    
    QAction *removeAct = new QAction(tr("Remove"),this);
    connect(removeAct,SIGNAL(triggered()),this,SLOT(slotRemoveRows()));
    editMenu->addAction(removeAct);
}
Ejemplo n.º 15
0
	void CLoadForm::setupUi()
	{
		m_width = new QSpinBox();
		m_width->setRange(1, 100000);
		m_width->setValue(1500);

		m_height = new QSpinBox();
		m_height->setRange(1, 100000);
		m_height->setValue(40000);

		m_filename = new QLineEdit();

		connect(m_filename, SIGNAL(returnPressed()), this, SLOT(slotOpenFile()));

		QFormLayout *form_layout = new QFormLayout();

		form_layout->addRow(new QLabel("Pixmap width:"), m_width);
		form_layout->addRow(new QLabel("Pixmap height:"), m_height);
		form_layout->addRow(new QLabel("File:"), m_filename);

		QPushButton *ok_button = new QPushButton(tr("Ok"));
		QPushButton *cancel_button = new QPushButton(tr("Cancel"));

		connect(ok_button, SIGNAL(clicked()), this, SLOT(accept()));
		connect(cancel_button, SIGNAL(clicked()), this, SLOT(reject()));

		QHBoxLayout *button_layout = new QHBoxLayout();

		button_layout->addStretch();
		button_layout->addWidget(ok_button);
		button_layout->addWidget(cancel_button);

		QVBoxLayout *layout = new QVBoxLayout();

		layout->addLayout(form_layout);
		layout->addLayout(button_layout);

		setLayout(layout);
	}
Ejemplo n.º 16
0
        m_historyBox->setAutoFillBackground(true);
        connect(m_historyBox, SIGNAL(urlClicked(const QUrl &)), this, SLOT(slotLoadCanvas(const QUrl &)));
        connect(m_historyBox, SIGNAL(urlRemoved(const QUrl &)), this, SLOT(slotRemoveFromHistory(const QUrl &)));
        topbarAddWidget(m_historyBox);
    }

    // create the File Box
    m_fileBox = new FileBoxWidget;
    m_fileBox->setTitle(tr("OPEN"));
#if !defined(MOBILE_UI)
    m_fileBox->setBorderFlags(0x0000);
    m_fileBox->setCheckable(false);
#endif
    m_fileBox->setPalette(brightPal);
    m_fileBox->setAutoFillBackground(true);
    connect(m_fileBox->openButton, SIGNAL(clicked()), this, SLOT(slotOpenFile()));
    topbarAddWidget(m_fileBox);
}

HomeAppliance::~HomeAppliance()
{
    delete m_fileBox;
    delete m_historyBox;
    delete m_scene;
}

void HomeAppliance::slotSceneKeyPressed(int qtKey)
{
    // pressed a number, activate relative Url
    if (qtKey >= Qt::Key_1 && qtKey <= Qt::Key_9) {
        QUrl url = m_historyBox->urlForEntry(qtKey - Qt::Key_0 - 1);
Ejemplo n.º 17
0
void PdfViewer::createActions()
{
	// File
    m_fileOpenAction = new QAction(Icon("document-open"), tr("&Open...", "Action: open file"), this);
#ifndef QT_NO_SHORTCUT
    m_fileOpenAction->setShortcut(QKeySequence::Open);
#endif // QT_NO_SHORTCUT
	m_fileOpenAction->setObjectName("file_open");
	connect(m_fileOpenAction, SIGNAL(triggered()), this, SLOT(slotOpenFile()));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_fileOpenAction);
#endif // QT_NO_SHORTCUT

    m_ReloadDocAction = new QAction(Icon("reload3"), tr("Re&load...", "Action: reload file"), this);
#ifndef QT_NO_SHORTCUT
    m_ReloadDocAction->setShortcut(tr("Ctrl+L"));
#endif // QT_NO_SHORTCUT
    m_ReloadDocAction->setObjectName("file_reload");
    connect(m_ReloadDocAction, SIGNAL(triggered()), this, SLOT(slotReload()));
#ifndef QT_NO_SHORTCUT
    ShortcutHandler::instance()->addAction(m_ReloadDocAction);
#endif // QT_NO_SHORTCUT

    m_fileSaveCopyAction = new QAction(Icon("document-save-as"), tr("&Save a Copy...", "Action: save a copy of the open file"), this);
#ifndef QT_NO_SHORTCUT
    m_fileSaveCopyAction->setShortcut(tr("Ctrl+Shift+S"));
#endif // QT_NO_SHORTCUT
    m_fileSaveCopyAction->setEnabled(false);
	m_fileSaveCopyAction->setObjectName("file_save_copy");
	connect(m_fileSaveCopyAction, SIGNAL(triggered()), this, SLOT(slotSaveCopy()));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_fileSaveCopyAction);
#endif // QT_NO_SHORTCUT

	m_printAction = m_pdfView->action(PdfView::Print);
	m_printAction->setIcon(Icon("document-print"));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_printAction);
#endif // QT_NO_SHORTCUT

    m_quitAction = new QAction(Icon("application-exit"), tr("&Quit", "Action: quit the application"), this);
#ifndef QT_NO_SHORTCUT
    m_quitAction->setShortcut(QKeySequence::Quit);
#endif // QT_NO_SHORTCUT
	m_quitAction->setObjectName("application_exit");
//	connect(m_quitAction, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));
	connect(m_quitAction, SIGNAL(triggered()), this, SLOT(close()));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_quitAction);
#endif // QT_NO_SHORTCUT

	// Edit
	m_findAction = new QAction(Icon("edit-find"), tr("&Find...", "Action"), this);
#ifndef QT_NO_SHORTCUT
	m_findAction->setShortcut(QKeySequence::Find);
#endif // QT_NO_SHORTCUT
	m_findAction->setEnabled(false);
	m_findAction->setObjectName("edit_find");
	connect(m_findAction, SIGNAL(triggered()), this, SLOT(slotFind()));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_findAction);
#endif // QT_NO_SHORTCUT

	m_findNextAction = new QAction(tr("Find &Next", "Action"), this);
#ifndef QT_NO_SHORTCUT
	m_findNextAction->setShortcut(QKeySequence::FindNext);
#endif // QT_NO_SHORTCUT
	m_findNextAction->setEnabled(false);
	m_findNextAction->setObjectName("edit_find_next");
	connect(m_findNextAction, SIGNAL(triggered()), this, SLOT(slotFindNext()));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_findNextAction);
#endif // QT_NO_SHORTCUT

	m_findPreviousAction = new QAction(tr("Find &Previous", "Action"), this);
#ifndef QT_NO_SHORTCUT
	m_findPreviousAction->setShortcut(QKeySequence::FindPrevious);
#endif // QT_NO_SHORTCUT
	m_findPreviousAction->setEnabled(false);
	m_findPreviousAction->setObjectName("edit_find_previous");
	connect(m_findPreviousAction, SIGNAL(triggered()), this, SLOT(slotFindPrevious()));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_findPreviousAction);
#endif // QT_NO_SHORTCUT

	// View
	m_zoomInAction = m_pdfView->action(PdfView::ZoomIn);
	m_zoomInAction->setIcon(Icon("zoom-in"));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_zoomInAction);
#endif // QT_NO_SHORTCUT

	m_zoomOutAction = m_pdfView->action(PdfView::ZoomOut);
	m_zoomOutAction->setIcon(Icon("zoom-out"));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_zoomOutAction);
#endif // QT_NO_SHORTCUT

	m_zoomAction = m_pdfView->action(PdfView::Zoom);

	m_showPresentationAction = new QAction(Icon("view-presentation"), tr("P&resentation", "Action"), this);
#ifndef QT_NO_SHORTCUT
	m_showPresentationAction->setShortcut(tr("Ctrl+Shift+P"));
#endif // QT_NO_SHORTCUT
	m_showPresentationAction->setEnabled(false);
	m_showPresentationAction->setObjectName("view_presentation");
	connect(m_showPresentationAction, SIGNAL(triggered()), this, SLOT(slotShowPresentation()));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_showPresentationAction);
#endif // QT_NO_SHORTCUT

	// Go
	m_goToStartAction = m_pdfView->action(PdfView::GoToStartOfDocument);
	m_goToStartAction->setIcon(Icon("go-first"));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_goToStartAction);
#endif // QT_NO_SHORTCUT

	m_goToEndAction = m_pdfView->action(PdfView::GoToEndOfDocument);
	m_goToEndAction->setIcon(Icon("go-last"));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_goToEndAction);
#endif // QT_NO_SHORTCUT

	m_goToPreviousPageAction = m_pdfView->action(PdfView::GoToPreviousPage);
	m_goToPreviousPageAction->setIcon(Icon("go-previous"));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_goToPreviousPageAction);
#endif // QT_NO_SHORTCUT

	m_goToNextPageAction = m_pdfView->action(PdfView::GoToNextPage);
	m_goToNextPageAction->setIcon(Icon("go-next"));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_goToNextPageAction);
#endif // QT_NO_SHORTCUT

	m_goToPageAction = m_pdfView->action(PdfView::GoToPage);

    m_amkhlvDnAction = m_pdfView->action(PdfView::AmkhlvDn);
    m_amkhlvUpAction = m_pdfView->action(PdfView::AmkhlvUp);
    m_amkhlvDnFAction = m_pdfView->action(PdfView::AmkhlvDnF);
    m_amkhlvUpFAction = m_pdfView->action(PdfView::AmkhlvUpF);
    m_amkhlvRtAction = m_pdfView->action(PdfView::AmkhlvRt);
    m_amkhlvLtAction = m_pdfView->action(PdfView::AmkhlvLt);
    m_amkhlvRtFAction = m_pdfView->action(PdfView::AmkhlvRtF);
    m_amkhlvLtFAction = m_pdfView->action(PdfView::AmkhlvLtF);
    m_ReturnBackAction = m_pdfView->action(PdfView::ReturnBack);
    m_ReturnBackAction->setIcon(Icon("stock_undo"));

#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_amkhlvDnAction);
	ShortcutHandler::instance()->addAction(m_amkhlvDnFAction);
	ShortcutHandler::instance()->addAction(m_amkhlvRtAction);
	ShortcutHandler::instance()->addAction(m_amkhlvRtFAction);
#endif // QT_NO_SHORTCUT
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_amkhlvUpAction);
	ShortcutHandler::instance()->addAction(m_amkhlvUpFAction);
	ShortcutHandler::instance()->addAction(m_amkhlvLtAction);
	ShortcutHandler::instance()->addAction(m_amkhlvLtFAction);
    ShortcutHandler::instance()->addAction(m_ReturnBackAction);
    ShortcutHandler::instance()->addAction(m_ReloadDocAction);
#endif // QT_NO_SHORTCUT


	// Tools
	m_mouseBrowseAction = m_pdfView->action(PdfView::MouseToolBrowse);
	m_mouseBrowseAction->setIcon(Icon("input-mouse"));
#ifndef QT_NO_SHORTCUT
	m_mouseBrowseAction->setShortcut(tr("Ctrl+1"));
	ShortcutHandler::instance()->addAction(m_mouseBrowseAction);
#endif // QT_NO_SHORTCUT

	m_mouseMagnifyAction = m_pdfView->action(PdfView::MouseToolMagnify);
	m_mouseMagnifyAction->setIcon(Icon("page-zoom"));
#ifndef QT_NO_SHORTCUT
	m_mouseMagnifyAction->setShortcut(tr("Ctrl+2"));
	ShortcutHandler::instance()->addAction(m_mouseMagnifyAction);
#endif // QT_NO_SHORTCUT

	m_mouseSelectionAction = m_pdfView->action(PdfView::MouseToolSelection);
	m_mouseSelectionAction->setIcon(Icon("select-rectangular"));
#ifndef QT_NO_SHORTCUT
	m_mouseSelectionAction->setShortcut(tr("Ctrl+3"));
	ShortcutHandler::instance()->addAction(m_mouseSelectionAction);
#endif // QT_NO_SHORTCUT

	m_mouseTextSelectionAction = m_pdfView->action(PdfView::MouseToolTextSelection);
	m_mouseTextSelectionAction->setIcon(Icon("draw-text"));
#ifndef QT_NO_SHORTCUT
	m_mouseTextSelectionAction->setShortcut(tr("Ctrl+4"));
	ShortcutHandler::instance()->addAction(m_mouseTextSelectionAction);
#endif // QT_NO_SHORTCUT

	// Settings
    m_settingsTextAAAction = new QAction(tr("&Text Antialias", "Action: enable/disable antialias"), this);
    m_settingsTextAAAction->setCheckable(true);
    connect(m_settingsTextAAAction, SIGNAL(toggled(bool)), this, SLOT(slotToggleTextAA(bool)));

    m_settingsGfxAAAction = new QAction(tr("&Graphics Antialias", "Action: enable/disable antialias"), this);
    m_settingsGfxAAAction->setCheckable(true);
    connect(m_settingsGfxAAAction, SIGNAL(toggled(bool)), this, SLOT(slotToggleGfxAA(bool)));

	QMenu *settingsRenderMenu = new QMenu(tr("&Render Backend", "Menu title"), this);
	m_settingsRenderBackendGrp = new QActionGroup(settingsRenderMenu);
	m_settingsRenderBackendGrp->setExclusive(true);
	QAction *action = settingsRenderMenu->addAction(tr("&Splash", "Action: select render backend"));
	action->setCheckable(true);
	action->setChecked(true);
	action->setData(qVariantFromValue(int(Poppler::Document::SplashBackend)));
	m_settingsRenderBackendGrp->addAction(action);
	action = settingsRenderMenu->addAction(tr("&Arthur", "Action: select render backend"));
	action->setCheckable(true);
	action->setData(qVariantFromValue(int(Poppler::Document::ArthurBackend)));
	m_settingsRenderBackendGrp->addAction(action);
	connect(m_settingsRenderBackendGrp, SIGNAL(triggered(QAction*)), this, SLOT(slotRenderBackend(QAction*)));
	m_renderBackendAction = new QAction(tr("&Render Backend", "Menu title"), this);
	m_renderBackendAction->setMenu(settingsRenderMenu);

	m_configureAction = new QAction(Icon("configure"), tr("&Configure %1...", "Action: show configuration dialog").arg(QCoreApplication::applicationName()), this);
	connect(m_configureAction, SIGNAL(triggered()), this, SLOT(slotConfigure()));
}
Ejemplo n.º 18
0
void MainWindow::initMenu()
{
	//file
	_fileMenu = menuBar()->addMenu(QWidget::tr("文件(&F)"));
	QAction* actionNewFile = new QAction(QIcon(":/images/new.png"), QWidget::tr("新建(&New)"), this);
	actionNewFile->setShortcut(QWidget::tr("Ctrl+N"));
	actionNewFile->setToolTip(QWidget::tr("新建场景文件"));
	connect(actionNewFile, SIGNAL(triggered()), this, SLOT(slotNewFile()));
	_fileMenu->addAction(actionNewFile);
	QAction* actionOpenFile = new QAction(QIcon(":/images/open.png"), QWidget::tr("打开(&Open)"), this);
	actionOpenFile->setShortcut(QWidget::tr("Ctrl+O"));
	actionOpenFile->setToolTip(QWidget::tr("打开一个场景文件"));
	connect(actionOpenFile, SIGNAL(triggered()), this, SLOT(slotOpenFile()));
	_fileMenu->addAction(actionOpenFile);
	QAction* actionSaveFile = new QAction(QIcon(":/images/save.png"), QWidget::tr("保存(&Save)"), this);
	actionSaveFile->setShortcut(QWidget::tr("Ctrl+S"));
	actionSaveFile->setToolTip(QWidget::tr("保存场景文件"));
	actionSaveFile->setEnabled(false);
	connect(actionSaveFile, SIGNAL(triggered()), this, SLOT(slotSaveFile()));
	_fileMenu->addAction(actionSaveFile);
	QAction* actionSaveAsFile = new QAction(QIcon(":/images/save.png"), QWidget::tr("另存(SaveAs)"), this);
	actionSaveAsFile->setToolTip(QWidget::tr("另存场景文件"));
	actionSaveAsFile->setEnabled(false);
	connect(actionSaveAsFile, SIGNAL(triggered()), this, SLOT(slotSaveAsFile()));
	_fileMenu->addAction(actionSaveAsFile);
	QAction* actionExit = new QAction(QIcon(":/images/close.png"), QWidget::tr("退出(&X)"), this);
	actionExit->setToolTip(QWidget::tr("退出场景编辑器"));
	connect(actionExit, SIGNAL(triggered()), this, SLOT(slotExit()));
	_fileMenu->addAction(actionExit);
	//edit
	_editMenu = menuBar()->addMenu(QWidget::tr("编辑(&E)"));
	QAction* actionUndo = new QAction(QIcon(":/images/undo.png"), QWidget::tr("撤销"), this);
	actionUndo->setShortcut(QWidget::tr("Ctrl+Z"));
	actionUndo->setToolTip(QWidget::tr("撤销Ctrl+Z"));
	actionUndo->setEnabled(false);
	connect(actionUndo, SIGNAL(triggered()), this, SLOT(slotUndo()));
	_editMenu->addAction(actionUndo);
	QAction* actionRedo = new QAction(QIcon(":/images/redo.png"), QWidget::tr("重做"), this);
	actionRedo->setShortcut(QWidget::tr("Ctrl+Y"));
	actionRedo->setToolTip(QWidget::tr("重做Ctrl+Y"));
	actionRedo->setEnabled(false);
	connect(actionRedo, SIGNAL(triggered()), this, SLOT(slotRedo()));
	_editMenu->addAction(actionRedo);
	QAction* actionCopy = new QAction(QIcon(":/images/copy.png"), QWidget::tr("复制"), this);
	actionCopy->setShortcut(QWidget::tr("Ctrl+C"));
	actionCopy->setToolTip(QWidget::tr("复制Ctrl+C"));
	actionCopy->setEnabled(false);
	connect(actionCopy, SIGNAL(triggered()), this, SLOT(slotCopy()));
	_editMenu->addAction(actionCopy);
	QAction* actionRotateFast = new QAction(QIcon(":/images/rotate.png"), QWidget::tr("快速旋转"), this);
	actionRotateFast->setShortcut(QKeySequence(Qt::Key_F3));
	actionRotateFast->setToolTip(QWidget::tr("快速旋转F3"));
	actionRotateFast->setEnabled(false);
	connect(actionRotateFast, SIGNAL(triggered()), this, SLOT(slotRotateFast()));
	_editMenu->addAction(actionRotateFast);
	QAction* actionAlign = new QAction(QIcon(":/images/align.png"), QWidget::tr("对齐"), this);
	actionAlign->setShortcut(QWidget::tr("Ctrl+L"));
	actionAlign->setToolTip(QWidget::tr("对齐Ctrl+L"));
	actionAlign->setEnabled(false);
	connect(actionAlign, SIGNAL(triggered()), this, SLOT(slotAlign()));
	_editMenu->addAction(actionAlign);
	QAction* actionDelete = new QAction(QIcon(":/images/delete.png"), QWidget::tr("删除"), this);
	actionDelete->setShortcut(QKeySequence(QKeySequence::Delete));
	actionDelete->setToolTip(QWidget::tr("删除Delete"));
	actionDelete->setEnabled(false);
	connect(actionDelete, SIGNAL(triggered()), this, SLOT(slotDelete()));
	_editMenu->addAction(actionDelete);
	//windowsMenu
	_windowsMenu = menuBar()->addMenu(QWidget::tr("窗口(&W)"));
	QAction* actionObjectsTreeDockWidget = new QAction(QIcon(":/images/default.png"), QWidget::tr("场景树(&ObjTree)"), this);
	actionObjectsTreeDockWidget->setShortcut(QKeySequence("h"));
	actionObjectsTreeDockWidget->setToolTip(QWidget::tr("打开或隐藏对象树窗口"));
	actionObjectsTreeDockWidget->setEnabled(false);
	connect(actionObjectsTreeDockWidget, SIGNAL(triggered()), this, SLOT(slotObjectTreeWidgetActive()));
	_windowsMenu->addAction(actionObjectsTreeDockWidget);
	QAction* actionPropertyDockWidget = new QAction(QIcon(":/images/default.png"), QWidget::tr("属性窗"), this);
	actionPropertyDockWidget->setToolTip(QWidget::tr("打开或隐藏属性窗口"));
	actionPropertyDockWidget->setEnabled(false);
	connect(actionPropertyDockWidget, SIGNAL(triggered()), this, SLOT(slotPropertyDockWidgetActive()));
	_windowsMenu->addAction(actionPropertyDockWidget);
	QAction* actionBuiltinResourcesDockWidget = new QAction(QIcon(":/images/default.png"), QWidget::tr("内置资源列表"), this);
	actionBuiltinResourcesDockWidget->setToolTip(QWidget::tr("打开或隐藏内置资源列表窗口"));
	actionBuiltinResourcesDockWidget->setEnabled(false);
	connect(actionBuiltinResourcesDockWidget, SIGNAL(triggered()), this, SLOT(slotBuiltinResourcesDockWidgetActive()));
	_windowsMenu->addAction(actionBuiltinResourcesDockWidget);
	QAction* actionvdsResourcesDockWidget = new QAction(QIcon(":/images/default.png"), QWidget::tr("资源列表"), this);
	actionvdsResourcesDockWidget->setToolTip(QWidget::tr("打开或隐藏资源列表窗口"));
	actionvdsResourcesDockWidget->setEnabled(false);
	connect(actionvdsResourcesDockWidget, SIGNAL(triggered()), this, SLOT(slotvdsResourcesDockWidgetActive()));
	_windowsMenu->addAction(actionvdsResourcesDockWidget);
	QAction* actionCSharpAssemblyDockWidget = new QAction(QIcon(":/images/default.png"), QWidget::tr("脚本列表"), this);
	actionCSharpAssemblyDockWidget->setToolTip(QWidget::tr("打开或隐藏脚本列表窗口"));
	actionCSharpAssemblyDockWidget->setEnabled(false);
	connect(actionCSharpAssemblyDockWidget, SIGNAL(triggered()), this, SLOT(slotCSharpAssemblyDockWidgetActive()));
	_windowsMenu->addAction(actionCSharpAssemblyDockWidget);
	//tool
	_toolMenu = menuBar()->addMenu(QWidget::tr("工具(&T)"));
	QAction* actionAnimationMerge = new QAction(QIcon(":/images/default.png"), QWidget::tr("动画合并(&AnimationMerge)"), this);
	actionAnimationMerge->setToolTip(QWidget::tr("完成骨骼动画合并"));
	actionAnimationMerge->setEnabled(false);
	connect(actionAnimationMerge, SIGNAL(triggered()), this, SLOT(slotAnimationMerge()));
	_toolMenu->addAction(actionAnimationMerge);
	QAction* particleEdit = new QAction(QIcon(":/images/default.png"), QWidget::tr("粒子编辑(&Particle)"), this);
	particleEdit->setToolTip(QWidget::tr("编辑粒子效果"));
	particleEdit->setEnabled(false);
	connect(particleEdit, SIGNAL(triggered()), this, SLOT(slotParticleEdit()));
	_toolMenu->addAction(particleEdit);
	QAction* actionPlantBrushDockWidget = new QAction(QIcon(":/images/default.png"), QWidget::tr("植被编辑"), this);
	actionPlantBrushDockWidget->setToolTip(QWidget::tr("打开或隐藏植被编辑窗口"));
	actionPlantBrushDockWidget->setEnabled(false);
	connect(actionPlantBrushDockWidget, SIGNAL(triggered()), this, SLOT(slotPlantBrushDockWidgetActive()));
	_toolMenu->addAction(actionPlantBrushDockWidget);
	QAction* actionViewPointEdit = new QAction(QIcon(":/images/default.png"), QWidget::tr("视点编辑(&ViewPoint)"), this);
	actionViewPointEdit->setToolTip(QWidget::tr("定义视点"));
	actionViewPointEdit->setEnabled(false);
	connect(actionViewPointEdit, SIGNAL(triggered()), this, SLOT(slotViewPointEdit()));
	_toolMenu->addAction(actionViewPointEdit);
	QAction* actionPhysicalEdit = new QAction(QIcon(":/images/default.png"), QWidget::tr("物理编辑"), this);
	actionPhysicalEdit->setToolTip(QWidget::tr("定义碰撞体或碰撞面"));
	actionPhysicalEdit->setEnabled(false);
	connect(actionPhysicalEdit, SIGNAL(triggered()), this, SLOT(slotPhysicalEditDockWidgetActive()));
	_toolMenu->addAction(actionPhysicalEdit);
	QAction* actionRiverEdit = new QAction(QIcon(":/images/default.png"), QWidget::tr("河流编辑"), this);
	actionRiverEdit->setToolTip(QWidget::tr("定义河流效果"));
	actionRiverEdit->setEnabled(false);
	connect(actionRiverEdit, SIGNAL(triggered()), this, SLOT(slotRiverEditDockWidgetActive()));
	_toolMenu->addAction(actionRiverEdit);
	QAction* modelConvert = new QAction(QIcon(":/images/default.png"), QWidget::tr("模型转换(&ConvertModel)"), this);
	modelConvert->setToolTip(QWidget::tr("转换模型到其他平台"));
	modelConvert->setEnabled(true);
	connect(modelConvert, SIGNAL(triggered()), this, SLOT(slotConvertModel()));
	_toolMenu->addAction(modelConvert);
	QAction* compressDir = new QAction(QIcon(":/images/default.png"), QWidget::tr("压缩文件夹"), this);
	compressDir->setToolTip(QWidget::tr("压缩文件夹,可以设定文件名编码"));
	compressDir->setEnabled(true);
	connect(compressDir, SIGNAL(triggered()), this, SLOT(slotCompressDir()));
	_toolMenu->addAction(compressDir);
	//animation
	_animationMenu = menuBar()->addMenu(QWidget::tr("动画(&A)"));
	///////////////////////////////////////////////////////////////////should move to PlotAnimation later
	QAction* actionViewPointAnimationEdit = new QAction(QIcon(":/images/default.png"), QWidget::tr("视点动画编辑"), this);
	actionViewPointAnimationEdit->setToolTip(QWidget::tr("编辑视点动画"));
	actionViewPointAnimationEdit->setEnabled(false);
	connect(actionViewPointAnimationEdit, SIGNAL(triggered()), this, SLOT(slotViewPointAnimationEdit()));
	_animationMenu->addAction(actionViewPointAnimationEdit);
	QAction* actionPlotAnimationEdit = new QAction(QIcon(":/images/default.png"), QWidget::tr("剧情编辑"), this);
	actionPlotAnimationEdit->setToolTip(QWidget::tr("编辑一段剧情"));
	actionPlotAnimationEdit->setEnabled(false);
	connect(actionPlotAnimationEdit, SIGNAL(triggered()), this, SLOT(slotPlotAnimationEdit()));
	_animationMenu->addAction(actionPlotAnimationEdit);
}
Ejemplo n.º 19
0
void MainWindow::setupActions()
{
  //file menu
  KStdAction::open(this, SLOT(slotOpenFile()), actionCollection());

  m_actionRecent = KStdAction::openRecent(this, SLOT(slotFileRecent(const KURL&)), actionCollection());
  m_actionRecent->loadEntries(kapp->config());//,"Recent Files");

  KStdAction::close(this, SLOT(slotCloseFile()), actionCollection());

  (void)new KAction(i18n("Close All"), 0, this, SLOT(slotCloseAllFiles()), actionCollection(), "file_close_all");

  KStdAction::quit(this, SLOT(slotQuit()), actionCollection());

  KStdAction::keyBindings(this, SLOT(slotEditKeys()), actionCollection());
  KStdAction::configureToolbars(this, SLOT(slotEditToolbars()), actionCollection());
  KStdAction::preferences(this, SLOT(slotShowSettings()), actionCollection(), "settings_protoeditor");

  m_siteAction     = new KSelectAction("Site", 0, actionCollection(), "site_selection");

  connect(m_siteAction, SIGNAL(activated(const QString&)),
          ProtoeditorSettings::self(), SLOT(slotCurrentSiteChanged(const QString&)));

  m_defaultScriptAction = new KSelectAction("Default script", 0, actionCollection(), "default_script");
  QStringList l;
  l << "Site Script" << "Active Script";
  m_defaultScriptAction->setItems(l);
  m_defaultScriptAction->setCurrentItem(0);

  //   connect(m_defaultScriptAction, SIGNAL(activated(int)),
  //           this, SLOT(slotDefaultScriptChanged(int)));


  //   (void)new KAction(i18n("&Run"), "gear", "F9", m_debugger_manager,
  //                     SLOT(slotDebugStart()), actionCollection(), "script_run_current_script");

  (void)new KAction(i18n("Start Debug"), "dbgstart", "F5", m_debugger_manager,
                    SLOT(slotDebugStart()), actionCollection(), "debug_start");

  (void)new KAction(i18n("Stop Debug"), "stop", "Escape", m_debugger_manager,
                    SLOT(slotDebugStop()), actionCollection(), "debug_stop");

  (void)new KAction(i18n("Step Over"), "dbgnext", "F6", m_debugger_manager,
                    SLOT(slotDebugStepOver()), actionCollection(), "debug_step_over");

  (void)new KAction(i18n("Step Into"), "dbgstep", "F7", m_debugger_manager,
                    SLOT(slotDebugStepInto()), actionCollection(), "debug_step_into");

  (void)new KAction(i18n("Step Out"), "dbgstepout", "F8", m_debugger_manager,
                    SLOT(slotDebugStepOut()), actionCollection(), "debug_step_out");

  (void)new KAction(i18n("Profile"), "math_sum", "Alt+P", m_debugger_manager,
                    SLOT(slotProfile()), actionCollection(), "script_profile");

  (void)new KAction(i18n("Toggle Breakpoint"), "activebreakpoint", "Alt+B", m_debugger_manager,
                    SLOT(slotDebugToggleBp()), actionCollection(), "debug_toggle_bp");

  (void)new KAction("", "math_brace", 0, m_tabEditor,
                    SLOT(slotAddWatch()), actionCollection(), "editor_add_watch");


  setStandardToolBarMenuEnabled(true);
}
Ejemplo n.º 20
0
void MainWindow::openFile()
{
  slotOpenFile();
}
Ejemplo n.º 21
0
void MainWindow::connectAction()
{
	QObject::connect(m_ui->actionOpen, SIGNAL(triggered()), this, SLOT(slotOpenFile()));
}
Ejemplo n.º 22
0
void KHelpMain::createMenu()
{
    KStdAccel stdAccel;
	fileMenu = new QPopupMenu;
	CHECK_PTR( fileMenu );
	fileMenu->insertItem( klocale->translate("&New Help Window"), this,
                        SLOT( slotCloneWindow() ), stdAccel.openNew() );
	fileMenu->insertSeparator();
	fileMenu->insertItem( klocale->translate("&Open File..."), helpwin,
                        SLOT(slotOpenFile()), stdAccel.open() );
//	fileMenu->insertItem( klocale->translate("Open UR&L..."), helpwin,
//                        SLOT(slotOpenURL()) );
	fileMenu->insertItem( klocale->translate("&Reload"), helpwin,
                        SLOT(slotReload()) );
	fileMenu->insertSeparator();
	fileMenu->insertItem( klocale->translate("&Search"), helpwin,
                        SLOT(slotSearch()) );
	fileMenu->insertSeparator();
	fileMenu->insertItem( klocale->translate("&Print..."), helpwin,
                        SLOT(slotPrint()), stdAccel.print() );
	fileMenu->insertSeparator();
	idClose = fileMenu->insertItem(klocale->translate("&Close"),this,
                        SLOT(slotClose()), stdAccel.close()); // CC :!!!!!
	fileMenu->insertItem( klocale->translate("&Quit"), this,
                        SLOT(slotQuit()), stdAccel.quit() );

	editMenu = new QPopupMenu;
	CHECK_PTR( editMenu );
	idCopy = editMenu->insertItem(klocale->translate("&Copy"), helpwin,
                        SLOT(slotCopy()), stdAccel.copy() );
	editMenu->insertItem(klocale->translate("&Find..."), helpwin,
                        SLOT(slotFind()), stdAccel.find() );
	editMenu->insertItem(klocale->translate("Find &next"), helpwin,
                        SLOT(slotFindNext()), Key_F3 );

	gotoMenu = new QPopupMenu;
	CHECK_PTR( gotoMenu );
	idBack = gotoMenu->insertItem( klocale->translate("&Back"), helpwin,
                        SLOT(slotBack()) );
	idForward = gotoMenu->insertItem( klocale->translate("&Forward"), helpwin,
                        SLOT(slotForward()) );
	gotoMenu->insertSeparator();
	idDir = gotoMenu->insertItem( klocale->translate("&Contents"), helpwin,
                        SLOT(slotDir()) );
	idTop = gotoMenu->insertItem( klocale->translate("&Top"), helpwin,
                        SLOT(slotTop()) );
	idUp = gotoMenu->insertItem( klocale->translate("&Up"), helpwin,
                        SLOT(slotUp()) );
	idPrev = gotoMenu->insertItem( klocale->translate("&Previous"), helpwin,
                        SLOT(slotPrev()) );
	idNext = gotoMenu->insertItem( klocale->translate("&Next"), helpwin,
                        SLOT(slotNext()) );

	bookmarkMenu = new QPopupMenu;
	CHECK_PTR( bookmarkMenu );
	connect( bookmarkMenu, SIGNAL( activated( int ) ),
			helpwin, SLOT( slotBookmarkSelected( int ) ) );
	connect( bookmarkMenu, SIGNAL( highlighted( int ) ),
			helpwin, SLOT( slotBookmarkHighlighted( int ) ) );

	optionsMenu = new QPopupMenu;
	CHECK_PTR( optionsMenu );
	optionsMenu->setCheckable( true );
	optionsMenu->insertItem( klocale->translate("&General Preferences..."), this,
			SLOT(slotOptionsGeneral()) );
	optionsMenu->insertSeparator();
	optionsMenu->insertItem(klocale->translate( "Show &Toolbar"), this,
                        SLOT(slotOptionsToolbar()));

	optionsMenu->insertItem( klocale->translate("Show &Location"), this,
                        SLOT(slotOptionsLocation()) );
	optionsMenu->insertItem( klocale->translate("Show Status&bar"), this,
		SLOT(slotOptionsStatusbar()) );
	optionsMenu->insertSeparator();
	optionsMenu->insertItem( klocale->translate("&Save Options"), this,
                        SLOT(slotOptionsSave()) );

	QString at = klocale->translate("KDE Help System\n");
	at+= klocale->translate("Version ");
	at+= KDEHELP_VERSION;
	at+=klocale->translate("\n\nCopyright (c) 1997 Martin Jones <*****@*****.**>"\
	"\n\nThis program is licensed under the GNU General Public License (GPL)."\
	"\nKDEHelp comes with ABSOLUTELY NO WARRANY to the extent permitted by applicable law.");

	QPopupMenu *helpMenu = kapp->getHelpMenu( true, at );
/*
	QPopupMenu *helpMenu = new QPopupMenu;
	CHECK_PTR( helpMenu );
	helpMenu->insertItem( klocale->translate("&Using KDE Help"), this,
                        SLOT(slotUsingHelp()) ); 
	helpMenu->insertSeparator();
	helpMenu->insertItem( klocale->translate("&About"), this, SLOT(slotAbout()) );
*/
	menu = new KMenuBar( this );
	CHECK_PTR( menu );
	menu->insertItem( klocale->translate("&File"), fileMenu );
	menu->insertItem( klocale->translate("&Edit"), editMenu );
	menu->insertItem( klocale->translate("&Goto"), gotoMenu );
	menu->insertItem( klocale->translate("&Bookmarks"), bookmarkMenu );
	menu->insertItem( klocale->translate("&Options"), optionsMenu );
	menu->insertSeparator();
	menu->insertItem( klocale->translate("&Help"), helpMenu );
}
Ejemplo n.º 23
0
/**
 * @brief SingleApplication::SingleApplication
 *  Constructor. Checks and fires up LocalServer or closes the program
 *  if another instance already exists
 * @param argc
 * @param argv
 */
SingleApplication::SingleApplication(QStringList &args)
{
  _shouldContinue = false; // By default this is not the main process

  socket = new QUdpSocket();
  QUdpSocket acceptor;
  acceptor.bind(QHostAddress::LocalHost, 58488, QUdpSocket::ReuseAddressHint|QUdpSocket::ShareAddress);

  // Attempt to connect to the LocalServer
  socket->connectToHost(QHostAddress::LocalHost, 58487);
  QString isServerRuns;
  if(socket->waitForConnected(100))
  {
      socket->write(QString("CMD:Is editor running?").toUtf8());
      socket->flush();
      if(acceptor.waitForReadyRead(100))
      {
          //QByteArray dataGram;//Yes, I'm runs!
          QByteArray datagram;
          datagram.resize(acceptor.pendingDatagramSize());
          QHostAddress sender;
          quint16 senderPort;
          acceptor.readDatagram(datagram.data(), datagram.size(), &sender, &senderPort);
          if(QString::fromUtf8(datagram)=="Yes, I'm runs!")
          {
              isServerRuns="Yes!";
          }
      }
  }

  if(args.contains("--force-run", Qt::CaseInsensitive))
  {
      isServerRuns.clear();
      args.removeAll("--force-run");
  }
  _arguments = args;

  if(!isServerRuns.isEmpty())
  {
    QString str = QString("CMD:showUp");
    QByteArray bytes;
    for(int i=1; i<_arguments.size(); i++)
    {
       str.append(QString("\n%1").arg(_arguments[i]));
    }
    bytes = str.toUtf8();
    socket->write(bytes);
    socket->flush();
    QThread::msleep(100);
    socket->close();
  }
  else
  {
    // The attempt was insuccessful, so we continue the program
    _shouldContinue = true;
    server = new LocalServer();
    server->start();
    QObject::connect(server, SIGNAL(showUp()), this, SLOT(slotShowUp()));
    QObject::connect(server, SIGNAL(dataReceived(QString)), this, SLOT(slotOpenFile(QString)));
    QObject::connect(server, SIGNAL(acceptedCommand(QString)), this, SLOT(slotAcceptedCommand(QString)));
    QObject::connect(this, SIGNAL(stopServer()), server, SLOT(stopServer()));
  }
}
Ejemplo n.º 24
0
ImportScreen::ImportScreen(const CompanyDefn& company)
    : QMainWindow(0, "ImportScreen", WType_TopLevel | WDestructiveClose)
{
    _import = new DataImport(company, this);
    connect(_import, SIGNAL(message(int,QString,QString)),
	    SLOT(slotMessage(int,QString,QString)));

    QFrame* frame = new QFrame(this);
    QFrame* file = new QFrame(frame);

    QLabel* fileLabel = new QLabel(tr("Import File:"), file);
    _filePath = new LineEdit(file);
    _filePath->addPopup(Key_F9, tr("browse"));
    fileLabel->setBuddy(_filePath);
    connect(_filePath, SIGNAL(doPopup(QKeySequence)), SLOT(slotOpenFile()));

    QPushButton* browse = new QPushButton("...", file);
    browse->setFocusPolicy(ClickFocus);
    connect(browse, SIGNAL(clicked()), SLOT(slotOpenFile()));

    QGridLayout* fileGrid = new QGridLayout(file);
    fileGrid->setMargin(6);
    fileGrid->setSpacing(6);
    fileGrid->setColStretch(1, 1);
    fileGrid->addWidget(fileLabel, 0, 0);
    fileGrid->addWidget(_filePath, 0, 1);
    fileGrid->addWidget(browse, 0, 2);

    // TODO: add data types

    _log = new ListView(frame);
    _log->addNumberColumn(tr("Count"), 8);
    _log->addTextColumn(tr("Severity"), 12);
    _log->addTextColumn(tr("Data Type"), 16);
    _log->addTextColumn(tr("Data Name"), 20);
    _log->addTextColumn(tr("Message"), 30);
    _log->setAllColumnsShowFocus(true);
    _log->setShowSortIndicator(true);

    QFrame* buttons = new QFrame(frame);
    QPushButton* import = new QPushButton(tr("&Import"), buttons);
    QPushButton* close = new QPushButton(tr("&Close"), buttons);

    connect(import, SIGNAL(clicked()), SLOT(slotImport()));
    connect(close, SIGNAL(clicked()), SLOT(close()));

    QGridLayout* buttonGrid = new QGridLayout(buttons);
    buttonGrid->setSpacing(6);
    buttonGrid->setMargin(6);
    buttonGrid->setColStretch(0, 1);
    buttonGrid->addWidget(import, 0, 1);
    buttonGrid->addWidget(close, 0, 2);

    QGridLayout* grid = new QGridLayout(frame);
    grid->setSpacing(6);
    grid->setMargin(6);
    grid->setRowStretch(1, 1);
    grid->addWidget(file, 0, 0);
    grid->addWidget(_log, 1, 0);
    grid->addWidget(buttons, 2, 0);

    _filePath->setFocus();

    setCentralWidget(frame);
    setCaption(tr("Data Import: " + company.name()));
}
Ejemplo n.º 25
0
void PdfViewer::createToolBarsWhenNoMenuBar()
{
#ifndef QT_NO_SHORTCUT
	m_fileOpenRecentAction->setShortcut(QKeySequence::Open);
#endif // QT_NO_SHORTCUT
	connect(m_fileOpenRecentAction, SIGNAL(triggered()), this, SLOT(slotOpenFile()));
	m_fileOpenRecentButton = new QToolButton(this);
	m_fileOpenRecentButton->setDefaultAction(m_fileOpenRecentAction);
	m_fileOpenRecentButton->setText(tr("&Open", "Action icon text: open file"));
	m_fileOpenRecentButton->setIcon(Icon("document-open"));
	m_fileOpenRecentButton->setPopupMode(QToolButton::MenuButtonPopup);
	m_fileOpenRecentButton->installEventFilter(this);

	m_fileSaveCopyAction->setIconText(tr("&Save a Copy", "Action icon text"));
	m_findAction->setIconText(tr("&Find", "Action icon text"));

	// Tools menu
	m_toolsButton = new QToolButton(this);
	QMenu *toolsMenu = new QMenu(m_toolsButton);
	m_toolsButton->setIcon(Icon("configure"));
	m_toolsButton->setText(tr("&Tools", "Menu title"));
	m_toolsButton->setMenu(toolsMenu);
	m_toolsButton->setPopupMode(QToolButton::InstantPopup);
	toolsMenu->addAction(m_findAction);
//	toolsMenu->addAction(m_findNextAction);
//	toolsMenu->addAction(m_findPreviousAction);
    toolsMenu->addAction(m_amkhlvDnAction);
    toolsMenu->addAction(m_amkhlvUpAction);
    toolsMenu->addAction(m_amkhlvDnFAction);
    toolsMenu->addAction(m_amkhlvUpFAction);
    toolsMenu->addAction(m_amkhlvRtAction);
    toolsMenu->addAction(m_amkhlvLtAction);
    toolsMenu->addAction(m_amkhlvRtFAction);
    toolsMenu->addAction(m_amkhlvLtFAction);
	toolsMenu->addSeparator();
	toolsMenu->addAction(m_goToStartAction);
	toolsMenu->addAction(m_goToEndAction);
	toolsMenu->addSeparator();
	toolsMenu->addAction(m_printAction);
	toolsMenu->addSeparator();
	toolsMenu->addAction(m_showPresentationAction);
	toolsMenu->addSeparator();
	toolsMenu->addAction(m_pdfView->action(PdfView::ShowForms));
	toolsMenu->addAction(m_pdfView->action(PdfView::Bookmarks));
	m_pdfView->action(PdfView::Bookmarks)->setText(tr("Boo&kmarks", "Menu title"));
	m_pdfView->action(PdfView::Bookmarks)->setIcon(Icon("bookmarks"));
	m_pdfView->action(PdfView::SetBookmark)->setIcon(Icon("bookmark-new"));
    m_pdfView->action(PdfView::UnSetBookmark)->setIcon(Icon("dialog-cancel"));
	m_pdfView->action(PdfView::PreviousBookmark)->setIcon(Icon("go-up"));
	m_pdfView->action(PdfView::NextBookmark)->setIcon(Icon("go-down"));
    m_pdfView->action(PdfView::ReturnBack)->setIcon(Icon("stock_undo"));

	ShortcutHandler::instance()->addAction(m_pdfView->action(PdfView::SetBookmark));
    ShortcutHandler::instance()->addAction(m_pdfView->action(PdfView::UnSetBookmark));
	ShortcutHandler::instance()->addAction(m_pdfView->action(PdfView::AmkhlvDn));
	ShortcutHandler::instance()->addAction(m_pdfView->action(PdfView::AmkhlvUp));
	ShortcutHandler::instance()->addAction(m_pdfView->action(PdfView::AmkhlvDnF));
	ShortcutHandler::instance()->addAction(m_pdfView->action(PdfView::AmkhlvUpF));
	ShortcutHandler::instance()->addAction(m_pdfView->action(PdfView::AmkhlvRt));
	ShortcutHandler::instance()->addAction(m_pdfView->action(PdfView::AmkhlvLt));
	ShortcutHandler::instance()->addAction(m_pdfView->action(PdfView::AmkhlvRtF));
	ShortcutHandler::instance()->addAction(m_pdfView->action(PdfView::AmkhlvLtF));
	ShortcutHandler::instance()->addAction(m_pdfView->action(PdfView::PreviousBookmark));
	ShortcutHandler::instance()->addAction(m_pdfView->action(PdfView::NextBookmark));
    ShortcutHandler::instance()->addAction(m_pdfView->action(PdfView::ReturnBack));
    m_viewMenu = new QMenu(tr("&View", "Menu title"), toolsMenu);
	toolsMenu->addMenu(m_viewMenu);
	QMenu *settingsMenu = new QMenu(tr("&Settings", "Menu title"), toolsMenu);
#ifndef QT_NO_SHORTCUT
	settingsMenu->addAction(ShortcutHandler::instance()->shortcutConfigAction());
	ShortcutHandler::instance()->shortcutConfigAction()->setIcon(Icon("configure-shortcuts"));
#endif // QT_NO_SHORTCUT
	settingsMenu->addAction(m_settingsTextAAAction);
	settingsMenu->addAction(m_settingsGfxAAAction);
	settingsMenu->addAction(m_renderBackendAction);
	settingsMenu->addAction(m_configureAction);
	toolsMenu->addMenu(settingsMenu);
	toolsMenu->addSeparator();
#ifndef QT_NO_SHORTCUT
	toolsMenu->addAction(QIcon(":/icons/pdfviewer-22.png"), tr("&About %1").arg(QCoreApplication::applicationName()), this, SLOT(slotAbout()));
    toolsMenu->addAction(QIcon(":/icons/qt-logo-22.png"), tr("About &Qt"), this, SLOT(slotAboutQt()));
#endif // QT_NO_SHORTCUT

	// Add everything to the toolbar
	m_toolBar = addToolBar(tr("Main Tool Bar"));
	m_toolBar->setObjectName("MainToolBar");
	m_toolBar->addWidget(m_fileOpenRecentButton);
	m_toolBar->addAction(m_fileSaveCopyAction);
	m_toolBar->addSeparator();
	m_toolBar->addAction(m_goToPreviousPageAction);
	m_toolBar->addAction(m_goToPageAction);
	m_toolBar->addAction(m_goToNextPageAction);
	m_toolBar->addSeparator();
	m_toolBar->addAction(m_zoomInAction);
	m_toolBar->addAction(m_zoomAction);
	m_toolBar->addAction(m_zoomOutAction);
	m_toolBar->addSeparator();
	m_toolBar->addAction(m_mouseBrowseAction);
	m_toolBar->addAction(m_mouseMagnifyAction);
	m_toolBar->addAction(m_mouseSelectionAction);
	m_toolBar->addAction(m_mouseTextSelectionAction);
	m_toolBar->addSeparator();
//	QLabel *stretch = new QLabel(m_toolBar);
//	stretch->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Ignored);
//	m_toolBar->addWidget(stretch);
	m_toolBar->addWidget(m_toolsButton);
	m_toolBar->installEventFilter(this);
	m_pdfView->addContextMenuAction(m_toolBar->toggleViewAction());
	connect(m_toolBar, SIGNAL(visibilityChanged(bool)), this, SLOT(slotSetToolBarToggleViewActionHidden(bool)));

	// Add orphan actions
	addAction(m_findPreviousAction);
	addAction(m_findNextAction);
	addAction(m_quitAction);
}