Exemplo n.º 1
0
void MainWindow::createActions()
{
    ui->actionNew->setShortcut(QKeySequence(QKeySequence::New));
    ui->actionOpen->setShortcut(QKeySequence(QKeySequence::Open));
    ui->actionSave->setShortcut(QKeySequence(QKeySequence::Save));
    ui->actionSave_as->setShortcut(QKeySequence("Shift+Ctrl+S"));
    ui->actionShortcuts->setShortcut(QKeySequence("Ctrl+H"));
    ui->actionRender->setShortcut(QKeySequence("Ctrl+R"));
    ui->actionRenderPreview->setShortcut(QKeySequence("Shift+Ctrl+R"));
    ui->actionExamineFlow->setShortcut(QKeySequence("Shift+Ctrl+X"));
    ui->actionPreferences->setShortcut(QKeySequence("Ctrl+,"));
    ui->actionAbout->setShortcut(QKeySequence("F1"));
    ui->actionQuit->setShortcut(QKeySequence(QKeySequence::Quit));
    ui->actionZoomIn->setShortcut(QKeySequence(QKeySequence::ZoomIn));
    ui->actionZoomOut->setShortcut(QKeySequence(QKeySequence::ZoomOut));
    
    m_cs.addShortcut("h", Help, tr("Show help overlay"));
    m_cs.addShortcut("q-q", Quit, tr("Quit"));
    m_cs.addShortcut("n", New, tr("New project"));
    m_cs.addShortcut("o", Open, tr("Open project"));
    m_cs.addShortcut("s-s", Save_Same, tr("Save"));
    m_cs.addShortcut("s-a", Save_As, tr("Save as ..."));
    m_cs.addShortcut("a", Abort, tr("Abort move"));
    m_cs.addShortcut("a-s", Abort_Selection, tr("Unselect all"));
    m_cs.addShortcut("d-n", Delete_Node, tr("Delete selected nodes"));
    m_cs.addShortcut("t-s", Tool_Select, tr("Selecting tool"));
    m_cs.addShortcut("t-m", Tool_Move, tr("Move tool"));
    m_cs.addShortcut("t-t", Tag, tr("Insert label (tag)"));
    
    connect(&m_cs, SIGNAL(signalShortcutUsed(int)), this, SLOT(slotShortcutUsed(int)));
    
    connect(this, SIGNAL(deleteNodes()), m_wCanvas, SLOT(slotDeleteNodes()));
    connect(this, SIGNAL(setMode(Canvas::ToolMode)), m_wCanvas, SLOT(slotSetToolMode(Canvas::ToolMode)));
    connect(this, SIGNAL(abort(Canvas::Abort)), m_wCanvas, SLOT(slotAbort(Canvas::Abort)));
    connect(this, SIGNAL(addTag()), m_wCanvas, SLOT(slotAddTag()));
    
    connect(ui->actionZoomIn, SIGNAL(triggered()), m_wCanvas, SLOT(slotZoomIn()));
    connect(ui->actionZoomOut, SIGNAL(triggered()), m_wCanvas, SLOT(slotZoomOut()));
    
    connect(m_wCanvas, SIGNAL(signalMouseInputTimeChanged(qreal)),
            this, SLOT(slotForwardInputPosition(qreal)));
    connect(m_wCanvas, SIGNAL(signalMouseCurveSrcTimeChanged(qreal)),
            this, SLOT(slotForwardCurveSrcPosition(qreal)));
    
    
    connect(ui->actionNew, SIGNAL(triggered()), this, SLOT(slotNewProject()));
    connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(slotLoadProjectDialog()));
    connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(slotSaveProject()));
    connect(ui->actionSave_as, SIGNAL(triggered()), this, SLOT(slotSaveProjectDialog()));
    connect(ui->actionRender, SIGNAL(triggered()), this, SLOT(slotShowRenderDialog()));
    connect(ui->actionRenderPreview, SIGNAL(triggered()), this, SLOT(slotUpdateRenderPreview()));
    connect(ui->actionExamineFlow, SIGNAL(triggered()), this, SLOT(slotShowFlowExaminerDialog()));
    connect(ui->actionPreferences, SIGNAL(triggered()), this, SLOT(slotShowPreferencesDialog()));
    connect(ui->actionShortcuts, SIGNAL(triggered()), this, SLOT(slotToggleHelp()));
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(slotShowAboutDialog()));
    connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(close()));
    connect(ui->actionProjectPreferences, SIGNAL(triggered()), this, SLOT(slotShowProjectPreferencesDialog()));
    connect(ui->actionEdit_Flow, SIGNAL(triggered()), this, SLOT(slotShowFlowEditWindow()));
    connect(ui->actionDebug_Window, SIGNAL(toggled(bool)), this, SLOT(slotShowDebugWindow(bool)));
}
Exemplo n.º 2
0
void SpectrumWidget::keyPressEvent( QKeyEvent *e )
{
	 kdDebug() << "SpectrumWidget::keyPressEvent()" << endl;
	switch ( e->key() )
	{
		case Key_Plus:
			slotZoomIn();
			break;
		case Key_Minus:
			slotZoomOut();
			break;
	}
}
Exemplo n.º 3
0
void PdfViewer::createToolBars()
{
    m_toolBar = addToolBar(tr("Main Tool Bar"));
    m_toolBar->setObjectName("MainToolBar");
    QWidget *zoomBar = new QWidget(m_toolBar);
    QHBoxLayout *zoomLayout = new QHBoxLayout;
    zoomBar->setLayout(zoomLayout);
    QToolButton *zoomInBtn = new QToolButton(zoomBar);
    zoomInBtn->setIcon(Icon("zoom-in"));
    connect(zoomInBtn,SIGNAL( clicked()), m_pdfView, SLOT(slotZoomIn()));
    QToolButton *zoomOutBtn = new QToolButton(zoomBar);
    zoomOutBtn->setIcon(Icon("zoom-out"));
    connect(zoomOutBtn,SIGNAL( clicked()), m_pdfView, SLOT(slotZoomOut()));
    zoomLayout->addWidget(zoomInBtn);
    zoomLayout->addWidget(zoomOutBtn);

    QWidget *navBar = new QWidget(m_toolBar);
    QHBoxLayout *navLayout = new QHBoxLayout;
    navBar->setLayout(navLayout);
    QToolButton *navPrevBtn = new QToolButton(navBar);
    navPrevBtn->setIcon(Icon("go-previous"));
    connect(navPrevBtn,SIGNAL( clicked()), m_pdfView, SLOT(slotGoToPreviousPage()));
    QToolButton *navNextBtn = new QToolButton(navBar);
    navNextBtn->setIcon(Icon("go-next"));
    connect(navNextBtn,SIGNAL( clicked()), m_pdfView, SLOT(slotGoToNextPage()));
    navLayout->addWidget(navPrevBtn);
    navLayout->addWidget(navNextBtn);

	m_toolBar->addAction(m_fileOpenAction);
    m_toolBar->addAction(m_ReloadDocAction);
    m_toolBar->addSeparator();
    m_toolBar->addAction(m_ReturnBackAction);
    //m_toolBar->addAction(m_goToPreviousPageAction);
	m_toolBar->addAction(m_goToPageAction);
    m_toolBar->addWidget(navBar);
    //m_toolBar->addAction(m_goToNextPageAction);
    //m_toolBar->addAction(m_zoomInAction);
	m_toolBar->addAction(m_zoomAction);
    m_toolBar->addWidget(zoomBar);
    //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();
	m_toolBar->addAction(m_pdfView->action(PdfView::ShowForms));
}
Exemplo n.º 4
0
int main(int argc, char** argv)
{
    QApplication app(argc, argv);
    QWidget    wgt;
    QGraphicsScene scene(QRectF(-100, -100, 640, 480));
    MyView* pView = new MyView(&scene);
    QPushButton* pcmdZoomIn = new QPushButton("&Zoom In");
    QPushButton* pcmdZoomOut = new QPushButton("Z&oom Out");
    QPushButton* pcmdRotateLeft = new QPushButton("&Rotate Left");
    QPushButton* pcmdRotateRight = new QPushButton("Ro&tate Right");

    pView->setRenderHint(QPainter::Antialiasing, true);

    QGraphicsPixmapItem* pPixmapItem = scene.addPixmap(QPixmap("aBYKS749x88.jpg"));
    pPixmapItem->setFlags(QGraphicsItem::ItemIsMovable);

    for(int i = 0; i < 20; i++)
    {
        SimpleItem* pSimpleItem = new SimpleItem;
        scene.addItem(pSimpleItem);
        pSimpleItem->setPos(i*30, 0);
        pSimpleItem->setFlags(QGraphicsItem::ItemIsMovable);
        pSimpleItem->setParentItem(pPixmapItem);
    }

    QObject::connect(pcmdZoomIn,     SIGNAL(clicked()),  pView, SLOT(slotZoomIn()));
    QObject::connect(pcmdZoomOut,    SIGNAL(clicked()),  pView, SLOT(slotZoomOut()));
    QObject::connect(pcmdRotateLeft, SIGNAL(clicked()),  pView, SLOT(slotRotateLeft()));
    QObject::connect(pcmdRotateRight,SIGNAL(clicked()),  pView, SLOT(slotRotateRight()));

    QVBoxLayout* pvbxLayout = new QVBoxLayout;
    pvbxLayout->addWidget(pView);
    pvbxLayout->addWidget(pcmdZoomIn);
    pvbxLayout->addWidget(pcmdZoomOut);
    pvbxLayout->addWidget(pcmdRotateLeft);
    pvbxLayout->addWidget(pcmdRotateRight);
    wgt.setLayout(pvbxLayout);
    wgt.show();

    return app.exec();
}
Exemplo n.º 5
0
void JuffEd::initActions() {
	CommandStorageInt* st = Juff::Utils::commandStorage();
	
	st->addAction(FILE_NEW,         tr("&New"),     this, SLOT(slotFileNew()));
	st->addAction(FILE_OPEN,        tr("&Open"),    this, SLOT(slotFileOpen()));
	st->addAction(FILE_SAVE,        tr("&Save"),    this, SLOT(slotFileSave()));
	st->addAction(FILE_SAVE_AS,     tr("Save as"), this, SLOT(slotFileSaveAs()));
	st->addAction(FILE_SAVE_ALL,    tr("Save all"), this, SLOT(slotFileSaveAll()));
	st->addAction(FILE_RELOAD,      tr("&Reload"),  this, SLOT(slotFileReload()));
	st->addAction(FILE_RENAME,      tr("Rename"),  this, SLOT(slotFileRename()));
	st->addAction(FILE_CLOSE,       tr("Close"),  this, SLOT(slotFileClose()));
	st->addAction(FILE_CLOSE_ALL,   tr("Close All"),  this, SLOT(slotFileCloseAll()));
	st->addAction(FILE_PRINT,       tr("&Print"),  this, SLOT(slotFilePrint()));
	st->addAction(FILE_EXIT,        tr("Exit"),  this, SLOT(slotFileExit()));
	
	st->addAction(SESSION_NEW,      tr("New session"), this, SLOT(slotSessionNew()));
	st->addAction(SESSION_OPEN,     tr("Open session"), this, SLOT(slotSessionOpen()));
	st->addAction(SESSION_SAVE,     tr("Save session as..."), this, SLOT(slotSessionSaveAs()));
	
	st->addAction(EDIT_UNDO,        tr("Undo"), this, SLOT(slotEditUndo()));
	st->addAction(EDIT_REDO,        tr("Redo"), this, SLOT(slotEditRedo()));
	st->addAction(EDIT_CUT,         tr("Cut"), this, SLOT(slotEditCut()));
	st->addAction(EDIT_COPY,        tr("Copy"), this, SLOT(slotEditCopy()));
	st->addAction(EDIT_PASTE,       tr("Paste"), this, SLOT(slotEditPaste()));
	
	st->addAction(SEARCH_FIND,      tr("Find"), this, SLOT(slotFind()));
	st->addAction(SEARCH_FIND_NEXT, tr("Find next"), this, SLOT(slotFindNext()));
	st->addAction(SEARCH_FIND_PREV, tr("Find previous"), this, SLOT(slotFindPrev()));
	st->addAction(SEARCH_REPLACE,   tr("Replace"), this, SLOT(slotReplace()));
	st->addAction(SEARCH_GOTO_LINE, tr("Go to line"), this, SLOT(slotGotoLine()));
	st->addAction(SEARCH_GOTO_FILE, tr("Go to file"), this, SLOT(slotGotoFile()));
	
	st->addAction(VIEW_ZOOM_IN,      tr("Zoom In"), this, SLOT(slotZoomIn()));
	st->addAction(VIEW_ZOOM_OUT,     tr("Zoom Out"), this, SLOT(slotZoomOut()));
	st->addAction(VIEW_ZOOM_100,     tr("Zoom 100%"), this, SLOT(slotZoom100()));
	st->addAction(VIEW_FULLSCREEN,   tr("Fullscreen"), this, SLOT(slotFullscreen()));
	
	st->addAction(TOOLS_SETTINGS,    tr("Settings"), this, SLOT(slotSettings()));
	st->addAction(HELP_ABOUT,        tr("About"), mw_, SLOT(slotAbout()));
	st->addAction(HELP_ABOUT_QT,     tr("About Qt"), mw_, SLOT(slotAboutQt()));
}
Exemplo n.º 6
0
void CQLayoutView::wheelEvent(QWheelEvent* event)
{
  if (QApplication::keyboardModifiers() == Qt::ControlModifier ||
      QApplication::keyboardModifiers() == Qt::MetaModifier ||
      QApplication::keyboardModifiers() == Qt::ShiftModifier)
    {
      if (event->delta() > 0)
        {
          // Zoom in
          slotZoomIn();
        }
      else
        {
          // Zooming out
          slotZoomOut();
        }
    }
  else
    {
      QGraphicsView::wheelEvent(event);
    }
}
Exemplo n.º 7
0
void CQLayoutView::createActions()
{
  mpActFitOnScreen = new QAction(tr("Fit On Screen"), this);
  mpActFitOnScreen->setShortcut(QKeySequence::fromString("F5"));
  mpActFitOnScreen->setIcon(CQIconResource::icon(CQIconResource::viewmagfit));
  connect(mpActFitOnScreen, SIGNAL(triggered()), this, SLOT(slotFitOnScreen()));
  addAction(mpActFitOnScreen);

  mpActResetZoom = new QAction(tr("Reset Zoom"), this);
  mpActResetZoom->setIcon(CQIconResource::icon(CQIconResource::viewmag1));
  connect(mpActResetZoom, SIGNAL(triggered()), this, SLOT(slotResetZoom()));
  addAction(mpActResetZoom);

  mpActZoomIn = new QAction(tr("Zoom In"), this);
  mpActZoomIn->setIcon(CQIconResource::icon(CQIconResource::viewmagPlus));
  mpActZoomIn->setShortcut(QKeySequence::ZoomIn);
  connect(mpActZoomIn, SIGNAL(triggered()), this, SLOT(slotZoomIn()));
  addAction(mpActZoomIn);

  mpActZoomOut = new QAction(tr("Zoom Out"), this);
  mpActZoomOut->setIcon(CQIconResource::icon(CQIconResource::viewmagMinus));
  mpActZoomOut->setShortcut(QKeySequence::ZoomOut);
  connect(mpActZoomOut, SIGNAL(triggered()), this, SLOT(slotZoomOut()));
  addAction(mpActZoomOut);

  mpLayoutDropdown = new QComboBox;
  mpLayoutDropdown->setSizeAdjustPolicy(QComboBox::AdjustToContentsOnFirstShow);

  mpRenderDropdown = new QComboBox;
  mpRenderDropdown->setSizeAdjustPolicy(QComboBox::AdjustToContentsOnFirstShow);

  connect(mpLayoutDropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(slotLayoutChanged(int)));
  connect(mpRenderDropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(slotRenderInformationChanged(int)));

  setInteractive(true);
  setRenderHints(QPainter::Antialiasing);
}
Exemplo n.º 8
0
void QtGradientStopsController::setUi(Ui_QtGradientEditor *ui)
{
    d_ptr->m_ui = ui;

    d_ptr->m_ui->hueColorLine->setColorComponent(QtColorLine::Hue);
    d_ptr->m_ui->saturationColorLine->setColorComponent(QtColorLine::Saturation);
    d_ptr->m_ui->valueColorLine->setColorComponent(QtColorLine::Value);
    d_ptr->m_ui->alphaColorLine->setColorComponent(QtColorLine::Alpha);

    d_ptr->m_model = new QtGradientStopsModel(this);
    d_ptr->m_ui->gradientStopsWidget->setGradientStopsModel(d_ptr->m_model);
    connect(d_ptr->m_model, SIGNAL(currentStopChanged(QtGradientStop*)),
                this, SLOT(slotCurrentStopChanged(QtGradientStop*)));
    connect(d_ptr->m_model, SIGNAL(stopMoved(QtGradientStop*,qreal)),
                this, SLOT(slotStopMoved(QtGradientStop*,qreal)));
    connect(d_ptr->m_model, SIGNAL(stopsSwapped(QtGradientStop*,QtGradientStop*)),
                this, SLOT(slotStopsSwapped(QtGradientStop*,QtGradientStop*)));
    connect(d_ptr->m_model, SIGNAL(stopChanged(QtGradientStop*,QColor)),
                this, SLOT(slotStopChanged(QtGradientStop*,QColor)));
    connect(d_ptr->m_model, SIGNAL(stopSelected(QtGradientStop*,bool)),
                this, SLOT(slotStopSelected(QtGradientStop*,bool)));
    connect(d_ptr->m_model, SIGNAL(stopAdded(QtGradientStop*)),
                this, SLOT(slotStopAdded(QtGradientStop*)));
    connect(d_ptr->m_model, SIGNAL(stopRemoved(QtGradientStop*)),
                this, SLOT(slotStopRemoved(QtGradientStop*)));

    connect(d_ptr->m_ui->hueColorLine, SIGNAL(colorChanged(QColor)),
                this, SLOT(slotChangeHue(QColor)));
    connect(d_ptr->m_ui->saturationColorLine, SIGNAL(colorChanged(QColor)),
                this, SLOT(slotChangeSaturation(QColor)));
    connect(d_ptr->m_ui->valueColorLine, SIGNAL(colorChanged(QColor)),
                this, SLOT(slotChangeValue(QColor)));
    connect(d_ptr->m_ui->alphaColorLine, SIGNAL(colorChanged(QColor)),
                this, SLOT(slotChangeAlpha(QColor)));
    connect(d_ptr->m_ui->colorButton, SIGNAL(colorChanged(QColor)),
                this, SLOT(slotChangeColor(QColor)));

    connect(d_ptr->m_ui->hueSpinBox, SIGNAL(valueChanged(int)),
                this, SLOT(slotChangeHue(int)));
    connect(d_ptr->m_ui->saturationSpinBox, SIGNAL(valueChanged(int)),
                this, SLOT(slotChangeSaturation(int)));
    connect(d_ptr->m_ui->valueSpinBox, SIGNAL(valueChanged(int)),
                this, SLOT(slotChangeValue(int)));
    connect(d_ptr->m_ui->alphaSpinBox, SIGNAL(valueChanged(int)),
                this, SLOT(slotChangeAlpha(int)));

    connect(d_ptr->m_ui->positionSpinBox, SIGNAL(valueChanged(double)),
                this, SLOT(slotChangePosition(double)));

    connect(d_ptr->m_ui->zoomSpinBox, SIGNAL(valueChanged(int)),
                this, SLOT(slotChangeZoom(int)));
    connect(d_ptr->m_ui->zoomInButton, SIGNAL(clicked()),
                this, SLOT(slotZoomIn()));
    connect(d_ptr->m_ui->zoomOutButton, SIGNAL(clicked()),
                this, SLOT(slotZoomOut()));
    connect(d_ptr->m_ui->zoomAllButton, SIGNAL(clicked()),
                this, SLOT(slotZoomAll()));
    connect(d_ptr->m_ui->gradientStopsWidget, SIGNAL(zoomChanged(double)),
                this, SLOT(slotZoomChanged(double)));

    connect(d_ptr->m_ui->hsvRadioButton, SIGNAL(clicked()),
                this, SLOT(slotHsvClicked()));
    connect(d_ptr->m_ui->rgbRadioButton, SIGNAL(clicked()),
                this, SLOT(slotRgbClicked()));

    d_ptr->enableCurrent(false);
    d_ptr->m_ui->zoomInButton->setIcon(QIcon(QLatin1String(":/trolltech/qtgradienteditor/images/zoomin.png")));
    d_ptr->m_ui->zoomOutButton->setIcon(QIcon(QLatin1String(":/trolltech/qtgradienteditor/images/zoomout.png")));
    d_ptr->updateZoom(1);
}
BezierSplineWidget::BezierSplineWidget(const QString& spline, QWidget* parent) :
        QWidget(parent),
        m_mode(ModeRGB),
        m_showPixmap(true)
{
    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->addWidget(&m_edit);
    QWidget *widget = new QWidget(this);
    m_ui.setupUi(widget);
    layout->addWidget(widget);

    m_ui.buttonLinkHandles->setIcon(QIcon::fromTheme(QLatin1String("insert-link")));
    m_ui.buttonZoomIn->setIcon(QIcon::fromTheme(QLatin1String("zoom-in")));
    m_ui.buttonZoomOut->setIcon(QIcon::fromTheme(QLatin1String("zoom-out")));
    m_ui.buttonGridChange->setIcon(QIcon::fromTheme(QLatin1String("view-grid")));
    m_ui.buttonShowPixmap->setIcon(QIcon(QPixmap::fromImage(ColorTools::rgbCurvePlane(QSize(16, 16), ColorTools::COL_Luma, 0.8))));
    m_ui.buttonResetSpline->setIcon(QIcon::fromTheme(QLatin1String("view-refresh")));
    m_ui.buttonShowAllHandles->setIcon(QIcon::fromTheme(QLatin1String("draw-bezier-curves")));
    m_ui.widgetPoint->setEnabled(false);

    m_pX = new DragValue(i18n("In"), 0, 3, 0, 1, -1, QString(), false, this);
    m_pX->setStep(0.001);
    m_pY = new DragValue(i18n("Out"), 0, 3, 0, 1, -1, QString(), false, this);
    m_pY->setStep(0.001);
    m_h1X = new DragValue(i18n("X"), 0, 3, -2, 2, -1, QString(), false, this);
    m_h1X->setStep(0.001);
    m_h1Y = new DragValue(i18n("Y"), 0, 3, -2, 2, -1, QString(), false, this);
    m_h1Y->setStep(0.001);
    m_h2X = new DragValue(i18n("X"), 0, 3, -2, 2, -1, QString(), false, this);
    m_h2X->setStep(0.001);
    m_h2Y = new DragValue(i18n("Y"), 0, 3, -2, 2, -1, QString(), false, this);
    m_h2Y->setStep(0.001);

    m_ui.layoutP->addWidget(m_pX);
    m_ui.layoutP->addWidget(m_pY);
    m_ui.layoutH1->addWidget(new QLabel(i18n("Handle 1:")));
    m_ui.layoutH1->addWidget(m_h1X);
    m_ui.layoutH1->addWidget(m_h1Y);
    m_ui.layoutH2->addWidget(new QLabel(i18n("Handle 2:")));
    m_ui.layoutH2->addWidget(m_h2X);
    m_ui.layoutH2->addWidget(m_h2Y);

    CubicBezierSpline s;
    s.fromString(spline);
    m_edit.setSpline(s);

    connect(&m_edit, SIGNAL(modified()), this, SIGNAL(modified()));
    connect(&m_edit, SIGNAL(currentPoint(BPoint)), this, SLOT(slotUpdatePointEntries(BPoint)));

    connect(m_pX, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointP(double,bool)));
    connect(m_pY, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointP(double,bool)));
    connect(m_h1X, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointH1(double,bool)));
    connect(m_h1Y, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointH1(double,bool)));
    connect(m_h2X, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointH2(double,bool)));
    connect(m_h2Y, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointH2(double,bool)));

    connect(m_ui.buttonLinkHandles, SIGNAL(toggled(bool)), this, SLOT(slotSetHandlesLinked(bool)));
    connect(m_ui.buttonZoomIn, SIGNAL(clicked()), &m_edit, SLOT(slotZoomIn()));
    connect(m_ui.buttonZoomOut, SIGNAL(clicked()), &m_edit, SLOT(slotZoomOut()));
    connect(m_ui.buttonGridChange, SIGNAL(clicked()), this, SLOT(slotGridChange()));
    connect(m_ui.buttonShowPixmap, SIGNAL(toggled(bool)), this, SLOT(slotShowPixmap(bool)));
    connect(m_ui.buttonResetSpline, SIGNAL(clicked()), this, SLOT(slotResetSpline()));
    connect(m_ui.buttonShowAllHandles, SIGNAL(toggled(bool)), this, SLOT(slotShowAllHandles(bool)));

    m_edit.setGridLines(KdenliveSettings::bezier_gridlines());
    m_ui.buttonShowPixmap->setChecked(KdenliveSettings::bezier_showpixmap());
    slotShowPixmap(m_ui.buttonShowPixmap->isChecked());
    m_ui.buttonShowAllHandles->setChecked(KdenliveSettings::bezier_showallhandles());
}
Exemplo n.º 10
0
void KStars::initActions() {
    KIconLoader::global()->addAppDir( "kstars" );
    KAction *ka;

    // ==== File menu ================
    ka = KNS3::standardAction(i18n("Download New Data..."), this, SLOT(slotDownload()), actionCollection(), "get_data")
        << KShortcut( Qt::CTRL+Qt::Key_D );
    ka->setWhatsThis(i18n("Downloads new data"));
    ka->setToolTip(ka->whatsThis());
    ka->setStatusTip(ka->whatsThis());

#ifdef HAVE_CFITSIO_H
    actionCollection()->addAction("open_file", this, SLOT(slotOpenFITS()) )
        << i18n("Open FITS...")
        << KIcon("document-open")
        << KShortcut( Qt::CTRL+Qt::Key_O );
#endif

    actionCollection()->addAction("export_image", this, SLOT( slotExportImage() ) )
        << i18n("&Save Sky Image...")
        << KIcon("document-export-image")
        << KShortcut( Qt::CTRL+Qt::Key_I );
    actionCollection()->addAction("run_script", this, SLOT( slotRunScript() ))
        << i18n("&Run Script...")
        << KIcon("system-run" )
        << KShortcut( Qt::CTRL+Qt::Key_R );
    actionCollection()->addAction("printing_wizard", this, SLOT(slotPrintingWizard() ) )
            << i18nc("start Printing Wizard", "Printing &Wizard");
    actionCollection()->addAction( KStandardAction::Print, "print", this, SLOT( slotPrint() ) );
    actionCollection()->addAction( KStandardAction::Quit,  "quit",  this, SLOT( close() ) );

    // ==== Time Menu ================
    actionCollection()->addAction("time_to_now", this, SLOT( slotSetTimeToNow() ))
        << i18n("Set Time to &Now")
        << KShortcut( Qt::CTRL+Qt::Key_E )
        << KIcon("clock");

    actionCollection()->addAction("time_dialog", this, SLOT( slotSetTime() ) )
        << i18nc("set Clock to New Time", "&Set Time..." )
        << KShortcut( Qt::CTRL+Qt::Key_S )
        << KIcon("view-history");

    ka = actionCollection()->add<KToggleAction>("clock_startstop")
        << i18n("Stop &Clock" )
        << KIcon("media-playback-pause" );
    if ( ! StartClockRunning )
        ka->toggle();
    QObject::connect( ka, SIGNAL( triggered() ), this, SLOT( slotToggleTimer() ) );
    QObject::connect(data()->clock(), SIGNAL(clockToggled(bool)), ka, SLOT(setChecked(bool)) );
    //UpdateTime() if clock is stopped (so hidden objects get drawn)
    QObject::connect(data()->clock(), SIGNAL(clockToggled(bool)), this, SLOT(updateTime()) );
    actionCollection()->addAction("time_step_forward", this, SLOT( slotStepForward() ) )
        << i18n("Advance one step forward in time")
        << KIcon("media-skip-forward" )
        << KShortcut( Qt::Key_Greater, Qt::Key_Period );
    actionCollection()->addAction("time_step_backward", this, SLOT( slotStepBackward() ) )
        << i18n("Advance one step backward in time")
        << KIcon("media-skip-backward" )
        << KShortcut( Qt::Key_Less, Qt::Key_Comma );

    // ==== Pointing Menu ================
    actionCollection()->addAction("zenith", this, SLOT( slotPointFocus() ) )
        << i18n("&Zenith")
        << KShortcut("Z");
    actionCollection()->addAction("north", this, SLOT( slotPointFocus() ) )
        << i18n("&North")
        << KShortcut("N");
    actionCollection()->addAction("east", this, SLOT( slotPointFocus() ) )
        << i18n("&East")
        << KShortcut("E");
    actionCollection()->addAction("south", this, SLOT( slotPointFocus() ) )
        << i18n("&South")
        << KShortcut("S");
    actionCollection()->addAction("west", this, SLOT( slotPointFocus() ) )
        << i18n("&West")
        << KShortcut("W");

    actionCollection()->addAction("find_object", this, SLOT( slotFind() ) )
        << i18n("&Find Object...")
        << KIcon("edit-find")
        << KShortcut( Qt::CTRL+Qt::Key_F );
    actionCollection()->addAction("track_object", this, SLOT( slotTrack() ) )
        << i18n("Engage &Tracking")
        << KIcon("object-locked" )
        << KShortcut( Qt::CTRL+Qt::Key_T  );
    actionCollection()->addAction("manual_focus", this, SLOT( slotManualFocus() ) )
        << i18n("Set Coordinates &Manually..." )
        << KShortcut( Qt::CTRL+Qt::Key_M );

    // ==== View Menu ================
    actionCollection()->addAction( KStandardAction::ZoomIn,  "zoom_in",  map(), SLOT( slotZoomIn() ) );
    actionCollection()->addAction( KStandardAction::ZoomOut, "zoom_out", map(), SLOT( slotZoomOut() ) );
    actionCollection()->addAction("zoom_default", map(), SLOT( slotZoomDefault() ) )
        << i18n("&Default Zoom")
        << KIcon("zoom-fit-best" )
        << KShortcut( Qt::CTRL+Qt::Key_Z );
    actionCollection()->addAction("zoom_set", this, SLOT( slotSetZoom() ) )
        << i18n("&Zoom to Angular Size..." )
        << KIcon("zoom-original" )
        << KShortcut( Qt::CTRL+Qt::SHIFT+Qt::Key_Z );

    actionCollection()->addAction( KStandardAction::FullScreen, this, SLOT( slotFullScreen() ) );

    actionCollection()->addAction("coordsys", this, SLOT( slotCoordSys() ) )
        << (Options::useAltAz() ? i18n("Switch to star globe view (Equatorial &Coordinates)"): i18n("Switch to horizonal view (Horizontal &Coordinates)"))
        << KShortcut("Space" );

    #ifdef HAVE_OPENGL
    Q_ASSERT( SkyMap::Instance() ); // This assert should not fail, because SkyMap is already created by now. Just throwing it in anyway.
    actionCollection()->addAction("opengl", SkyMap::Instance(), SLOT( slotToggleGL() ) )
        << (Options::useGL() ? i18n("Switch to QPainter backend"): i18n("Switch to OpenGL backend"));
    #endif

    actionCollection()->addAction("project_lambert", this, SLOT( slotMapProjection() ) )
        << i18n("&Lambert Azimuthal Equal-area" )
        << KShortcut("F5" )
        << AddToGroup(projectionGroup)
        << Checked(Options::projection() == SkyMap::Lambert);
    actionCollection()->addAction("project_azequidistant", this, SLOT( slotMapProjection() ) )
        << i18n("&Azimuthal Equidistant" )
        << KShortcut("F6" )
        << AddToGroup(projectionGroup)
        << Checked(Options::projection() == SkyMap::AzimuthalEquidistant);
    actionCollection()->addAction("project_orthographic", this, SLOT( slotMapProjection() ) )
        << i18n("&Orthographic" )
        << KShortcut("F7" )
        << AddToGroup(projectionGroup)
        << Checked(Options::projection() == SkyMap::Orthographic);
    actionCollection()->addAction("project_equirectangular", this, SLOT( slotMapProjection() ) )
        << i18n("&Equirectangular" )
        << KShortcut("F8" )
        << AddToGroup(projectionGroup)
        << Checked(Options::projection() == SkyMap::Equirectangular);
    actionCollection()->addAction("project_stereographic", this, SLOT( slotMapProjection() ) )
        << i18n("&Stereographic" )
        << KShortcut("F9" )
        << AddToGroup(projectionGroup)
        << Checked(Options::projection() == SkyMap::Stereographic);
    actionCollection()->addAction("project_gnomonic", this, SLOT( slotMapProjection() ) )
        << i18n("&Gnomonic" )
        << KShortcut("F10" )
        << AddToGroup(projectionGroup)
        << Checked(Options::projection() == SkyMap::Gnomonic);

    //Settings Menu:
    //Info Boxes option actions
    KAction* kaBoxes = actionCollection()->add<KToggleAction>("show_boxes" )
        << i18nc("Show the information boxes", "Show &Info Boxes")
        << Checked( Options::showInfoBoxes() );
    connect( kaBoxes, SIGNAL(toggled(bool)), map(), SLOT(slotToggleInfoboxes(bool)));
    kaBoxes->setChecked( Options::showInfoBoxes() );

    ka = actionCollection()->add<KToggleAction>("show_time_box")
        << i18nc("Show time-related info box", "Show &Time Box");
    connect(kaBoxes, SIGNAL( toggled(bool) ), ka,    SLOT( setEnabled(bool) ) );
    connect(ka,      SIGNAL( toggled(bool) ), map(), SLOT( slotToggleTimeBox(bool)));
    ka->setChecked( Options::showTimeBox() );
    ka->setEnabled( Options::showInfoBoxes() );

    ka = actionCollection()->add<KToggleAction>("show_focus_box")
        << i18nc("Show focus-related info box", "Show &Focus Box");
    connect(kaBoxes, SIGNAL( toggled(bool) ), ka,    SLOT( setEnabled(bool) ) );
    connect(ka,      SIGNAL( toggled(bool) ), map(), SLOT( slotToggleFocusBox(bool)));
    ka->setChecked( Options::showFocusBox() );
    ka->setEnabled( Options::showInfoBoxes() );

    ka = actionCollection()->add<KToggleAction>("show_location_box")
        << i18nc("Show location-related info box", "Show &Location Box");
    connect(kaBoxes, SIGNAL( toggled(bool) ), ka,    SLOT( setEnabled(bool) ) );
    connect(ka,      SIGNAL( toggled(bool) ), map(), SLOT( slotToggleGeoBox(bool)));
    ka->setChecked( Options::showGeoBox() );
    ka->setEnabled( Options::showInfoBoxes() );


    //Toolbar options
    newToggleAction( actionCollection(), "show_mainToolBar", i18n("Show Main Toolbar"),
                     toolBar("kstarsToolBar"), SLOT(setVisible(bool)));
    newToggleAction( actionCollection(), "show_viewToolBar", i18n("Show View Toolbar"),
                     toolBar( "viewToolBar" ), SLOT(setVisible(bool)));

    //Statusbar view options
    newToggleAction( actionCollection(), "show_statusBar", i18n("Show Statusbar"),
                     this, SLOT(slotShowGUIItem(bool)));
    newToggleAction( actionCollection(), "show_sbAzAlt",   i18n("Show Az/Alt Field"),
                     this, SLOT(slotShowGUIItem(bool)));
    newToggleAction( actionCollection(), "show_sbRADec",   i18n("Show RA/Dec Field"),
                     this, SLOT(slotShowGUIItem(bool)));

    //Color scheme actions.  These are added to the "colorschemes" KActionMenu.
    colorActionMenu = actionCollection()->add<KActionMenu>("colorschemes" );
    colorActionMenu->setText( i18n("C&olor Schemes" ) );
    addColorMenuItem( i18n("&Classic" ), "cs_classic" );
    addColorMenuItem( i18n("&Star Chart" ), "cs_chart" );
    addColorMenuItem( i18n("&Night Vision" ), "cs_night" );
    addColorMenuItem( i18n("&Moonless Night" ), "cs_moonless-night" );

    //Add any user-defined color schemes:
    QFile file( KStandardDirs::locate("appdata", "colors.dat" ) ); //determine filename in local user KDE directory tree.
    if ( file.exists() && file.open( QIODevice::ReadOnly ) ) {
        QTextStream stream( &file );
        while ( !stream.atEnd() ) {
            QString line = stream.readLine();
            QString schemeName = line.left( line.indexOf( ':' ) );
            QString actionname = "cs_" + line.mid( line.indexOf( ':' ) +1, line.indexOf( '.' ) - line.indexOf( ':' ) - 1 );
            addColorMenuItem( i18n( schemeName.toLocal8Bit() ), actionname.toLocal8Bit() );
        }
        file.close();
    }

    //Add FOV Symbol actions
    fovActionMenu = actionCollection()->add<KActionMenu>("fovsymbols" );
    fovActionMenu->setText( i18n("&FOV Symbols" ) );
    repopulateFOV();

    actionCollection()->addAction("geolocation", this, SLOT( slotGeoLocator() ) )
        << i18nc("Location on Earth", "&Geographic..." )
        << KIcon("applications-internet" )
        << KShortcut( Qt::CTRL+Qt::Key_G );
    actionCollection()->addAction( KStandardAction::Preferences, "configure", this, SLOT( slotViewOps() ) );
    actionCollection()->addAction("startwizard", this, SLOT( slotWizard() ) )
        << i18n("Startup Wizard..." )
        << KIcon("tools-wizard" );

    // Updates actions
    actionCollection()->addAction( "update_comets", this, SLOT( slotUpdateComets() ) )
        << i18n( "Update comets orbital elements" );
    actionCollection()->addAction( "update_asteroids", this, SLOT( slotUpdateAsteroids() ) )
        << i18n( "Update asteroids orbital elements" );
    actionCollection()->addAction("update_supernovae", this, SLOT(slotUpdateSupernovae() ) )
        << i18n( "Update Recent Supernovae data" );
    actionCollection()->addAction("update_satellites", this, SLOT(slotUpdateSatellites() ) )
        << i18n( "Update satellites orbital elements" );

    //Tools Menu:
    actionCollection()->addAction("astrocalculator", this, SLOT( slotCalculator() ) )
        << i18n("Calculator")
        << KIcon("accessories-calculator" )
        << KShortcut( Qt::CTRL+Qt::Key_C );

    actionCollection()->addAction("moonphasetool", this, SLOT( slotMoonPhaseTool() ) )
        << i18n("Moon Phase Calendar");

    actionCollection()->addAction("obslist", this, SLOT( slotObsList() ) )
        << i18n("Observation Planner")
        << KShortcut( Qt::CTRL+Qt::Key_L );

    actionCollection()->addAction("altitude_vs_time", this, SLOT( slotAVT() ) )
        << i18n("Altitude vs. Time")
        << KShortcut( Qt::CTRL+Qt::Key_A );
    actionCollection()->addAction("whats_up_tonight", this, SLOT( slotWUT() ) )
        << i18n("What's up Tonight")
        << KShortcut(Qt::CTRL+Qt::Key_U );
    actionCollection()->addAction("whats_interesting", this, SLOT( slotWISettings() ) )
        << i18n("What's Interesting...")
        << KShortcut(Qt::CTRL+Qt::Key_W );
    actionCollection()->addAction("skycalendar", this, SLOT( slotCalendar() ) )
        << i18n("Sky Calendar");

#ifdef HAVE_INDI_H
#ifndef Q_WS_WIN
        actionCollection()->addAction("ekos", this, SLOT( slotEkos() ) )
            << i18n("Ekos");
#endif
#endif

//FIXME: implement glossary
//     ka = actionCollection()->addAction("glossary");
//     ka->setText( i18n("Glossary...") );
//     ka->setShortcuts( KShortcut(Qt::CTRL+Qt::Key_K ) );
//     connect( ka, SIGNAL( triggered() ), this, SLOT( slotGlossary() ) );

    actionCollection()->addAction("scriptbuilder", this, SLOT( slotScriptBuilder() ) )
        << i18n("Script Builder")
        << KShortcut(Qt::CTRL+Qt::Key_B );
    actionCollection()->addAction("solarsystem", this, SLOT( slotSolarSystem() ) )
        << i18n("Solar System")
        << KShortcut(Qt::CTRL+Qt::Key_Y );
    actionCollection()->addAction("jmoontool", this, SLOT( slotJMoonTool() ) )
        << i18n("Jupiter's Moons")
        << KShortcut(Qt::CTRL+Qt::Key_J );
    actionCollection()->addAction("flagmanager", this, SLOT( slotFlagManager() ) )
        << i18n("Flags");

    actionCollection()->addAction("ewriter", this, SLOT( slotEquipmentWriter() ) )
        << i18n("Define Equipment...")
        << KShortcut( Qt::CTRL+Qt::Key_0 );
    actionCollection()->addAction("obsadd", this, SLOT( slotObserverAdd() ) )
        << i18n( "Add Observer..." )
        << KShortcut( Qt::CTRL+Qt::Key_1 );

    // ==== observation menu ================
    ka = actionCollection()->addAction("execute", this, SLOT( slotExecute() ) )
        << i18n( "Execute the session Plan..." )
        << KShortcut( Qt::CTRL+Qt::Key_2 );

    // ==== devices Menu ================
#ifdef HAVE_INDI_H
#ifndef Q_WS_WIN


        actionCollection()->addAction("telescope_wizard", this, SLOT( slotTelescopeWizard() ) )
            << i18n("Telescope Wizard...")
            << KIcon("tools-wizard" );
        actionCollection()->addAction("device_manager", this, SLOT( slotINDIDriver() ) )
            << i18n("Device Manager...")
            << KIcon("network-server" );
        ka = actionCollection()->addAction("indi_cpl", this, SLOT( slotINDIPanel() ) )
            << i18n("INDI Control Panel...");
        ka->setEnabled(false);


#endif
#endif

    //Help Menu:
    actionCollection()->addAction( KStandardAction::TipofDay, "help_tipofday", this, SLOT( slotTipOfDay() ) )
	->setWhatsThis(i18n("Displays the Tip of the Day"));

    //	KStandardAction::help(this, SLOT( appHelpActivated() ), actionCollection(), "help_contents" );

    //Add timestep widget for toolbar
    TimeStep = new TimeStepBox( toolBar("kstarsToolBar") );
    // Add a tool tip to TimeStep describing the weird nature of time steps
    QString TSBToolTip = i18nc( "Tooltip describing the nature of the time step control", "Use this to set the rate at which time in the simulation flows.\nFor time step \'X\' up to 10 minutes, time passes at the rate of \'X\' per second.\nFor time steps larger than 10 minutes, frames are displayed at an interval of \'X\'." );
    TimeStep->setToolTip( TSBToolTip );
    TimeStep->tsbox()->setToolTip( TSBToolTip );
    ka = actionCollection()->addAction("timestep_control")
        << i18n("Time step control");
    ka->setDefaultWidget( TimeStep );

    // ==== viewToolBar actions ================
    actionCollection()->add<KToggleAction>("show_stars", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Stars in the display", "Stars" )
        << KIcon("kstars_stars" )
        << ToolTip( i18n("Toggle stars") );
    actionCollection()->add<KToggleAction>("show_deepsky", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Deep Sky Objects in the display", "Deep Sky" )
        << KIcon("kstars_deepsky" )
        << ToolTip( i18n("Toggle deep sky objects") );
    actionCollection()->add<KToggleAction>("show_planets", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Solar System objects in the display", "Solar System" )
        << KIcon("kstars_planets" )
        << ToolTip( i18n("Toggle Solar system objects") );
    actionCollection()->add<KToggleAction>("show_clines", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Constellation Lines in the display", "Const. Lines" )
        << KIcon("kstars_clines" )
        << ToolTip( i18n("Toggle constellation lines") );
    actionCollection()->add<KToggleAction>("show_cnames", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Constellation Names in the display", "Const. Names" )
        << KIcon("kstars_cnames" )
        << ToolTip( i18n("Toggle constellation names") );
    actionCollection()->add<KToggleAction>("show_cbounds", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Constellation Boundaries in the display", "C. Boundaries" )
        << KIcon("kstars_cbound" )
        << ToolTip( i18n("Toggle constellation boundaries") );
    actionCollection()->add<KToggleAction>("show_mw", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Milky Way in the display", "Milky Way" )
        << KIcon("kstars_mw" )
        << ToolTip( i18n("Toggle milky way") );
    actionCollection()->add<KToggleAction>("show_equatorial_grid", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Equatorial Coordinate Grid in the display", "Equatorial coord. grid" )
        << KIcon("kstars_grid" )
        << ToolTip( i18n("Toggle equatorial coordinate grid") );
    actionCollection()->add<KToggleAction>("show_horizontal_grid", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle Horizontal Coordinate Grid in the display", "Horizontal coord. grid" )
        << KIcon("kstars_hgrid" )
        << ToolTip( i18n("Toggle horizontal coordinate grid") );
    actionCollection()->add<KToggleAction>("show_horizon", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle the opaque fill of the ground polygon in the display", "Ground" )
        << KIcon("kstars_horizon" )
        << ToolTip( i18n("Toggle opaque ground") );
    actionCollection()->add<KToggleAction>("show_flags", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle flags in the display", "Flags" )
        << KIcon("kstars_flag" )
        << ToolTip( i18n("Toggle flags") );
    actionCollection()->add<KToggleAction>("show_satellites", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle satellites in the display", "Satellites" )
        << KIcon("kstars_satellites" )
        << ToolTip( i18n("Toggle satellites") );
    actionCollection()->add<KToggleAction>("show_supernovae", this, SLOT( slotViewToolBar() ) )
        << i18nc("Toggle supernovae in the display", "Supernovae" )
        << KIcon("kstars_supernovae" )
        << ToolTip( i18n("Toggle supernovae") );

    setXMLFile("kstarsui.rc" );

    if (Options::fitsDir().isEmpty())
        Options::setFitsDir(QDir:: homePath());
}
Exemplo n.º 11
0
void StandGrapher::createGui()
{
    //--------------------------------------------------
    // Universal button creator for the navigation bars
    //--------------------------------------------------
    class ButtonCreator
    {
    public:
        static QPushButton * create(QWidget * parent, const QString & objName, const QIcon & icon,
            const QKeySequence & key, QString toolTip, QWidget * target, const char * slot)
        {
            QPushButton * button = new QPushButton(parent);
            button->setObjectName(objName);
            button->setFocusPolicy(Qt::NoFocus);
            connect(button, SIGNAL(pressed()), target, slot);

            button->setIconSize(QSize(32, 32));
            button->setIcon(QIcon(icon));

            if (!key.isEmpty())
                toolTip += " " + tr("(Shortcut: <b>%1</b>)").arg(key.toString());
            button->setToolTip(toolTip);

            QShortcut * shortcut = new QShortcut(key, target);
            connect(shortcut, SIGNAL(activated()), target, slot);

            return button;
        }
    };

    QList<QPushButton *> buttons;

    //-------------------------------------------
    // Horizontal tool box
    //-------------------------------------------

    hToolBox = new QFrame(this);
    hToolBox->setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
    hToolBox->setAutoFillBackground(true);
    hToolBox->setCursor(Qt::ArrowCursor);
    hToolBox->installEventFilter(this);

    // Create buttons
    buttons << ButtonCreator::create(hToolBox, "Start_button", QIcon(":/start.png"),
        Qt::Key_Home, tr("Start"), this, SLOT(slotStart()));
    buttons << ButtonCreator::create(hToolBox, "Prev_button", QIcon(":/previous.png"),
        Qt::Key_Left, tr("Previous"), this, SLOT(slotPrevious()));
    buttons << ButtonCreator::create(hToolBox, "HFit_button", QIcon(":/fit.png"),
        QKeySequence(), tr("Fit horizontally"), this, SLOT(slotFit()));
    buttons << ButtonCreator::create(hToolBox, "Next_button", QIcon(":/next.png"),
        Qt::Key_Right, tr("Next"), this, SLOT(slotNext()));
    buttons << ButtonCreator::create(hToolBox, "Finish_button", QIcon(":/finish.png"),
        Qt::Key_End, tr("End"), this, SLOT(slotEnd()));
    buttons << ButtonCreator::create(hToolBox, "HZoomIn_button", QIcon(":/plus.png"),
        Qt::Key_Plus, tr("Wider"), this, SLOT(slotZoomIn()));
    buttons << ButtonCreator::create(hToolBox, "HZoomOut_button", QIcon(":/minus.png"),
        Qt::Key_Minus, tr("Narrower"), this, SLOT(slotZoomOut()));

    // Layout buttons
    QHBoxLayout * hLayout = new QHBoxLayout(hToolBox);
    foreach(QPushButton * button, buttons)
        hLayout->addWidget(button);
    hToolBox->setLayout(hLayout);

    //-------------------------------------------
    // Vertical tool box
    //-------------------------------------------

    vToolBox = new QFrame(this);
    vToolBox->setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
    vToolBox->setAutoFillBackground(true);
    vToolBox->setCursor(Qt::ArrowCursor);
    vToolBox->installEventFilter(this);

    buttons.clear();
    buttons << ButtonCreator::create(vToolBox, "Up_button", QIcon(":/up.png"),
        Qt::Key_Up, tr("Up"), this, SLOT(slotUp()));
    buttons << ButtonCreator::create(vToolBox, "VFit_button", QIcon(":/fit_vert.png"),
        QKeySequence(), tr("Fit vertically"), this, SLOT(slotVFit()));
    buttons << ButtonCreator::create(vToolBox, "Down_button", QIcon(":/down.png"),
        Qt::Key_Down, tr("Down"), this, SLOT(slotDown()));
    buttons << ButtonCreator::create(vToolBox, "VZoomIn_button", QIcon(":/plus.png"),
        Qt::SHIFT+Qt::Key_Plus, tr("Wider"), this, SLOT(slotVZoomIn()));
    buttons << ButtonCreator::create(vToolBox, "VZoomOut_button", QIcon(":/minus.png"),
        Qt::SHIFT+Qt::Key_Minus, tr("Narrower"), this, SLOT(slotVZoomOut()));

    // Layout buttons
    QVBoxLayout * vLayout = new QVBoxLayout(vToolBox);
    foreach(QPushButton * button, buttons)
        vLayout->addWidget(button);
    vToolBox->setLayout(vLayout);

    //-------------------------------------------
    // Tool Box
    //-------------------------------------------

    toolBox = new QFrame(this);
    toolBox->setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
    toolBox->setAutoFillBackground(true);
    toolBox->setCursor(Qt::ArrowCursor);
    toolBox->installEventFilter(this);

    buttons.clear();

    // Filter button
    filterButton = new QPushButton(toolBox);
    filterButton->setIcon(QIcon(":/filter.png"));
    filterButton->setCheckable(true);
    filterButton->setShortcut(Qt::Key_F);
    filterButton->setToolTip(tr("Filter window"));
    connect(filterButton, SIGNAL(released()), this, SLOT(slotFilterWindow()));
    buttons << filterButton;

    filterWindow = new ParamsFilterWidget(this);

    connect(filterWindow, SIGNAL( modelChanged(Stand_trace_model::Ptr) ),
        this, SLOT( setModel(Stand_trace_model::Ptr) ));

    connect(filterWindow, SIGNAL(windowClosed()),
        filterButton, SLOT(toggle()));

    // Drawing lines option
    drawLinesButton = new QPushButton(toolBox);
    drawLinesButton->setIcon(QIcon(":/draw_lines.png"));
    drawLinesButton->setCheckable(true);
    drawLinesButton->setChecked(true);
    drawLinesButton->setShortcut(Qt::Key_L);
    drawLinesButton->setToolTip(tr("Draw lines"));
    connect(drawLinesButton, SIGNAL(released()), this, SLOT(slotDrawLineSwither()));
    buttons << drawLinesButton;

    // Antialiasing option
    antialiasingButton = new QPushButton(toolBox);
    antialiasingButton->setIcon(QIcon(":/antialiasing.png"));
    antialiasingButton->setCheckable(true);
    antialiasingButton->setChecked(antialiasing);
    antialiasingButton->setShortcut(Qt::Key_A);
    antialiasingButton->setToolTip(tr("Antialiasing"));
    connect(antialiasingButton, SIGNAL(clicked(bool)), this, SLOT(slotAntialiasingSwither(bool)));
    buttons << antialiasingButton;

    // Print button
    printButton = new QPushButton(toolBox);
    printButton->setIcon(QIcon(":/printer.png"));
    printButton->setShortcut(Qt::Key_P);
    printButton->setToolTip(tr("Print"));
    connect(printButton, SIGNAL(released()), this, SLOT(slotPrintGraph()));
    buttons << printButton;

    // Setup buttons
    foreach (QPushButton * button, buttons) {
        button->setIconSize(QSize(16, 16));
        button->setFocusPolicy(Qt::NoFocus);
        button->setToolTip(button->toolTip() + " " +
            tr("(Shortcut: <b>%1</b>)").arg(button->shortcut().toString()));
    }
Exemplo n.º 12
0
void SkyMap::mouseMoveEvent( QMouseEvent *e ) {
    if ( Options::useHoverLabel() ) {
        //Start a single-shot timer to monitor whether we are currently hovering.
        //The idea is that whenever a moveEvent occurs, the timer is reset.  It
        //will only timeout if there are no move events for HOVER_INTERVAL ms
        m_HoverTimer.start( HOVER_INTERVAL );
        QToolTip::hideText();
    }

    //Are we defining a ZoomRect?
    if ( ZoomRect.center().x() > 0 && ZoomRect.center().y() > 0 ) {
        //cancel operation if the user let go of CTRL
        if ( !( e->modifiers() & Qt::ControlModifier ) ) {
            ZoomRect = QRect(); //invalidate ZoomRect
            update();
        } else {
            //Resize the rectangle so that it passes through the cursor position
            QPoint pcenter = ZoomRect.center();
            int dx = abs(e->x() - pcenter.x());
            int dy = abs(e->y() - pcenter.y());
            if ( dx == 0 || float(dy)/float(dx) > float(height())/float(width()) ) {
                //Size rect by height
                ZoomRect.setHeight( 2*dy );
                ZoomRect.setWidth( 2*dy*width()/height() );
            } else {
                //Size rect by height
                ZoomRect.setWidth( 2*dx );
                ZoomRect.setHeight( 2*dx*height()/width() );
            }
            ZoomRect.moveCenter( pcenter ); //reset center

            update();
            return;
        }
    }

    if ( projector()->unusablePoint( e->pos() ) ) return;  // break if point is unusable

    //determine RA, Dec of mouse pointer
    m_MousePoint = projector()->fromScreen( e->pos(), data->lst(), data->geo()->lat() );

    double dyPix = 0.5*height() - e->y();
    if ( midMouseButtonDown ) { //zoom according to y-offset
        float yoff = dyPix - y0;
        if (yoff > 10 ) {
            y0 = dyPix;
            slotZoomIn();
        }
        if (yoff < -10 ) {
            y0 = dyPix;
            slotZoomOut();
        }
    }

    if ( mouseButtonDown ) {
        // set the mouseMoveCursor and set slewing=true, if they are not set yet
        if( !mouseMoveCursor )
            setMouseMoveCursor();
        if( !slewing ) {
            slewing = true;
            stopTracking(); //toggle tracking off
        }

        //Update focus such that the sky coords at mouse cursor remain approximately constant
        if ( Options::useAltAz() ) {
            m_MousePoint.EquatorialToHorizontal( data->lst(), data->geo()->lat() );
            clickedPoint()->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
            dms dAz  = m_MousePoint.az()  - clickedPoint()->az();
            dms dAlt = m_MousePoint.alt() - clickedPoint()->alt();
            focus()->setAz( focus()->az().Degrees() - dAz.Degrees() ); //move focus in opposite direction
            focus()->setAz( focus()->az().reduce() );
            focus()->setAlt(
                KSUtils::clamp( focus()->alt().Degrees() - dAlt.Degrees() , -90.0 , 90.0 ) );
            focus()->HorizontalToEquatorial( data->lst(), data->geo()->lat() );
        } else {
            dms dRA  = m_MousePoint.ra()  - clickedPoint()->ra();
            dms dDec = m_MousePoint.dec() - clickedPoint()->dec();
            focus()->setRA( focus()->ra().Hours() - dRA.Hours() ); //move focus in opposite direction
            focus()->setRA( focus()->ra().reduce() );
            focus()->setDec(
                KSUtils::clamp( focus()->dec().Degrees() - dDec.Degrees() , -90.0 , 90.0 ) );
            focus()->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
        }
        showFocusCoords();

        //redetermine RA, Dec of mouse pointer, using new focus
        m_MousePoint = projector()->fromScreen( e->pos(), data->lst(), data->geo()->lat() );
        setClickedPoint( &m_MousePoint );

        forceUpdate();  // must be new computed

    } else { //mouse button not down
        emit mousePointChanged( &m_MousePoint );
    }
}
HelpWidget::HelpWidget(QWidget * par, bool bIsStandalone)
: QWidget(par)
{
	setObjectName("help_widget");
	setMinimumWidth(80);
	if(bIsStandalone)g_pHelpWidgetList->append(this);
	m_bIsStandalone = bIsStandalone;

	new QShortcut(QKeySequence::Copy,this,SLOT(slotCopy()),0,Qt::WidgetWithChildrenShortcut);
	new QShortcut(QKeySequence::Find,this,SLOT(slotShowHideFind()),0, bIsStandalone ? Qt::WidgetWithChildrenShortcut : Qt::WindowShortcut);

	// layout
	m_pLayout = new QVBoxLayout(this);
	m_pLayout->setMargin(0);
	m_pLayout->setSpacing(0);
	setLayout(m_pLayout);

	// upper toolbar
	m_pToolBar = new QToolBar(this);
	m_pLayout->addWidget(m_pToolBar);

	// webview
	m_pTextBrowser = new QWebView(this);
	m_pTextBrowser->setObjectName("text_browser");
	m_pTextBrowser->setStyleSheet("QTextBrowser { background-color:white; color:black; }");
	m_pLayout->addWidget(m_pTextBrowser);
	connect(m_pTextBrowser,SIGNAL(loadFinished(bool)),this,SLOT(slotLoadFinished(bool)));
	
	// lower toolbar
	m_pToolBarHighlight = new QToolBar(this);
	m_pLayout->addWidget(m_pToolBarHighlight);
	m_pToolBarHighlight->hide();
	
	QLabel *pHighlightLabel = new QLabel();
	pHighlightLabel->setText(__tr2qs("Highlight: "));
	m_pToolBarHighlight->addWidget(pHighlightLabel);

	m_pFindText = new QLineEdit();
	m_pToolBarHighlight->addWidget(m_pFindText);
	connect(m_pFindText,SIGNAL(textChanged(const QString )),this,SLOT(slotTextChanged(const QString)));

	m_pToolBarHighlight->addAction(*g_pIconManager->getSmallIcon(KviIconManager::Unrecognized), __tr2qs("Reset"), this, SLOT(slotResetFind()));
	m_pToolBarHighlight->addAction(*g_pIconManager->getSmallIcon(KviIconManager::Part), __tr2qs("Find previous"), this, SLOT(slotFindPrev()));
	m_pToolBarHighlight->addAction(*g_pIconManager->getSmallIcon(KviIconManager::Join), __tr2qs("Find next"), this, SLOT(slotFindNext()));

	// upper toolbar contents (depends on webview)
	QLabel *pBrowsingLabel = new QLabel();
	pBrowsingLabel->setText(__tr2qs("Browsing: "));
	m_pToolBar->addWidget(pBrowsingLabel);

	m_pToolBar->addAction(*g_pIconManager->getBigIcon(KVI_BIGICON_HELPINDEX), __tr2qs("Show index"), this, SLOT(showIndex()));

	m_pToolBar->addAction(m_pTextBrowser->pageAction(QWebPage::Back));
	m_pToolBar->addAction(m_pTextBrowser->pageAction(QWebPage::Forward));

	m_pToolBar->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Plus)), __tr2qs("Zoom in"), this, SLOT(slotZoomIn()));
	m_pToolBar->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Minus)), __tr2qs("Zoom out"), this, SLOT(slotZoomOut()));

	if(bIsStandalone)
	{
		setAttribute(Qt::WA_DeleteOnClose);
		m_pToolBar->addAction(*g_pIconManager->getBigIcon(KVI_BIGICON_HELPCLOSE), __tr2qs("Close"), this, SLOT(close()));
	}

}
Exemplo n.º 14
0
// private
void kpMainWindow::setupViewMenuActions ()
{
    m_viewMenuDocumentActionsEnabled = false;
    m_thumbnailSaveConfigTimer = 0;


    KActionCollection *ac = actionCollection ();

    /*m_actionFullScreen = KStdAction::fullScreen (0, 0, ac);
    m_actionFullScreen->setEnabled (false);*/


    m_actionActualSize = KStdAction::actualSize (this, SLOT (slotActualSize ()), ac);
    /*m_actionFitToPage = KStdAction::fitToPage (this, SLOT (slotFitToPage ()), ac);
    m_actionFitToWidth = KStdAction::fitToWidth (this, SLOT (slotFitToWidth ()), ac);
    m_actionFitToHeight = KStdAction::fitToHeight (this, SLOT (slotFitToHeight ()), ac);*/


    m_actionZoomIn = KStdAction::zoomIn (this, SLOT (slotZoomIn ()), ac);
    m_actionZoomOut = KStdAction::zoomOut (this, SLOT (slotZoomOut ()), ac);


    m_actionZoom = new KSelectAction (i18n ("&Zoom"), 0,
        this, SLOT (slotZoom ()), actionCollection (), "view_zoom_to");
    m_actionZoom->setEditable (true);

    // create the zoom list for the 1st call to zoomTo() below
    m_zoomList.append (10); m_zoomList.append (25); m_zoomList.append (33);
    m_zoomList.append (50); m_zoomList.append (67); m_zoomList.append (75);
    m_zoomList.append (100);
    m_zoomList.append (200); m_zoomList.append (300);
    m_zoomList.append (400); m_zoomList.append (600); m_zoomList.append (800);
    m_zoomList.append (1000); m_zoomList.append (1200); m_zoomList.append (1600);


    m_actionShowGrid = new KToggleAction (i18n ("Show &Grid"), CTRL + Key_G,
        this, SLOT (slotShowGridToggled ()), actionCollection (), "view_show_grid");
    m_actionShowGrid->setCheckedState (i18n ("Hide &Grid"));


    // TODO: This doesn't work when the thumbnail has focus.
    //       Testcase: Press CTRL+H twice on a fresh KolourPaint.
    //                 The second CTRL+H doesn't close the thumbnail.
    m_actionShowThumbnail = new KToggleAction (i18n ("Show T&humbnail"), CTRL + Key_H,
        this, SLOT (slotShowThumbnailToggled ()), actionCollection (), "view_show_thumbnail");
    m_actionShowThumbnail->setCheckedState (i18n ("Hide T&humbnail"));

    // Please do not use setCheckedState() here - it wouldn't make sense
    m_actionZoomedThumbnail = new KToggleAction (i18n ("Zoo&med Thumbnail Mode"), 0,
        this, SLOT (slotZoomedThumbnailToggled ()), actionCollection (), "view_zoomed_thumbnail");

    // For consistency with the above action, don't use setCheckedState()
    //
    // Also, don't use "Show Thumbnail Rectangle" because if entire doc
    // can be seen in scrollView, checking option won't "Show" anything
    // since rect _surrounds_ entire doc (hence, won't be rendered).
    d->m_actionShowThumbnailRectangle = new KToggleAction (
        i18n ("Enable Thumbnail &Rectangle"),
        0,
        this, SLOT (slotThumbnailShowRectangleToggled ()),
        actionCollection (), "view_show_thumbnail_rectangle");


    enableViewMenuDocumentActions (false);
}
Exemplo n.º 15
0
void Knmap::createMenu( )
{	KStdAction::configureToolbars( this, SLOT( slotConfigureToolbars( )), actionCollection( ));
	KStdAction::keyBindings( this, SLOT( slotConfigureShortcuts( )), actionCollection( ));
	KStdAction::quit( kapp, SLOT( quit( )), actionCollection( ));

	m_fileSaveAction = KStdAction::save( m_mainWidget,
										 SLOT( slotFileSave( )),
										 actionCollection( ));

	m_fileSaveAsAction = KStdAction::saveAs( m_mainWidget,
											 SLOT( slotFileSaveAs( )),
											 actionCollection( ));

	m_settingsManAction = new KAction( i18n( "&Use local man page" ),
										"localman.png",
										0,
										m_mainWidget,
										SLOT( slotSwitchManPages( )),
										actionCollection( ),
										"settings_local" );

	m_useTargetHostAction = new KToggleAction( i18n( "Use target host name" ),
											   NULL,
											   0,
											   m_mainWidget,
											   SLOT( slotUseTargetHost( )),
											   actionCollection( ),
											   "scan_use" );

	m_wrapTextAction = new KToggleAction( i18n( "Wrap text" ),
										  NULL,
										  0,
										  m_mainWidget,
										  SLOT( slotWrapText( )),
										  actionCollection( ),
										  "settings_wrap_text" );

	new KAction( i18n( "Close scan" ),
				 "scanclose",
				 CTRL+Key_W,
				 m_mainWidget,
				 SLOT( slotScanClose( )),
				 actionCollection( ),
				 "scan_close" );

	new KAction( i18n( "Copy profile..." ),
				 "profilecopy",
				 0,
				 m_mainWidget,
				 SLOT( slotProfileCopy( )),
				 actionCollection( ),
				 "profile_copy" );

	new KAction( i18n( "Delete profile..." ),
				 "profiledelete",
				 0,
				 m_mainWidget,
				 SLOT( slotProfileDelete( )),
				 actionCollection( ),
				 "profile_delete" );

	new KAction( i18n( "Display nmap man page" ),
				 "manpage",
				 0,
				 m_mainWidget,
				 SLOT( slotShowManPage( )),
				 actionCollection( ),
				 "help_man_page" );

	new KAction( i18n( "Duplicate scan" ),
				 "scanduplicate",
				 CTRL+Key_C,
				 m_mainWidget,
				 SLOT( slotScanDuplicate( )),
				 actionCollection( ),
				 "scan_duplicate" );

	new KAction( i18n( "Load profile..." ),
				 "profileload",
				 0,
				 m_mainWidget,
				 SLOT( slotProfileLoad( )),
				 actionCollection( ),
				 "profile_load" );

	new KAction( i18n( "man page stylesheet..." ),
				 "manstylesheet",
				 0,
				 m_mainWidget,
				 SLOT( slotSetStylesheet( )),
				 actionCollection( ),
				 "settings_stylesheet" );

	new KAction( i18n( "New scan..." ),
				 "scannew",
				 CTRL+Key_N,
				 m_mainWidget,
				 SLOT( slotScanNew( )),
				 actionCollection( ),
				 "scan_new" );

	new KAction( i18n( "Rename profile..." ),
				 "profilerename",
				 0,
				 m_mainWidget,
				 SLOT( slotProfileRename( )),
				 actionCollection( ),
				 "profile_rename" );

	new KAction( i18n( "Rename scan..." ),
				 "scanrename",
				 Key_F2,
				 m_mainWidget,
				 SLOT( slotScanRename( )),
				 actionCollection( ),
				 "scan_rename" );

	new KAction( i18n( "Save profile..." ),
				 "profilesave",
				 0,
				 m_mainWidget,
				 SLOT( slotProfileSave( )),
				 actionCollection( ),
				 "profile_save" );

	new KAction( i18n( "Save profile as..." ),
				 "profilesaveas",
				 0,
				 m_mainWidget,
				 SLOT( slotProfileSaveAs( )),
				 actionCollection( ),
				 "profile_save_as" );

	new KAction( i18n( "Zoom custom"  ),
				 "zoomcustom",
				 0,
				 m_mainWidget,
				 SLOT( slotZoomCustom( )),
				 actionCollection( ),
				 "settings_zoom_custom"  );

	new KAction( i18n( "Zoom in"  ),
				 "zoomin",
				 0,
				 m_mainWidget,
				 SLOT( slotZoomIn( )),
				 actionCollection( ),
				 "settings_zoom_in"  );

	new KAction( i18n( "Zoom out" ),
				 "zoomout",
				 0,
				 m_mainWidget,
				 SLOT( slotZoomOut( )),
				 actionCollection( ),
				 "settings_zoom_out" );

	m_fileSaveAction->setEnabled( false );
	m_fileSaveAsAction->setEnabled( false );
	m_wrapTextAction->setChecked( m_mainWidget->wrapText( ));

	createStandardStatusBarAction( );
	setStandardToolBarMenuEnabled( true );

#ifdef _DEBUG
	createGUI( QDir::homeDirPath( ) + "/.kde/share/apps/knmap/knmapui.rc" );
#else
	createGUI( );
#endif
}
Exemplo n.º 16
0
ClockPhotoDialog::ClockPhotoDialog(KIPI::Interface* interface, QWidget* parent)
                : KDialog(parent), d(new ClockPhotoDialogPrivate)
{
    d->interface     = interface;

    // Initialize the variables.
    d->image         = new QPixmap();
    d->photoDateTime = new QDateTime();
    deltaNegative    = false;
    deltaDays        = 0;
    deltaHours       = 0;
    deltaMinutes     = 0;
    deltaSeconds     = 0;

    // This dialog should be modal with three buttons: Ok, Cancel, and load
    // photo. For this third button, the User1 button from KDialog is used.
    // The Ok button is only enable when a photo is loaded.
    setCaption(i18n("Determine time difference with clock photo"));
    setButtons(User1 | Ok | Cancel);
    button(User1)->setText(i18n("Load different photo"));
    button(User1)->setIcon(KIcon("document-open"));
    button(Ok)->setEnabled(false);

    // Everything else is stacked in a vertical box.
    setMainWidget(new QWidget(this));
    QVBoxLayout *vBox = new QVBoxLayout(mainWidget());

    // Some explanation.
    QLabel *explanationLabel =
            new QLabel(i18n("If you have a photo in your set with a clock or "
                            "another external time source on it, you can load "
                            "it here and set the indicator to the (date and) "
                            "time displayed. The difference of your internal "
                            "camera clock will be determined from this "
                            "setting."));
    explanationLabel->setWordWrap(true);
    vBox->addWidget(explanationLabel);

    // The image is displayed by loading an ImageDisplay in the scroll area,
    // which is an overloaded QLabel. See the Image Viewer Example from the Qt
    // documentation (http://doc.trolltech.com/4.5/widgets-imageviewer.html).
    d->scrollArea = new QScrollArea(this);
    d->scrollArea->setBackgroundRole(QPalette::Window);
    d->scrollArea->setAlignment(Qt::AlignCenter);
    vBox->addWidget(d->scrollArea);

    d->imageLabel = new ImageDisplay(d->scrollArea);
    d->imageLabel->setBackgroundRole(QPalette::Base);
    d->imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
    d->imageLabel->setScaledContents(true);

    // The label is also used to display text (warning and waiting messages).
    d->imageLabel->setWordWrap(true);
    d->imageLabel->setAlignment(Qt::AlignCenter);
    d->scrollArea->setWidget(d->imageLabel);

    // For zooming support, a scale is displayed beneath the image with zoom out
    // and zoom in buttons.
    QLabel *scale_label = new QLabel(i18n("Scale:"));
    d->zoomOutButton    = new QPushButton(KIcon("zoom-out"), "");
    d->zoomInButton     = new QPushButton(KIcon("zoom-in"), "");
    d->zoomInButton->setFlat(true);
    d->zoomOutButton->setFlat(true);
    d->zoomSlider = new QSlider(Qt::Horizontal);
    d->zoomSlider->setRange(10, 150);
    QHBoxLayout *hBox1 = new QHBoxLayout(mainWidget());
    hBox1->addWidget(scale_label);
    hBox1->addWidget(d->zoomOutButton);
    hBox1->addWidget(d->zoomSlider);
    hBox1->addWidget(d->zoomInButton);
    vBox->addLayout(hBox1);
    d->zoomSlider->setEnabled(false);
    d->zoomOutButton->setEnabled(false);
    d->zoomInButton->setEnabled(false);

    // The date and time entry widget allows the user to enter the date and time
    // displayed in the image. The format is explicitly set, otherwise seconds
    // might not get displayed.
    QLabel *dtLabel = new QLabel(i18n("The clock date and time:"));
    d->calendar     = new QDateTimeEdit();
    d->calendar->setDisplayFormat("d MMMM yyyy, hh:mm:ss");
    d->calendar->setCalendarPopup(true);
    d->calendar->setEnabled(false);
    QHBoxLayout *hBox2 = new QHBoxLayout(mainWidget());
    hBox2->addStretch();
    hBox2->addWidget(dtLabel);
    hBox2->addWidget(d->calendar);
    vBox->addLayout(hBox2);

    // Setup the signals and slots.
    connect(this, SIGNAL(user1Clicked()),
            this, SLOT(slotLoadPhoto()));

    connect(d->zoomSlider, SIGNAL(sliderMoved(int)),
            this, SLOT(slotAdjustZoom(int)));

    connect(d->zoomOutButton, SIGNAL(clicked()),
            this, SLOT(slotZoomOut()));

    connect(d->zoomInButton, SIGNAL(clicked()),
            this, SLOT(slotZoomIn()));

    connect(this, SIGNAL(okClicked()),
            this, SLOT(slotOk()));

    connect(this, SIGNAL(cancelClicked()),
            this, SLOT(slotCancel()));

    // Show the window.
    KConfig config("kipirc");
    KConfigGroup group = config.group(QString("Clock Photo Dialog"));
    restoreDialogSize(group);
    show();

    // Upon initialization, present the user with a photo loading dialog. This
    // is done before the main dialog is drawn.
    slotLoadPhoto();
}
Exemplo n.º 17
0
    m_cs.addShortcut("a", Abort, tr("Abort move"));
    m_cs.addShortcut("a-s", Abort_Selection, tr("Unselect all"));
    m_cs.addShortcut("d-n", Delete_Node, tr("Delete selected nodes"));
    m_cs.addShortcut("t-s", Tool_Select, tr("Selecting tool"));
    m_cs.addShortcut("t-m", Tool_Move, tr("Move tool"));
    m_cs.addShortcut("t-t", Tag, tr("Insert label (tag)"));

    bool b = true;
    b &= connect(&m_cs, SIGNAL(signalShortcutUsed(int)), this, SLOT(slotShortcutUsed(int)));

    b &= connect(this, SIGNAL(deleteNodes()), m_wCanvas, SLOT(slotDeleteNodes()));
    b &= connect(this, SIGNAL(setMode(Canvas::ToolMode)), m_wCanvas, SLOT(slotSetToolMode(Canvas::ToolMode)));
    b &= connect(this, SIGNAL(abort(Canvas::Abort)), m_wCanvas, SLOT(slotAbort(Canvas::Abort)));
    b &= connect(this, SIGNAL(addTag()), m_wCanvas, SLOT(slotAddTag()));

    b &= connect(ui->actionZoomIn, SIGNAL(triggered()), m_wCanvas, SLOT(slotZoomIn()));
    b &= connect(ui->actionZoomOut, SIGNAL(triggered()), m_wCanvas, SLOT(slotZoomOut()));

    b &= connect(m_wCanvas, SIGNAL(signalMouseInputTimeChanged(qreal)),
                 this, SLOT(slotForwardInputPosition(qreal)));
    b &= connect(m_wCanvas, SIGNAL(signalMouseCurveSrcTimeChanged(qreal)),
                 this, SLOT(slotForwardCurveSrcPosition(qreal)));

    b &= connect(ui->actionNew, SIGNAL(triggered()), this, SLOT(slotNewProject()));
    b &= connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(slotLoadProjectDialog()));
    b &= connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(slotSaveProject()));
    b &= connect(ui->actionSave_as, SIGNAL(triggered()), this, SLOT(slotSaveProjectDialog()));
    b &= connect(ui->actionRender, SIGNAL(triggered()), this, SLOT(slotShowRenderDialog()));
    b &= connect(ui->actionRenderPreview, SIGNAL(triggered()), this, SLOT(slotUpdateRenderPreview()));
    b &= connect(ui->actionExamineFlow, SIGNAL(triggered()), this, SLOT(slotShowFlowExaminerDialog()));
    b &= connect(ui->actionPreferences, SIGNAL(triggered()), this, SLOT(slotShowPreferencesDialog()));