예제 #1
0
void OpenCalaisTextMatchPlugin::doGetPossibleMatches( const QString& text )
{
    kDebug();
    // cancel previous jobs
    delete m_lookupJob;
    m_lookupJob = 0;

    if ( OpenCalais::Config::licenseKey().isEmpty() ) {
        kDebug() << "no key";
        if ( OpenCalais::Config::showKeyWarning() ) {
            KNotification* n = KNotification::event( KNotification::Warning,
                               i18n( "No OpenCalais API key configured." ) );
            n->setActions( QStringList() << i18n( "Configure..." ) );
            connect( n, SIGNAL( action1Activated() ), this, SLOT( slotConfigure() ) );
            OpenCalais::Config::self()->findItem( "ShowKeyWarning" )->setProperty( false );
            OpenCalais::Config::self()->writeConfig();
        }
        emitFinished();
    }
    else {
        // do the lookup
        m_lookupJob = new OpenCalais::LookupJob( this );
        connect( m_lookupJob, SIGNAL( result( KJob* ) ),
                 this, SLOT( slotResult( KJob* ) ) );
        m_lookupJob->setContent( text );
        m_lookupJob->start();
    }
}
예제 #2
0
void EditViewBase::setupBaseActions(bool haveClipboard)
{
    // Actions all edit views will have

//    createAction("options_show_toolbar", SLOT(slotToggleToolBar()));
    createAction("options_show_statusbar", SLOT(slotToggleStatusBar()));
    createAction("options_configure", SLOT(slotConfigure()));
//    createAction("options_configure_keybindings", SLOT(slotEditKeys()));
//    createAction("options_configure_toolbars", SLOT(slotEditToolbars()));

    createAction("file_save", SIGNAL(saveFile()));
    createAction("file_close", SLOT(slotCloseWindow()));

    if (haveClipboard) {
        createAction("edit_cut", SLOT(slotEditCut()));
        createAction("edit_copy", SLOT(slotEditCopy()));
        createAction("edit_paste", SLOT(slotEditPaste()));
    }

    createAction("open_in_matrix", SLOT(slotOpenInMatrix()));
    createAction("open_in_percussion_matrix", SLOT(slotOpenInPercussionMatrix()));
    createAction("open_in_notation", SLOT(slotOpenInNotation()));
    createAction("open_in_event_list", SLOT(slotOpenInEventList()));
    createAction("open_in_pitch_tracker", SLOT(slotOpenInPitchTracker()));
    createAction("set_segment_start", SLOT(slotSetSegmentStartTime()));
    createAction("set_segment_duration", SLOT(slotSetSegmentDuration()));
}
예제 #3
0
파일: kscope.cpp 프로젝트: VicHao/kkscope
/**
 * Reports the results of the Cscope verification script.
 * This slot is connected to the done() signal emitted by the CscopeVerifier
 * object constructed in verifyCscope().
 */
void KScope::slotCscopeVerified(bool bResult, uint nArgs)
{
	statusBar()->message(i18n("Verifying Cscope installation...Done"), 3000);
	
	// Mark the flag even if Cscope was not found, to avoid nagging the user
	// (who may wish to use KScope even with Cscope disabled)
	m_bCscopeVerified = true;

	// Prompt the user in case Cscope is not properly installed
	if (!bResult) {
		KMessageBox::error(0, i18n("Cscope may not be properly installed on "
			"this system.\nPlease check the Cscope path specified in KScope's "
			"configuration dialogue."));
		slotConfigure();
		return;
	}
		
	// Set the discoverred supported command-line arguments
	CscopeFrontend::setSupArgs(nArgs);
	
	// Build the database, if required
	if (m_bRebuildDB) {
		m_bRebuildDB = false;
		slotRebuildDB();
	}
}
예제 #4
0
void UIServer::slotShowContextMenu(KListView *, QListViewItem *item, const QPoint &pos)
{
    if(m_contextMenu == 0)
    {
        m_contextMenu = new QPopupMenu(this);
        m_idCancelItem = m_contextMenu->insertItem(i18n("Cancel Job"), this, SLOT(slotCancelCurrent()));
        //      m_contextMenu->insertItem(i18n("Toggle Progress"), this, SLOT(slotToggleDefaultProgress()));
        m_contextMenu->insertSeparator();
        m_contextMenu->insertItem(i18n("Settings..."), this, SLOT(slotConfigure()));
    }
    if(item)
        item->setSelected(true);
    bool enabled = false;
    QListViewItemIterator it(listProgress);
    for(; it.current(); ++it)
    {
        if(it.current()->isSelected())
        {
            enabled = true;
            break;
        }
    }
    m_contextMenu->setItemEnabled(m_idCancelItem, enabled);

    m_contextMenu->popup(pos);
}
예제 #5
0
void KSlovar::registerButtons()
{
  m_newDictionary = new KAction(i18n("&New dictionary"), "filenew", KShortcut(KKey("CTRL+n")), this, SLOT(slotNewDictionary()), actionCollection(), "newDictionary");
  m_openDictionary = KStdAction::open(this, SLOT(slotFileOpen()), actionCollection());
  m_quit = KStdAction::quit(kapp, SLOT(quit()), actionCollection());

  m_back=KStdAction::back(this, SLOT(slotPrevPhrase()), actionCollection());
  m_forward=KStdAction::forward(this, SLOT(slotNextPhrase()), actionCollection());
  m_home=KStdAction::home(this, SLOT(slotHome()), actionCollection());

  m_editDictionary = new KAction(i18n("&Edit dictionary"), "edit", KShortcut(KKey("CTRL+e")), this, SLOT(slotEditDictionary()), actionCollection(), "editDictionary");
  m_close=KStdAction::close(this, SLOT(slotClose()), actionCollection());

  m_find = KStdAction::find(this, SLOT(slotFind()), actionCollection());
  m_findNext = KStdAction::findNext(this, SLOT(slotFindNext()), actionCollection());
  m_literalSearch = new KToggleAction(i18n("&Literal search"), "filter", KShortcut(KKey("CTRL+l")), this, SLOT(slotToggleLiteral()), actionCollection(), "literalSearch");
  m_backSearch = new KToggleAction(i18n("Ba&ck search"), "previous", KShortcut(KKey("CTRL+b")), this, SLOT(slotToggleBack()), actionCollection(), "backSearch");

  m_print=KStdAction::print(this, SLOT(slotPrint()), actionCollection());
  m_selectAll=KStdAction::selectAll(this, SLOT(slotSelectAll()), actionCollection());

  m_addPhrase=new KAction(i18n("&Add phrase"), "filenew", KShortcut(KKey("CTRL+a")), this, SLOT(slotAddPhrase()), actionCollection(), "addPhrase");
  m_editPhrase=new KAction(i18n("Edi&t phrase"), "edit", KShortcut(KKey("CTRL+t")), this, SLOT(slotEditPhrase()), actionCollection(), "editPhrase");
  m_removePhrase=new KAction(i18n("&Remove phrase"), "editdelete", KShortcut(KKey("Delete")), this, SLOT(slotRemovePhrase()), actionCollection(), "removePhrase");

  m_listPopup=new QPopupMenu;
  m_addPhrase->plug(m_listPopup);
  m_editPhrase->plug(m_listPopup);
  m_removePhrase->plug(m_listPopup);

  m_config = KStdAction::preferences(this, SLOT(slotConfigure()), actionCollection());
  m_conversion = new KAction(i18n("Edit &conversion table"), "conversion", this, SLOT(slotConversionTable()), actionCollection(), "editConversion");
  m_update = new KAction(i18n("Update &languages"), "ktalkd", KShortcut(KKey("")), this, SLOT(slotDownloadLanguage()), actionCollection(), "updateLanguages");
  m_wizard = new KAction(i18n("Run &First-time wizard"), "wizard", KShortcut(KKey("")), this, SLOT(slotFirstRunWizard()), actionCollection(), "firstRunWizard");
}
예제 #6
0
DriverConfigTab::DriverConfigTab(QWidget* parent)
    : ConfigTab(parent, "DriverConfig")
{
    _drivers = new ListView(this);
    _drivers->setAllColumnsShowFocus(true);
    _drivers->setShowSortIndicator(true);
    _drivers->addTextColumn(tr("Driver Name"), 50);

    QFrame* funcs = new QFrame(this);
    QPushButton* config = new QPushButton(tr("Configure"), funcs);

    QGridLayout* funcGrid = new QGridLayout(funcs);
    funcGrid->setSpacing(2);
    funcGrid->setMargin(2);
    funcGrid->setRowStretch(1, 1);
    funcGrid->addWidget(config, 0, 0);

    QGridLayout* grid = new QGridLayout(this);
    grid->setSpacing(3);
    grid->setMargin(3);
    grid->setColStretch(0, 1);
    grid->addWidget(_drivers, 0, 0);
    grid->addWidget(funcs, 0, 1);

    connect(config, SIGNAL(clicked()), SLOT(slotConfigure()));
}
예제 #7
0
QuickLauncher::QuickLauncher(const TQString& configFile, Type type, int actions,
                             TQWidget *parent, const char *name) : 
    KPanelApplet(configFile, type, actions, parent, name)
{
    DCOPObject::setObjId("QuickLauncherApplet");
    DEBUGSTR << endl << endl << endl << "------------" << flush;
    DEBUGSTR << "QuickLauncher::QuickLauncher(" << configFile << ",...)" <<
                endl << flush;

    m_settings = new Prefs(sharedConfig());
    m_settings->readConfig();

    m_needsSave = false;
    m_needsRefresh = false;
    m_refreshEnabled = false;

    m_configDialog = 0;
    m_popup = 0;
    m_appletPopup = 0;
    m_removeAppsMenu = 0;

    m_dragAccepted = false;

    m_buttons = new ButtonGroup;
    m_manager = new FlowGridManager;
    m_newButtons = 0;
    m_oldButtons = 0;
    m_dragButtons = 0;

    m_configAction = new TDEAction(i18n("Configure Quicklauncher..."), "configure", TDEShortcut(),
        TQT_TQOBJECT(this), TQT_SLOT(slotConfigure()), TQT_TQOBJECT(this));

    m_saveTimer = new TQTimer(this, "m_saveTimer");
    connect(m_saveTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(saveConfig()));

    m_popularity = new PopularityStatistics();

    setBackgroundOrigin(AncestorOrigin);

    loadConfig();

    buildPopupMenu();
    m_minPanelDim = std::max(16, m_settings->iconDimChoices()[1]);
    refreshContents();
    setRefreshEnabled(true);

    setAcceptDrops(true);
    //TQToolTip::add(this, i18n("Drop applications here"));
    DEBUGSTR << "    QuickLauncher::QuickLauncher(" << configFile << 
                ",...) END" << endl << flush;

    DCOPClient *dcopClient = TDEApplication::dcopClient();
    dcopClient->connectDCOPSignal(0, "appLauncher", 
        "serviceStartedByStorageId(TQString,TQString)",
        "QuickLauncherApplet",
        "serviceStartedByStorageId(TQString,TQString)",
        false);
    kdDebug() << "Quicklauncher registered DCOP signal" << endl;
}
예제 #8
0
 UIServerSystemTray(UIServer *uis) : KSystemTray(uis)
 {
     KPopupMenu *pop = contextMenu();
     pop->insertItem(i18n("Settings..."), uis, SLOT(slotConfigure()));
     pop->insertItem(i18n("Remove"), uis, SLOT(slotRemoveSystemTrayIcon()));
     setPixmap(loadIcon("filesave"));
     // actionCollection()->action("file_quit")->setEnabled(true);
     KStdAction::quit(uis, SLOT(slotQuit()), actionCollection());
 }
예제 #9
0
파일: kfmserver.cpp 프로젝트: xwizard/kde1
void KFMClient::slotAuth( const char *_password )
{
    if ( KFMClient::password == 0L )
        KFMClient::password = new QString;

    if ( KFMClient::password->isNull() )
    {
        QString fn = kapp->localkdedir().copy();
        fn += "/share/apps/kfm/magic";
        FILE *f = fopen( fn.data(), "rb" );
        if ( f == 0L )
        {
            QMessageBox::warning( (QWidget*)0, i18n( "KFM Error" ),
                                  i18n( "You dont have the file ~/.kde/share/apps/kfm/magic\nAuthorization failed" ) );
            return;
        }
        char buffer[ 1024 ];
        char *p = fgets( buffer, 1023, f );
        fclose( f );
        if ( p == 0L )
        {
            QMessageBox::warning( (QWidget*)0, i18n( "KFM Error" ),
                                  i18n( "The file ~/.kde/share/apps/kfm/magic is corrupted\nAuthorization failed" ) );
            return;
        }
        *( KFMClient::password ) = buffer;
    }
    if ( *( KFMClient::password ) != _password )
    {
        QMessageBox::warning( (QWidget*)0, i18n( "KFM Error" ),
                              i18n( "Someone tried to authorize himself\nusing a wrong password" ) );
        bAuth = false;
        return;
    }

    bAuth = true;
    connect( this, SIGNAL( list( const char* ) ),
             this, SLOT( slotList( const char* ) ) );
    connect( this, SIGNAL( copy( const char*, const char* ) ),
             this, SLOT( slotCopy( const char*, const char* ) ) );
    connect( this, SIGNAL( move( const char*, const char* ) ),
             this, SLOT( slotMove( const char*, const char* ) ) );
    connect( this, SIGNAL( copyClient( const char*, const char* ) ),
             server, SLOT( slotCopyClients( const char*, const char* ) ) );
    connect( this, SIGNAL( moveClient( const char*, const char* ) ),
             server, SLOT( slotMoveClients( const char*, const char* ) ) );
    connect( this, SIGNAL( refreshDesktop() ), server, SLOT( slotRefreshDesktop() ) );
    connect( this, SIGNAL( openURL( const char* ) ), server, SLOT( slotOpenURL( const char *) ) );
    connect( this, SIGNAL( refreshDirectory( const char* ) ), server, SLOT( slotRefreshDirectory( const char *) ) );
    connect( this, SIGNAL( openProperties( const char* ) ), server, SLOT( slotOpenProperties( const char *) ) );
    connect( this, SIGNAL( exec( const char*, const char* ) ),
             server, SLOT( slotExec( const char *, const char*) ) );
    connect( this, SIGNAL( sortDesktop() ), server, SLOT( slotSortDesktop() ) );
    connect( this, SIGNAL( configure() ), server, SLOT( slotConfigure() ) );
    connect( this, SIGNAL( selectRootIcons( int, int, int, int, bool ) ),
             server, SLOT( slotSelectRootIcons( int, int, int, int, bool ) ) );
}
예제 #10
0
void KWatchGnuPGMainWindow::createActions()
{
  (void)new KAction( i18n("C&lear History"), "history_clear", CTRL+Key_L,
		     this, SLOT( slotClear() ),
		     actionCollection(), "clear_log" );
  (void)KStdAction::saveAs( this, SLOT(slotSaveAs()), actionCollection() );
  (void)KStdAction::close( this, SLOT(close()), actionCollection() );
  (void)KStdAction::quit( this, SLOT(slotQuit()), actionCollection() );
  (void)KStdAction::preferences( this, SLOT(slotConfigure()), actionCollection() );
  ( void )KStdAction::keyBindings(this, SLOT(configureShortcuts()), actionCollection());
  ( void )KStdAction::configureToolbars(this, SLOT(slotConfigureToolbars()), actionCollection());

#if 0
  (void)new KAction( i18n("Configure KWatchGnuPG..."), QString::fromLatin1("configure"),
					 0, this, SLOT( slotConfigure() ),
					 actionCollection(), "configure" );
#endif

}
예제 #11
0
void QuickLauncher::action(Action a)
{
    if (a == KPanelApplet::Preferences)
    {
        slotConfigure();
    }
    else
    {
        KPanelApplet::action(a);
    }
}
예제 #12
0
KileWidgetHelpConfig::KileWidgetHelpConfig(QWidget *parent) : QWidget(parent)
{
	setupUi(this);

	m_helpLocationButton->setIcon(KIcon("folder-open"));

	connect(m_pbConfigure, SIGNAL(clicked()), this, SLOT(slotConfigure()));
	connect(m_helpLocationButton, SIGNAL(clicked()),
	        this, SLOT(selectHelpLocation()));

	KUrlCompletion *dirCompletion = new KUrlCompletion();
	dirCompletion->setMode(KUrlCompletion::DirCompletion);
	kcfg_location->setCompletionObject(dirCompletion);
	kcfg_location->setAutoDeleteCompletionObject(true);
}
예제 #13
0
NotificationDialog::NotificationDialog( KFileItem medium, NotifierSettings *settings,
                                        TQWidget* parent, const char* name )
	: KDialogBase( parent, name, false, i18n( "Medium Detected" ), Ok|Cancel|User1, Ok, true),
	  m_medium(medium), m_settings( settings )
{
	setCaption( TDEIO::decodeFileName(m_medium.name()) );
	clearWState( WState_Polished );

	TQWidget *page = new TQWidget( this );
	setMainWidget(page);
	TQVBoxLayout *topLayout = new TQVBoxLayout( page, 0, spacingHint() );

	m_view = new NotificationDialogView( page );

	topLayout->addWidget(m_view);
	m_view->iconLabel->setPixmap( m_medium.pixmap(64) );
	m_view->mimetypeLabel->setText( i18n( "<b>Medium type:</b>" ) + " "
	                              + m_medium.mimeTypePtr()->comment() );

	updateActionsListBox();

	resize( TQSize(400,400).expandedTo( minimumSizeHint() ) );


	m_actionWatcher = new KDirWatch();
	TQString services_dir
		= locateLocal( "data", "konqueror/servicemenus", true );
	m_actionWatcher->addDir( services_dir );

	setButtonText( User1, i18n("Configure...") );

	connect( m_actionWatcher, TQT_SIGNAL( dirty( const TQString & ) ),
	         this, TQT_SLOT( slotActionsChanged( const TQString & ) ) );
	connect( this , TQT_SIGNAL( okClicked() ),
	         this, TQT_SLOT( slotOk() ) );
	connect( this, TQT_SIGNAL( user1Clicked() ),
	         this, TQT_SLOT( slotConfigure() ) );
	connect( m_view->actionsList, TQT_SIGNAL( doubleClicked ( TQListBoxItem*, const TQPoint & ) ),
	         this, TQT_SLOT( slotOk() ) );

	connect( this, TQT_SIGNAL( finished() ),
	         this, TQT_SLOT( delayedDestruct() ) );

	m_actionWatcher->startScan();
	TQPushButton * btn = actionButton( Ok );
	btn->setFocus();
}
예제 #14
0
void Application::slotStartFolderSetup( int result )
{
    if( result == QDialog::Accepted ) {
        if( ownCloudInfo::instance()->isConfigured() ) {
            connect( ownCloudInfo::instance(),SIGNAL(ownCloudInfoFound(QString,QString,QString,QString)),
                     SLOT(slotOwnCloudFound(QString,QString,QString,QString)));

            connect( ownCloudInfo::instance(),SIGNAL(noOwncloudFound(QNetworkReply*)),
                     SLOT(slotNoOwnCloudFound(QNetworkReply*)));

            ownCloudInfo::instance()->checkInstallation();
        } else {
            slotConfigure();
        }
    } else {
        qDebug() << "Setup Wizard was canceled. No reparsing of config.";
    }
}
예제 #15
0
void BoxContainerItem::fillKPopupMenu(KPopupMenu *popupMenu, KActionCollection *actions) const
{
    /*popupMenu->insertItem( i18n( "&Configure" ), this, SLOT( slotConfigure() ) );
    popupMenu->insertItem( i18n( "&Recheck" ), this, SLOT( slotRecheck() ) );
    popupMenu->insertItem( i18n( "R&eset Counter" ), this, SLOT( slotReset() ) );
    popupMenu->insertItem( i18n( "&View Emails" ), this, SLOT( slotView() ) );
    popupMenu->insertItem( i18n( "R&un Command" ), this, SLOT( slotRunCommand() ) );*/

    (new KAction(i18n("&Configure"),     KShortcut(), this, SLOT(slotConfigure()), actions))->plug(popupMenu);
    (new KAction(i18n("&Recheck"),       KShortcut(), this, SLOT(slotRecheck()), actions))->plug(popupMenu);
    (new KAction(i18n("R&eset Counter"), KShortcut(), this, SLOT(slotReset()), actions))->plug(popupMenu);
    (new KAction(i18n("&View Emails"),   KShortcut(), this, SLOT(slotView()), actions))->plug(popupMenu);
    (new KAction(i18n("R&un Command"),   KShortcut(), this, SLOT(slotRunCommand()), actions))->plug(popupMenu);
    popupMenu->insertSeparator();
    KStdAction::help(this, SLOT(help()), actions)->plug(popupMenu);
    KStdAction::reportBug(this, SLOT(reportBug()), actions)->plug(popupMenu);
    KStdAction::aboutApp(this, SLOT(about()), actions)->plug(popupMenu);
}
예제 #16
0
void MainWindow::setupMenu() {
	menuBar()->clear();

	// File
	QMenu *fileMenu = menuBar()->addMenu(tr("&File"));
	QAction *config = fileMenu->addAction(tr("&Configure"), this, SLOT(slotConfigure()));
	config->setMenuRole(QAction::PreferencesRole);
	fileMenu->addSeparator();
	QAction *quit = fileMenu->addAction(tr("&Quit"), qApp, SLOT(quit()));
	quit->setMenuRole( QAction::QuitRole );

	// Help
	QMenu *helpMenu = menuBar()->addMenu(tr("&Help"));
	helpMenu->addSeparator();
	QAction *aboutQt = helpMenu->addAction(tr("About &Qt"), qApp, SLOT(aboutQt()));
	aboutQt->setMenuRole( QAction::AboutQtRole );
	QAction *aboutTelldusCenter = helpMenu->addAction(tr("About &TelldusCenter"), this, SLOT(slotAboutApplication()));
	aboutTelldusCenter->setMenuRole( QAction::AboutRole );
}
예제 #17
0
QWidget * AbstractContent::createPropertyWidget(ContentProperties * __p)
{
    ContentProperties * cp = __p ? __p : new ContentProperties;

    // connect actions
    connect(cp->cFront, SIGNAL(clicked()), this, SLOT(slotStackFront()));
    connect(cp->cRaise, SIGNAL(clicked()), this, SLOT(slotStackRaise()));
    connect(cp->cLower, SIGNAL(clicked()), this, SLOT(slotStackLower()));
    connect(cp->cBack, SIGNAL(clicked()), this, SLOT(slotStackBack()));
    connect(cp->cConfigure, SIGNAL(clicked()), this, SLOT(slotConfigure()));

    // properties link
    new PE_AbstractSlider(cp->cOpacity, this, "contentOpacity", cp);
    new PE_Combo(cp->cFxCombo, this, "fxIndex", cp);
    cp->cPerspWidget->setRange(QRectF(-70.0, -70.0, 140.0, 140.0));
    new PE_PaneWidget(cp->cPerspWidget, this, "perspective", cp);

    return cp;
}
예제 #18
0
FifteenMainWindow::FifteenMainWindow(QWidget *parent, const char* name, WFlags fl)
  : QMainWindow( parent, name, fl )
{

  // random seed
  srand(time(0));
  setCaption( tr("Fifteen Pieces") );

  QToolBar *toolbar = new QToolBar(this);
  toolbar->setHorizontalStretchable( FALSE );
  QMenuBar *menubar = new QMenuBar( toolbar );
  menubar->setMargin(0);
  QPopupMenu *game = new QPopupMenu( this );
  menubar->insertItem( tr( "Game" ), game );

  QWidget *spacer = new QWidget( toolbar );
  spacer->setBackgroundMode( PaletteButton );
  toolbar->setStretchableWidget( spacer );


  setToolBarsMovable( FALSE );
  QVBox *vbox = new QVBox( this );
  PiecesTable *table = new PiecesTable( vbox );
  setCentralWidget(vbox);



  QAction *a = new QAction( tr( "Randomize" ), Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ),
			    QString::null, 0, this, 0 );
  connect( a, SIGNAL( activated() ), table, SLOT( slotRandomize() ) );
  a->addTo( game );
  a->addTo( toolbar );


  a  = new QAction( tr("Configure"), Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ),
                    QString::null, 0, this, 0 );
  connect( a, SIGNAL( activated()), table, SLOT( slotConfigure()) );
  a->addTo( game );
}
예제 #19
0
파일: kiten.cpp 프로젝트: KDE/kiten
void Kiten::setupActions()
{
  /* Add the basic quit/print/prefs actions, use the gui factory for keybindings */
  (void) KStandardAction::quit( this, SLOT(close()), actionCollection() );
  //Why the heck is KSA:print adding it's own toolbar!?
  //	(void) KStandardAction::print(this, SLOT(print()), actionCollection());
  (void) KStandardAction::preferences( this, SLOT(slotConfigure()), actionCollection() );
  //old style cast seems needed here, (const QObject*)
  KStandardAction::keyBindings(   (const QObject*)guiFactory()
                                , SLOT(configureShortcuts())
                                , actionCollection() );

  /* Setup the Go-to-learn-mode actions */
  /* TODO: put back when Dictionary Editor is reorganised */
// 	(void) new KAction(   i18n( "&Dictionary Editor..." )
//                             , "document-properties"
//                             , 0
//                             , this
//                             , SLOT(createEEdit())
//                             , actionCollection()
//                             , "dict_editor");
  QAction *radselect = actionCollection()->addAction( "radselect" );
  radselect->setText( i18n( "Radical Selector" ) );
//	radselect->setIcon( "edit-find" );
  actionCollection()->setDefaultShortcut(radselect, Qt::CTRL+Qt::Key_R );
  connect(radselect, &QAction::triggered, this, &Kiten::radicalSearch);

  QAction *kanjibrowser = actionCollection()->addAction( "kanjibrowser" );
  kanjibrowser->setText( i18n( "Kanji Browser" ) );
  actionCollection()->setDefaultShortcut(kanjibrowser, Qt::CTRL+Qt::Key_K );
  connect(kanjibrowser, &QAction::triggered, this, &Kiten::kanjiBrowserSearch);

  /* Setup the Search Actions and our custom Edit Box */
  _inputManager = new SearchStringInput( this );

  QAction *searchButton = actionCollection()->addAction( "search" );
  searchButton->setText( i18n( "S&earch" ) );
  // Set the search button to search
  connect(searchButton, &QAction::triggered, this, &Kiten::searchFromEdit);
  searchButton->setIcon( KStandardGuiItem::find().icon() );

  // That's not it, that's "find as you type"...
//   connect( Edit, SIGNAL(completion(QString)),
//            this,   SLOT(searchFromEdit()) );

  /* Setup our widgets that handle preferences */
//   deinfCB = new KToggleAction(   i18n( "&Deinflect Verbs in Regular Search" )
//                                 , 0
//                                 , this
//                                 , SLOT(kanjiDictChange())
//                                 , actionCollection()
//                                 , "deinf_toggle" );

  _autoSearchToggle = actionCollection()->add<KToggleAction>( "autosearch_toggle" );
  _autoSearchToggle->setText( i18n( "&Automatically Search Clipboard Selections" ) );

  _irAction = actionCollection()->add<QAction>( "search_in_results" );
  _irAction->setText( i18n( "Search &in Results" ) );
  connect(_irAction, &QAction::triggered, this, &Kiten::searchInResults);


  QAction *actionFocusResultsView;
  actionFocusResultsView = actionCollection()->addAction(  "focusresultview"
                                                         , this
                                                         , SLOT(focusResultsView()) );
  actionCollection()->setDefaultShortcut(actionFocusResultsView, Qt::Key_Escape );
  actionFocusResultsView->setText( i18n( "Focus result view" ) );


  (void) KStandardAction::configureToolbars(   this
                                             , SLOT(configureToolBars())
                                             , actionCollection() );

  //TODO: this should probably be a standard action
  /*
  globalShortcutsAction = actionCollection()->addAction( "options_configure_global_keybinding" );
  globalShortcutsAction->setText( i18n( "Configure &Global Shortcuts..." ) );
  connect( globalShortcutsAction, SIGNAL(triggered()), this, SLOT(configureGlobalKeys()) );
  */

  //TODO: implement this
  //_globalSearchAction = actionCollection()->add<KToggleAction>( "search_on_the_spot" );
  //_globalSearchAction->setText( i18n( "On The Spo&t Search" ) );
  //KAction *temp = qobject_cast<KAction*>( _globalSearchAction );
  //KShortcut shrt( "Ctrl+Alt+S" );
  //globalSearchAction->setGlobalShortcut(shrt);  //FIXME: Why does this take ~50 seconds to return!?
  //connect(globalSearchAction, SIGNAL(triggered()), this, SLOT(searchOnTheSpot()));

  _backAction = KStandardAction::back( this, SLOT(back()), actionCollection() );
  _forwardAction = KStandardAction::forward( this, SLOT(forward()), actionCollection() );
  _backAction->setEnabled( false );
  _forwardAction->setEnabled( false );
}
예제 #20
0
void KMMainView::initActions()
{
    KIconSelectAction *vact = new KIconSelectAction(i18n("&View"), 0, m_actions, "view_change");
    QStringList iconlst;
    iconlst << "view_icon"
            << "view_detailed"
            << "view_tree";
    vact->setItems(QStringList::split(',', i18n("&Icons,&List,&Tree"), false), iconlst);
    vact->setCurrentItem(0);
    connect(vact, SIGNAL(activated(int)), SLOT(slotChangeView(int)));

    KActionMenu *stateAct = new KActionMenu(i18n("Start/Stop Printer"), "kdeprint_printstate", m_actions, "printer_state_change");
    stateAct->setDelayed(false);
    stateAct->insert(
        new KAction(i18n("&Start Printer"), "kdeprint_enableprinter", 0, this, SLOT(slotChangePrinterState()), m_actions, "printer_start"));
    stateAct->insert(new KAction(i18n("Sto&p Printer"), "kdeprint_stopprinter", 0, this, SLOT(slotChangePrinterState()), m_actions, "printer_stop"));

    stateAct = new KActionMenu(i18n("Enable/Disable Job Spooling"), "kdeprint_queuestate", m_actions, "printer_spool_change");
    stateAct->setDelayed(false);
    stateAct->insert(
        new KAction(i18n("&Enable Job Spooling"), "kdeprint_enableprinter", 0, this, SLOT(slotChangePrinterState()), m_actions, "printer_enable"));
    stateAct->insert(
        new KAction(i18n("&Disable Job Spooling"), "kdeprint_stopprinter", 0, this, SLOT(slotChangePrinterState()), m_actions, "printer_disable"));

    new KAction(i18n("&Remove"), "edittrash", 0, this, SLOT(slotRemove()), m_actions, "printer_remove");
    new KAction(i18n("&Configure..."), "configure", 0, this, SLOT(slotConfigure()), m_actions, "printer_configure");
    new KAction(i18n("Add &Printer/Class..."), "kdeprint_addprinter", 0, this, SLOT(slotAdd()), m_actions, "printer_add");
    new KAction(i18n("Add &Special (pseudo) Printer..."), "kdeprint_addpseudo", 0, this, SLOT(slotAddSpecial()), m_actions, "printer_add_special");
    new KAction(i18n("Set as &Local Default"), "kdeprint_defaulthard", 0, this, SLOT(slotHardDefault()), m_actions, "printer_hard_default");
    new KAction(i18n("Set as &User Default"), "kdeprint_defaultsoft", 0, this, SLOT(slotSoftDefault()), m_actions, "printer_soft_default");
    new KAction(i18n("&Test Printer..."), "kdeprint_testprinter", 0, this, SLOT(slotTest()), m_actions, "printer_test");
    new KAction(i18n("Configure &Manager..."), "kdeprint_configmgr", 0, this, SLOT(slotManagerConfigure()), m_actions, "manager_configure");
    new KAction(i18n("Initialize Manager/&View"), "reload", 0, this, SLOT(slotInit()), m_actions, "view_refresh");

    KIconSelectAction *dact = new KIconSelectAction(i18n("&Orientation"), 0, m_actions, "orientation_change");
    iconlst.clear();
    iconlst << "view_top_bottom"
            << "view_left_right";
    dact->setItems(QStringList::split(',', i18n("&Vertical,&Horizontal"), false), iconlst);
    dact->setCurrentItem(0);
    connect(dact, SIGNAL(activated(int)), SLOT(slotChangeDirection(int)));

    new KAction(i18n("R&estart Server"), "kdeprint_restartsrv", 0, this, SLOT(slotServerRestart()), m_actions, "server_restart");
    new KAction(i18n("Configure &Server..."), "kdeprint_configsrv", 0, this, SLOT(slotServerConfigure()), m_actions, "server_configure");

    KToggleAction *tact = new KToggleAction(i18n("Show &Toolbar"), 0, m_actions, "view_toolbar");
    tact->setCheckedState(i18n("Hide &Toolbar"));
    connect(tact, SIGNAL(toggled(bool)), SLOT(slotToggleToolBar(bool)));
    tact = new KToggleAction(i18n("Show Me&nu Toolbar"), 0, m_actions, "view_menubar");
    tact->setCheckedState(i18n("Hide Me&nu Toolbar"));
    connect(tact, SIGNAL(toggled(bool)), SLOT(slotToggleMenuBar(bool)));
    tact = new KToggleAction(i18n("Show Pr&inter Details"), "kdeprint_printer_infos", 0, m_actions, "view_printerinfos");
    tact->setCheckedState(KGuiItem(i18n("Hide Pr&inter Details"), "kdeprint_printer_infos"));
    tact->setChecked(true);
    connect(tact, SIGNAL(toggled(bool)), SLOT(slotShowPrinterInfos(bool)));

    tact = new KToggleAction(i18n("Toggle Printer &Filtering"), "filter", 0, m_actions, "view_pfilter");
    tact->setChecked(KMManager::self()->isFilterEnabled());
    connect(tact, SIGNAL(toggled(bool)), SLOT(slotToggleFilter(bool)));

    new KAction(i18n("%1 &Handbook").arg("KDEPrint"), "contents", 0, this, SLOT(slotHelp()), m_actions, "invoke_help");
    new KAction(i18n("%1 &Web Site").arg("KDEPrint"), "network", 0, this, SLOT(slotHelp()), m_actions, "invoke_web");

    KActionMenu *mact = new KActionMenu(i18n("Pri&nter Tools"), "package_utilities", m_actions, "printer_tool");
    mact->setDelayed(false);
    connect(mact->popupMenu(), SIGNAL(activated(int)), SLOT(slotToolSelected(int)));
    QStringList files = KGlobal::dirs()->findAllResources("data", "kdeprint/tools/*.desktop");
    for(QStringList::ConstIterator it = files.begin(); it != files.end(); ++it)
    {
        KSimpleConfig conf(*it);
        conf.setGroup("Desktop Entry");
        mact->popupMenu()->insertItem(conf.readEntry("Name", "Unnamed"), mact->popupMenu()->count());
        m_toollist << conf.readEntry("X-KDE-Library");
    }

    // add actions to the toolbar
    m_actions->action("printer_add")->plug(m_toolbar);
    m_actions->action("printer_add_special")->plug(m_toolbar);
    m_toolbar->insertLineSeparator();
    m_actions->action("printer_state_change")->plug(m_toolbar);
    m_actions->action("printer_spool_change")->plug(m_toolbar);
    m_toolbar->insertSeparator();
    m_actions->action("printer_hard_default")->plug(m_toolbar);
    m_actions->action("printer_soft_default")->plug(m_toolbar);
    m_actions->action("printer_remove")->plug(m_toolbar);
    m_toolbar->insertSeparator();
    m_actions->action("printer_configure")->plug(m_toolbar);
    m_actions->action("printer_test")->plug(m_toolbar);
    m_actions->action("printer_tool")->plug(m_toolbar);
    m_pactionsindex = m_toolbar->insertSeparator();
    m_toolbar->insertLineSeparator();
    m_actions->action("server_restart")->plug(m_toolbar);
    m_actions->action("server_configure")->plug(m_toolbar);
    m_toolbar->insertLineSeparator();
    m_actions->action("manager_configure")->plug(m_toolbar);
    m_actions->action("view_refresh")->plug(m_toolbar);
    m_toolbar->insertLineSeparator();
    m_actions->action("view_printerinfos")->plug(m_toolbar);
    m_actions->action("view_change")->plug(m_toolbar);
    m_actions->action("orientation_change")->plug(m_toolbar);
    m_actions->action("view_pfilter")->plug(m_toolbar);

    // add actions to the menu bar
    QPopupMenu *menu = new QPopupMenu(this);
    m_actions->action("printer_add")->plug(menu);
    m_actions->action("printer_add_special")->plug(menu);
    // m_menubar->insertItem( i18n( "Add" ), menu );
    m_menubar->insertButton("wizard", 0, true, i18n("Add"));
    m_menubar->getButton(0)->setPopup(menu, true);
    menu = new QPopupMenu(this);
    m_actions->action("printer_state_change")->plug(menu);
    m_actions->action("printer_spool_change")->plug(menu);
    menu->insertSeparator();
    m_actions->action("printer_hard_default")->plug(menu);
    m_actions->action("printer_soft_default")->plug(menu);
    m_actions->action("printer_remove")->plug(menu);
    menu->insertSeparator();
    m_actions->action("printer_configure")->plug(menu);
    m_actions->action("printer_test")->plug(menu);
    m_actions->action("printer_tool")->plug(menu);
    menu->insertSeparator();
    // m_menubar->insertItem( i18n( "Printer" ), menu );
    m_menubar->insertButton("printer1", 1, true, i18n("Printer"));
    m_menubar->getButton(1)->setPopup(menu, true);
    menu = new QPopupMenu(this);
    m_actions->action("server_restart")->plug(menu);
    m_actions->action("server_configure")->plug(menu);
    // m_menubar->insertItem( i18n( "Server" ), menu );
    m_menubar->insertButton("misc", 2, true, i18n("Print Server"));
    m_menubar->getButton(2)->setPopup(menu, true);
    menu = new QPopupMenu(this);
    m_actions->action("manager_configure")->plug(menu);
    m_actions->action("view_refresh")->plug(menu);
    // m_menubar->insertItem( i18n( "Manager" ), menu );
    m_menubar->insertButton("kdeprint_configmgr", 3, true, i18n("Print Manager"));
    m_menubar->getButton(3)->setPopup(menu, true);
    menu = new QPopupMenu(this);
    m_actions->action("view_printerinfos")->plug(menu);
    m_actions->action("view_change")->plug(menu);
    m_actions->action("orientation_change")->plug(menu);
    m_actions->action("view_toolbar")->plug(menu);
    m_actions->action("view_menubar")->plug(menu);
    menu->insertSeparator();
    m_actions->action("view_pfilter")->plug(menu);
    // m_menubar->insertItem( i18n( "View" ), menu );
    m_menubar->insertButton("view_remove", 4, true, i18n("View"));
    m_menubar->getButton(4)->setPopup(menu, true);
    // m_menubar->setMinimumHeight( m_menubar->heightForWidth( 1000 ) );
    menu = new QPopupMenu(this);
    m_actions->action("invoke_help")->plug(menu);
    m_actions->action("invoke_web")->plug(menu);
    m_menubar->insertButton("help", 5, true, i18n("Documentation"));
    m_menubar->getButton(5)->setPopup(menu, true);

    loadPluginActions();
    slotPrinterSelected(QString::null);
}
예제 #21
0
파일: amor.cpp 프로젝트: Feniks13r/amor
void Amor::slotMouseClicked(const QPoint &pos)
{
    bool restartTimer = mTimer->isActive();

    // Stop the animation while the menu is open.
    if( restartTimer ) {
        mTimer->stop();
    }

    if( !mMenu ) {
        KHelpMenu* help = new KHelpMenu( 0, KGlobal::mainComponent().aboutData(), false );
        KMenu* helpMenu = help->menu();
#ifdef __GNUC__
#warning the following is kinda dirty and should be done by KHelpMenu::menu() I think. (hermier)
#endif
        helpMenu->setIcon( SmallIcon( QLatin1String( "help-contents" ) ) );
        helpMenu->setTitle( i18nc( "@action:inmenu Amor", "&Help" ) );

        mMenu = new KMenu( 0 );
        mMenu->addTitle( QLatin1String( "Amor" ) ); // I really don't want this i18n'ed
        mMenu->addAction( SmallIcon( QLatin1String ("configure" ) ), i18nc( "@action:inmenu Amor", "&Configure..." ), this, SLOT(slotConfigure()) );
        mMenu->addSeparator();
        mMenu->addMenu( helpMenu );
        mMenu->addAction( SmallIcon( QLatin1String( "application-exit" ) ), i18nc( "@action:inmenu Amor", "&Quit" ), kapp, SLOT(quit()) );
    }

    mMenu->exec( pos );

    if( restartTimer ) {
        mTimer->setSingleShot( true );
        mTimer->start( 1000 );
    }
}
예제 #22
0
void KateMainWindow::setupActions()
{
  KAction *a;

  actionCollection()->addAction( KStandardAction::New, "file_new", m_viewManager, SLOT(slotDocumentNew()) )
  ->setWhatsThis(i18n("Create a new document"));
  actionCollection()->addAction( KStandardAction::Open, "file_open", m_viewManager, SLOT(slotDocumentOpen()) )
  ->setWhatsThis(i18n("Open an existing document for editing"));

  fileOpenRecent = KStandardAction::openRecent (m_viewManager, SLOT(openUrl(KUrl)), this);
  actionCollection()->addAction(fileOpenRecent->objectName(), fileOpenRecent);
  fileOpenRecent->setWhatsThis(i18n("This lists files which you have opened recently, and allows you to easily open them again."));

  a = actionCollection()->addAction( "file_save_all" );
  a->setIcon( KIcon("document-save-all") );
  a->setText( i18n("Save A&ll") );
  a->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_L) );
  connect( a, SIGNAL(triggered()), KateDocManager::self(), SLOT(saveAll()) );
  a->setWhatsThis(i18n("Save all open, modified documents to disk."));

  a = actionCollection()->addAction( "file_reload_all" );
  a->setText( i18n("&Reload All") );
  connect( a, SIGNAL(triggered()), KateDocManager::self(), SLOT(reloadAll()) );
  a->setWhatsThis(i18n("Reload all open documents."));

  a = actionCollection()->addAction( "file_close_orphaned" );
  a->setText( i18n("Close Orphaned") );
  connect( a, SIGNAL(triggered()), KateDocManager::self(), SLOT(closeOrphaned()) );
  a->setWhatsThis(i18n("Close all documents in the file list that could not be reopened, because they are not accessible anymore."));

  actionCollection()->addAction( KStandardAction::Close, "file_close", m_viewManager, SLOT(slotDocumentClose()) )
  ->setWhatsThis(i18n("Close the current document."));

  a = actionCollection()->addAction( "file_close_other" );
  a->setText( i18n( "Close Other" ) );
  connect( a, SIGNAL(triggered()), this, SLOT(slotDocumentCloseOther()) );
  a->setWhatsThis(i18n("Close other open documents."));

  a = actionCollection()->addAction( "file_close_all" );
  a->setText( i18n( "Clos&e All" ) );
  connect( a, SIGNAL(triggered()), this, SLOT(slotDocumentCloseAll()) );
  a->setWhatsThis(i18n("Close all open documents."));

  a = actionCollection()->addAction( KStandardAction::Quit, "file_quit" );
  // Qt::QueuedConnection: delay real shutdown, as we are inside menu action handling (bug #185708)
  connect( a, SIGNAL(triggered()), this, SLOT(slotFileQuit()), Qt::QueuedConnection );
  a->setWhatsThis(i18n("Close this window"));

  a = actionCollection()->addAction( "view_new_view" );
  a->setIcon( KIcon("window-new") );
  a->setText( i18n("&New Window") );
  connect( a, SIGNAL(triggered()), this, SLOT(newWindow()) );
  a->setWhatsThis(i18n("Create a new Kate view (a new window with the same document list)."));

  KToggleAction* showFullScreenAction = KStandardAction::fullScreen( 0, 0, this, this);
  actionCollection()->addAction( showFullScreenAction->objectName(), showFullScreenAction );
  connect( showFullScreenAction, SIGNAL(toggled(bool)), this, SLOT(slotFullScreen(bool)));

  documentOpenWith = new KActionMenu(i18n("Open W&ith"), this);
  actionCollection()->addAction("file_open_with", documentOpenWith);
  documentOpenWith->setWhatsThis(i18n("Open the current document using another application registered for its file type, or an application of your choice."));
  connect(documentOpenWith->menu(), SIGNAL(aboutToShow()), this, SLOT(mSlotFixOpenWithMenu()));
  connect(documentOpenWith->menu(), SIGNAL(triggered(QAction*)), this, SLOT(slotOpenWithMenuAction(QAction*)));

  a = KStandardAction::keyBindings(this, SLOT(editKeys()), actionCollection());
  a->setWhatsThis(i18n("Configure the application's keyboard shortcut assignments."));

  a = KStandardAction::configureToolbars(this, SLOT(slotEditToolbars()), actionCollection());
  a->setWhatsThis(i18n("Configure which items should appear in the toolbar(s)."));

  QAction* settingsConfigure = KStandardAction::preferences(this, SLOT(slotConfigure()), actionCollection());
  settingsConfigure->setWhatsThis(i18n("Configure various aspects of this application and the editing component."));

  // tip of the day :-)
  actionCollection()->addAction( KStandardAction::TipofDay, this, SLOT(tipOfTheDay()) )
  ->setWhatsThis(i18n("This shows useful tips on the use of this application."));

  if (KatePluginManager::self()->pluginList().count() > 0)
  {
    a = actionCollection()->addAction( "help_plugins_contents" );
    a->setText( i18n("&Plugins Handbook") );
    connect( a, SIGNAL(triggered()), this, SLOT(pluginHelp()) );
    a->setWhatsThis(i18n("This shows help files for various available plugins."));
  }

  a = actionCollection()->addAction( "help_about_editor" );
  a->setText( i18n("&About Editor Component") );
  connect( a, SIGNAL(triggered()), this, SLOT(aboutEditor()) );

  connect(m_viewManager, SIGNAL(viewChanged()), m_mainWindow, SIGNAL(viewChanged()));
  connect(m_viewManager, SIGNAL(viewCreated(KTextEditor::View*)), m_mainWindow, SIGNAL(viewCreated(KTextEditor::View*)));
  connect(m_viewManager, SIGNAL(viewChanged()), this, SLOT(slotWindowActivated()));
  connect(m_viewManager, SIGNAL(viewChanged()), this, SLOT(slotUpdateOpenWith()));
  connect(m_viewManager, SIGNAL(viewChanged()), this, SLOT(slotUpdateBottomViewBar()));
  connect(m_viewManager, SIGNAL(viewChanged()), this, SLOT(slotUpdateTopViewBar()));
  slotWindowActivated ();

  // session actions
  a = actionCollection()->addAction( "sessions_new" );
  a->setIcon( KIcon("document-new") );
  a->setText( i18nc("Menu entry Session->New", "&New") );
  // Qt::QueuedConnection to avoid deletion of code that is executed when reducing the amount of mainwindows. (bug #227008)
  connect( a, SIGNAL(triggered()), KateSessionManager::self(), SLOT(sessionNew()), Qt::QueuedConnection );
  a = actionCollection()->addAction( "sessions_open" );
  a->setIcon( KIcon("document-open") );
  a->setText( i18n("&Open Session") );
  // Qt::QueuedConnection to avoid deletion of code that is executed when reducing the amount of mainwindows. (bug #227008)
  connect( a, SIGNAL(triggered()), KateSessionManager::self(), SLOT(sessionOpen()), Qt::QueuedConnection );
  a = actionCollection()->addAction( "sessions_save" );
  a->setIcon( KIcon("document-save") );
  a->setText( i18n("&Save Session") );
  connect( a, SIGNAL(triggered()), KateSessionManager::self(), SLOT(sessionSave()) );
  a = actionCollection()->addAction( "sessions_save_as" );
  a->setIcon( KIcon("document-save-as") );
  a->setText( i18n("Save Session &As...") );
  connect( a, SIGNAL(triggered()), KateSessionManager::self(), SLOT(sessionSaveAs()) );
  a = actionCollection()->addAction( "sessions_manage" );
  a->setIcon( KIcon("view-choose") );
  a->setText( i18n("&Manage Sessions...") );
  // Qt::QueuedConnection to avoid deletion of code that is executed when reducing the amount of mainwindows. (bug #227008)
  connect( a, SIGNAL(triggered()), KateSessionManager::self(), SLOT(sessionManage()), Qt::QueuedConnection );

  // quick open menu ;)
  a = new KateSessionsAction (i18n("&Quick Open Session"), this);
  actionCollection()->addAction("sessions_list", a);
}
예제 #23
0
AbstractContent::AbstractContent(QGraphicsScene *scene, bool fadeIn, bool noRescale, QGraphicsItem * parent)
    : AbstractDisposeable(fadeIn, parent)
    , m_contentRect(-100, -75, 200, 150)
    , m_frame(0)
    , m_frameTextItem(0)
    , m_controlsVisible(false)
    , m_dirtyTransforming(false)
    , m_transformRefreshTimer(0)
    , m_gfxChangeTimer(0)
    , m_mirrorItem(0)
#if QT_VERSION < 0x040600
    , m_rotationAngle(0)
#endif
    , m_fxIndex(0)
{
    // the buffered graphics changes timer
    m_gfxChangeTimer = new QTimer(this);
    m_gfxChangeTimer->setInterval(0);
    m_gfxChangeTimer->setSingleShot(true);

    // customize item's behavior
    setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemIsSelectable);
#if QT_VERSION >= 0x040600
    setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
#endif
    // allow some items (eg. the shape controls for text) to be shown
    setFlag(QGraphicsItem::ItemClipsChildrenToShape, false);
    setAcceptHoverEvents(true);

    // create child controls
    createCorner(Qt::TopLeftCorner, noRescale);
    createCorner(Qt::TopRightCorner, noRescale);
    createCorner(Qt::BottomLeftCorner, noRescale);
    createCorner(Qt::BottomRightCorner, noRescale);

    //ButtonItem * bFront = new ButtonItem(ButtonItem::Control, Qt::blue, QIcon(":/data/action-order-front.png"), this);
    //bFront->setToolTip(tr("Raise"));
    //connect(bFront, SIGNAL(clicked()), this, SLOT(slotStackRaise()));
    //addButtonItem(bFront);

    ButtonItem * bConf = new ButtonItem(ButtonItem::Control, Qt::green, QIcon(":/data/action-configure.png"), this);
    bConf->setToolTip(tr("Change properties..."));
    connect(bConf, SIGNAL(clicked()), this, SLOT(slotConfigure()));
    addButtonItem(bConf);

    ButtonItem * bPersp = new ButtonItem(ButtonItem::Control, Qt::red, QIcon(":/data/action-perspective.png"), this);
    bPersp->setToolTip(tr("Drag around to change the perspective.\nHold SHIFT to move faster.\nUse CTRL to cancel the transformations."));
    connect(bPersp, SIGNAL(dragging(const QPointF&,Qt::KeyboardModifiers)), this, SLOT(slotSetPerspective(const QPointF&,Qt::KeyboardModifiers)));
    connect(bPersp, SIGNAL(doubleClicked()), this, SLOT(slotClearPerspective()));
    addButtonItem(bPersp);

    ButtonItem * bDelete = new ButtonItem(ButtonItem::Control, Qt::red, QIcon(":/data/action-delete.png"), this);
    bDelete->setSelectsParent(false);
    bDelete->setToolTip(tr("Remove"));
    connect(bDelete, SIGNAL(clicked()), this, SIGNAL(requestRemoval()));
    addButtonItem(bDelete);

    // create default frame
    Frame * frame = FrameFactory::defaultPictureFrame();
    setFrame(frame);

    // hide and layoutChildren buttons
    layoutChildren();

    // add to the scene
    scene->addItem(this);

    // display mirror
#if QT_VERSION >= 0x040600
    // WORKAROUND with Qt 4.6-tp1 there are crashes activating a mirror before setting the scene
    // need to rethink this anyway
    setMirrored(false);
#else
    setMirrored(RenderOpts::LastMirrored);
#endif
}
예제 #24
0
파일: kscope.cpp 프로젝트: VicHao/kkscope
/**
 * Class constructor.
 * @param	pParent	The parent widget
 * @param	szName	The widget's name
 */
KScope::KScope(QWidget* pParent, const char* szName) :
	KParts::DockMainWindow(pParent, szName),
	m_pCscopeBuild(NULL),	
	m_sCurFilePath(""),
	m_nCurLine(0),
	m_pProgressDlg(NULL),
	m_bUpdateGUI(true),
	m_bCscopeVerified(false),
	m_bRebuildDB(false),
	m_pMakeDlg(NULL)
{
	QString sPath;

	// Load configuration
	Config().load();
	
	// Create the main child widgets
	m_pEditTabs = new EditorTabs(this, NULL);
	m_pQueryWidget = new QueryWidget(this);
	m_pFileView = new FileView(this);
	m_pFileList = m_pFileView->getFileList();
	m_pMsgDlg = new CscopeMsgDlg(this);
	m_pQueryDock = createDockWidget("Query Window", QPixmap());
	m_pFileViewDock = createDockWidget("File List Window", QPixmap());

	// Connect menu and toolbar items with the object's slots
	m_pActions = new KScopeActions(this);
	m_pActions->init();
	m_pActions->slotEnableProjectActions(false);
	
	// Show a toolbar show/hide menu
	setStandardToolBarMenuEnabled(true);
	
	// Create the initial GUI (no active part)
	setXMLFile("kscopeui.rc");
	createShellGUI();
	
	// Create all child widgets
	initMainWindow();

	// Create control objects
	m_pProjMgr = new ProjectManager();
	m_pEditMgr = new EditorManager(this);
	m_pCallTreeMgr = new CallTreeManager(this);

	// Initialise the icon manager	
	Pixmaps().init();
	
	// Open a file for editing when selected in the project's file list or the
	// file tree
	connect(m_pFileView, SIGNAL(fileRequested(const QString&, uint)), this,
		SLOT(slotShowEditor(const QString&, uint)));

	// Delete an editor page object after it is removed
	connect(m_pEditTabs, SIGNAL(editorRemoved(EditorPage*)),
		this, SLOT(slotDeleteEditor(EditorPage*)));
	
	connect(m_pEditTabs, SIGNAL(filesDropped(QDropEvent*)), this,
		SLOT(slotDropEvent(QDropEvent*)));
	
	// Set an editor as the active part whenever its owner tab is selected
	connect(m_pEditTabs, SIGNAL(editorChanged(EditorPage*, EditorPage*)),
		this, SLOT(slotChangeEditor(EditorPage*, EditorPage*)));

	// Display a file at a specific line when selected in a query list
	connect(m_pQueryWidget, SIGNAL(lineRequested(const QString&, uint)),
		this, SLOT(slotQueryShowEditor(const QString&, uint)));
	
	// Display the symbol dialogue when the user opens a new query page
	connect(m_pQueryWidget, SIGNAL(newQuery()), 
		this, SLOT(slotQueryReference()));

	// Rebuild the project database after a certain time period has elapsed
	// since the last save
	connect(&m_timerRebuild, SIGNAL(timeout()), this, SLOT(slotRebuildDB()));

	// Display a file at a specific line when selected in a call tree dialogue
	connect(m_pCallTreeMgr, SIGNAL(lineRequested(const QString&, uint)),
		this, SLOT(slotQueryShowEditor(const QString&, uint)));
		
	// Store main window settings when closed
	setAutoSaveSettings();
	
	// Initialise arrow head drawing
	GraphWidget::setArrowInfo(20, 15);
	
	// Use a maximised window the first time
	if (Config().isFirstTime())
		showMaximized();

	// Show the Welcome message
	if (Config().showWelcomeDlg()) {
		show();
		slotShowWelcome();
	}

	// If this is the first time the user has launched KScope, prompt him/her
	// to configure the global parameters
	if (Config().isFirstTime())
		slotConfigure();		
}
예제 #25
0
UIServer::UIServer() : KMainWindow(0, ""), DCOPObject("UIServer"), m_shuttingDown(false), m_configDialog(0), m_contextMenu(0), m_systemTray(0)
{

    readSettings();

    // setup toolbar
    toolBar()->insertButton("editdelete", TOOL_CANCEL, SIGNAL(clicked()), this, SLOT(slotCancelCurrent()), FALSE, i18n("Cancel"));
    toolBar()->insertButton("configure", TOOL_CONFIGURE, SIGNAL(clicked()), this, SLOT(slotConfigure()), true, i18n("Settings..."));

    toolBar()->setBarPos(KToolBar::Left);

    // setup statusbar
    statusBar()->insertItem(i18n(" Files: %1 ").arg(0), ID_TOTAL_FILES);
    statusBar()->insertItem(i18n("Remaining Size", " Rem. Size: %1 kB ").arg("0"), ID_TOTAL_SIZE);
    statusBar()->insertItem(i18n("Remaining Time", " Rem. Time: 00:00:00 "), ID_TOTAL_TIME);
    statusBar()->insertItem(i18n(" %1 kB/s ").arg("0"), ID_TOTAL_SPEED);

    // setup listview
    listProgress = new ListProgress(this, "progresslist");

    setCentralWidget(listProgress);

    connect(listProgress, SIGNAL(selectionChanged()), SLOT(slotSelection()));
    connect(listProgress, SIGNAL(executed(QListViewItem *)), SLOT(slotToggleDefaultProgress(QListViewItem *)));
    connect(listProgress, SIGNAL(contextMenu(KListView *, QListViewItem *, const QPoint &)),
            SLOT(slotShowContextMenu(KListView *, QListViewItem *, const QPoint &)));


    // setup animation timer
    updateTimer = new QTimer(this);
    connect(updateTimer, SIGNAL(timeout()), SLOT(slotUpdate()));
    m_bUpdateNewJob = false;

    setCaption(i18n("Progress Dialog"));
    setMinimumSize(150, 50);
    resize(m_initWidth, m_initHeight);

    applySettings();

    /*  if ((m_bShowList) && (m_keepListOpen))
      {
         cerr<<"show() !"<<endl;
         show();
      }
      else*/
    hide();
}
예제 #26
0
KileWidgetLatexConfig::KileWidgetLatexConfig(QWidget *parent) : QWidget(parent)
{
	setupUi(this);
	connect(m_pbCommands, SIGNAL(clicked()), this, SLOT(slotConfigure()));
}
예제 #27
0
void MainWindow::initUI()
{
    // Build menu and tool bars
    setToolBarsMovable( false );

    m_menuBar.setHorizontalStretchable( true );
    QMenuBar *mb = new QMenuBar( &m_menuBar );
    mb->setMargin( 0 );

    // Find toolbar
    addToolBar( &m_findBar, QMainWindow::Top, true );
    m_findBar.setHorizontalStretchable( true );
    m_findEdit = new QLineEdit( &m_findBar );
    QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) );
    m_findBar.setStretchableWidget( m_findEdit );
    connect( m_findEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotFindChanged(const QString&)) );

    // Packages menu
    QPopupMenu *popup = new QPopupMenu( this );

    QAction *a = new QAction( tr( "Update lists" ), Opie::Core::OResource::loadPixmap( "packagemanager/update",
                              Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
    a->setWhatsThis( tr( "Tap here to update package lists from servers." ) );
    connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) );
    a->addTo( popup );
    a->addTo( &m_toolBar );

    QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Opie::Core::OResource::loadPixmap( "packagemanager/upgrade",
                                          Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
    actionUpgrade->setWhatsThis( tr( "Tap here to upgrade all installed packages if a newer version is available." ) );
    connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) );
    actionUpgrade->addTo( popup );
    actionUpgrade->addTo( &m_toolBar );

    QPixmap iconDownload = Opie::Core::OResource::loadPixmap( "packagemanager/download", Opie::Core::OResource::SmallIcon );
    QPixmap iconRemove = Opie::Core::OResource::loadPixmap( "packagemanager/remove", Opie::Core::OResource::SmallIcon );
    QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 );
    actionDownload->setWhatsThis( tr( "Tap here to download the currently selected package(s)." ) );
    connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) );
#ifndef USE_LIBOPKG
    actionDownload->addTo( popup );
    actionDownload->addTo( &m_toolBar );
#endif

    a = new QAction( tr( "Apply changes" ), Opie::Core::OResource::loadPixmap( "packagemanager/apply",
                     Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
    a->setWhatsThis( tr( "Tap here to install, remove or upgrade currently selected package(s)." ) );
    connect( a, SIGNAL(activated()), this, SLOT(slotApply()) );
    a->addTo( popup );
    a->addTo( &m_toolBar );

    a = new QAction( tr( "Install local package" ), Opie::Core::OResource::loadPixmap( "folder",
                     Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
    a->setWhatsThis( tr( "Tap here to install a package file located on device." ) );
    connect( a, SIGNAL(activated()), this, SLOT(slotInstallLocal()) );
    a->addTo( popup );
    //a->addTo( &m_toolBar );

    popup->insertSeparator();

    a = new QAction( tr( "Configure" ), Opie::Core::OResource::loadPixmap( "SettingsIcon",
                     Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
    a->setWhatsThis( tr( "Tap here to configure this application." ) );
    connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) );
    a->addTo( popup );
    mb->insertItem( tr( "Actions" ), popup );

    // View menu
    popup = new QPopupMenu( this );

    m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 );
    m_actionShowNotInstalled->setToggleAction( true );
    m_actionShowNotInstalled->setWhatsThis( tr( "Tap here to show packages available which have not been installed." ) );
    connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) );
    m_actionShowNotInstalled->addTo( popup );

    m_actionShowInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 );
    m_actionShowInstalled->setToggleAction( true );
    m_actionShowInstalled->setWhatsThis( tr( "Tap here to show packages currently installed on this device." ) );
    connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) );
    m_actionShowInstalled->addTo( popup );

    m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 );
    m_actionShowUpdated->setToggleAction( true );
    m_actionShowUpdated->setWhatsThis( tr( "Tap here to show packages currently installed on this device which have a newer version available." ) );
    connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) );
    m_actionShowUpdated->addTo( popup );

    popup->insertSeparator();

    m_actionFilter = new QAction( tr( "Filter" ), Opie::Core::OResource::loadPixmap( "packagemanager/filter",
                                  Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
    m_actionFilter->setToggleAction( true );
    m_actionFilter->setWhatsThis( tr( "Tap here to apply current filter." ) );
    connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) );
    m_actionFilter->addTo( popup );

    a = new QAction( tr( "Filter settings" ),  QString::null, 0, this, 0 );
    a->setWhatsThis( tr( "Tap here to change the package filter criteria." ) );
    connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) );
    a->addTo( popup );

    popup->insertSeparator();

    a = new QAction( tr( "Find" ), Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ),
                     QString::null, 0, this, 0 );
    a->setWhatsThis( tr( "Tap here to search for text in package names." ) );
    connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) );
    a->addTo( popup );

    m_actionFindNext = new QAction( tr( "Find next" ), Opie::Core::OResource::loadPixmap( "next",
                                    Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
    m_actionFindNext->setEnabled( false );
    m_actionFindNext->setWhatsThis( tr( "Tap here to find the next package name containing the text you are searching for." ) );
    connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) );
    m_actionFindNext->addTo( popup );
    m_actionFindNext->addTo( &m_findBar );

    mb->insertItem( tr( "View" ), popup );

    // Finish find toolbar creation
    a = new QAction( QString::null, Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ),
                     QString::null, 0, this, 0 );
    a->setWhatsThis( tr( "Tap here to hide the find toolbar." ) );
    connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) );
    a->addTo( &m_findBar );
    m_findBar.hide();
}
예제 #28
0
void KMJobViewer::initActions()
{
    // job actions
    KAction	*hact = new KAction(i18n("&Hold"),"stop",0,this,SLOT(slotHold()),actionCollection(),"job_hold");
    KAction	*ract = new KAction(i18n("&Resume"),"run",0,this,SLOT(slotResume()),actionCollection(),"job_resume");
    KAction	*dact = new KAction(i18n("Remo&ve"),"edittrash",Qt::Key_Delete,this,SLOT(slotRemove()),actionCollection(),"job_remove");
    KAction *sact = new KAction(i18n("Res&tart"),"redo",0,this,SLOT(slotRestart()),actionCollection(),"job_restart");
    KActionMenu *mact = new KActionMenu(i18n("&Move to Printer"),"fileprint",actionCollection(),"job_move");
    mact->setDelayed(false);
    connect(mact->popupMenu(),SIGNAL(activated(int)),SLOT(slotMove(int)));
    connect(mact->popupMenu(),SIGNAL(aboutToShow()),KMTimer::self(),SLOT(hold()));
    connect(mact->popupMenu(),SIGNAL(aboutToHide()),KMTimer::self(),SLOT(release()));
    connect(mact->popupMenu(),SIGNAL(aboutToShow()),SLOT(slotShowMoveMenu()));
    KToggleAction	*tact = new KToggleAction(i18n("&Toggle Completed Jobs"),"history",0,actionCollection(),"view_completed");
    tact->setEnabled(m_manager->actions() & KMJob::ShowCompleted);
    connect(tact,SIGNAL(toggled(bool)),SLOT(slotShowCompleted(bool)));
    KToggleAction	*uact = new KToggleAction(i18n("Show Only User Jobs"), "personal", 0, actionCollection(), "view_user_jobs");
    uact->setCheckedState(KGuiItem(i18n("Hide Only User Jobs"),"personal"));
    connect(uact, SIGNAL(toggled(bool)), SLOT(slotUserOnly(bool)));
    m_userfield = new QLineEdit(0);
    m_userfield->setText(getenv("USER"));
    connect(m_userfield, SIGNAL(returnPressed()), SLOT(slotUserChanged()));
    connect(uact, SIGNAL(toggled(bool)), m_userfield, SLOT(setEnabled(bool)));
    m_userfield->setEnabled(false);
    m_userfield->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
    KWidgetAction	*ufact = new KWidgetAction(m_userfield, i18n("User Name"), 0, 0, 0, actionCollection(), "view_username");

    if (!m_pop)
    {
        m_pop = new QPopupMenu(this);
        connect(m_pop,SIGNAL(aboutToShow()),KMTimer::self(),SLOT(hold()));
        connect(m_pop,SIGNAL(aboutToHide()),KMTimer::self(),SLOT(release()));
        hact->plug(m_pop);
        ract->plug(m_pop);
        m_pop->insertSeparator();
        dact->plug(m_pop);
        mact->plug(m_pop);
        m_pop->insertSeparator();
        sact->plug(m_pop);
    }

    // Filter actions
    KActionMenu	*fact = new KActionMenu(i18n("&Select Printer"), "kdeprint_printer", actionCollection(), "filter_modify");
    fact->setDelayed(false);
    connect(fact->popupMenu(),SIGNAL(activated(int)),SLOT(slotPrinterSelected(int)));
    connect(fact->popupMenu(),SIGNAL(aboutToShow()),KMTimer::self(),SLOT(hold()));
    connect(fact->popupMenu(),SIGNAL(aboutToHide()),KMTimer::self(),SLOT(release()));
    connect(fact->popupMenu(),SIGNAL(aboutToShow()),SLOT(slotShowPrinterMenu()));

    if (!m_standalone)
    {
        KToolBar	*toolbar = toolBar();
        hact->plug(toolbar);
        ract->plug(toolbar);
        toolbar->insertSeparator();
        dact->plug(toolbar);
        mact->plug(toolbar);
        toolbar->insertSeparator();
        sact->plug(toolbar);
        toolbar->insertSeparator();
        tact->plug(toolbar);
        uact->plug(toolbar);
        ufact->plug(toolbar);
    }
    else
    {   // stand-alone application
        KStdAction::quit(kapp,SLOT(quit()),actionCollection());
        KStdAction::close(this,SLOT(slotClose()),actionCollection());
        KStdAction::preferences(this, SLOT(slotConfigure()), actionCollection());

        // refresh action
        new KAction(i18n("Refresh"),"reload",0,this,SLOT(slotRefresh()),actionCollection(),"refresh");

        // create status bar
        KStatusBar	*statusbar = statusBar();
        m_stickybox = new QCheckBox( i18n( "Keep window permanent" ), statusbar );
        statusbar->addWidget( m_stickybox, 1, false );
        statusbar->insertItem(" " + i18n("Max.: %1").arg(i18n("Unlimited"))+ " ", 0, 0, true);
        statusbar->setItemFixed(0);
        updateStatusBar();

        createGUI();
    }

    loadPluginActions();
    slotSelectionChanged();
}
예제 #29
0
StopmotionWidget::StopmotionWidget(MonitorManager *manager, KUrl projectFolder, QList< QAction* > actions, QWidget* parent) :
    QDialog(parent)
    , Ui::Stopmotion_UI()
    , m_projectFolder(projectFolder)
    , m_captureDevice(NULL)
    , m_sequenceFrame(0)
    , m_animatedIndex(-1)
    , m_animate(false)
    , m_manager(manager)
    , m_monitor(new StopmotionMonitor(manager, this))
{
    //setAttribute(Qt::WA_DeleteOnClose);
    //HACK: the monitor widget is hidden, it is just used to control the capturedevice from monitormanager
    m_monitor->setHidden(true);
    connect(m_monitor, SIGNAL(stopCapture()), this, SLOT(slotStopCapture()));
    m_manager->appendMonitor(m_monitor);
    QAction* analyse = new QAction(i18n("Send frames to color scopes"), this);
    analyse->setCheckable(true);
    analyse->setChecked(KdenliveSettings::analyse_stopmotion());
    connect(analyse, SIGNAL(triggered(bool)), this, SLOT(slotSwitchAnalyse(bool)));

    QAction* mirror = new QAction(i18n("Mirror display"), this);
    mirror->setCheckable(true);
    //mirror->setChecked(KdenliveSettings::analyse_stopmotion());
    connect(mirror, SIGNAL(triggered(bool)), this, SLOT(slotSwitchMirror(bool)));

    addActions(actions);
    setupUi(this);
    setWindowTitle(i18n("Stop Motion Capture"));
    setFont(KGlobalSettings::toolBarFont());

    live_button->setIcon(KIcon("camera-photo"));

    m_captureAction = actions.at(0);
    connect(m_captureAction, SIGNAL(triggered()), this, SLOT(slotCaptureFrame()));
    m_captureAction->setCheckable(true);
    m_captureAction->setChecked(false);
    capture_button->setDefaultAction(m_captureAction);

    connect(actions.at(1), SIGNAL(triggered()), this, SLOT(slotSwitchLive()));

    QAction *intervalCapture = new QAction(i18n("Interval capture"), this);
    intervalCapture->setIcon(KIcon("chronometer"));
    intervalCapture->setCheckable(true);
    intervalCapture->setChecked(false);
    capture_interval->setDefaultAction(intervalCapture);

    preview_button->setIcon(KIcon("media-playback-start"));
    capture_button->setEnabled(false);


    // Build config menu
    QMenu* confMenu = new QMenu;
    m_showOverlay = actions.at(2);
    connect(m_showOverlay, SIGNAL(triggered(bool)), this, SLOT(slotShowOverlay(bool)));
    overlay_button->setDefaultAction(m_showOverlay);
    //confMenu->addAction(m_showOverlay);

    m_effectIndex = KdenliveSettings::stopmotioneffect();
    QMenu* effectsMenu = new QMenu(i18n("Overlay effect"));
    QActionGroup* effectGroup = new QActionGroup(this);
    QAction* noEffect = new QAction(i18n("No Effect"), effectGroup);
    noEffect->setData(0);
    QAction* contrastEffect = new QAction(i18n("Contrast"), effectGroup);
    contrastEffect->setData(1);
    QAction* edgeEffect = new QAction(i18n("Edge detect"), effectGroup);
    edgeEffect->setData(2);
    QAction* brightEffect = new QAction(i18n("Brighten"), effectGroup);
    brightEffect->setData(3);
    QAction* invertEffect = new QAction(i18n("Invert"), effectGroup);
    invertEffect->setData(4);
    QAction* thresEffect = new QAction(i18n("Threshold"), effectGroup);
    thresEffect->setData(5);

    effectsMenu->addAction(noEffect);
    effectsMenu->addAction(contrastEffect);
    effectsMenu->addAction(edgeEffect);
    effectsMenu->addAction(brightEffect);
    effectsMenu->addAction(invertEffect);
    effectsMenu->addAction(thresEffect);
    QList <QAction*> list = effectsMenu->actions();
    for (int i = 0; i < list.count(); i++) {
        list.at(i)->setCheckable(true);
        if (list.at(i)->data().toInt() == m_effectIndex) {
            list.at(i)->setChecked(true);
        }
    }
    connect(effectsMenu, SIGNAL(triggered(QAction*)), this, SLOT(slotUpdateOverlayEffect(QAction*)));
    confMenu->addMenu(effectsMenu);

    QAction* showThumbs = new QAction(KIcon("image-x-generic"), i18n("Show sequence thumbnails"), this);
    showThumbs->setCheckable(true);
    showThumbs->setChecked(KdenliveSettings::showstopmotionthumbs());
    connect(showThumbs, SIGNAL(triggered(bool)), this, SLOT(slotShowThumbs(bool)));

    QAction* removeCurrent = new QAction(KIcon("edit-delete"), i18n("Delete current frame"), this);
    removeCurrent->setShortcut(Qt::Key_Delete);
    connect(removeCurrent, SIGNAL(triggered()), this, SLOT(slotRemoveFrame()));

    QAction* conf = new QAction(KIcon("configure"), i18n("Configure"), this);
    connect(conf, SIGNAL(triggered()), this, SLOT(slotConfigure()));

    confMenu->addAction(showThumbs);
    confMenu->addAction(removeCurrent);
    confMenu->addAction(analyse);
    confMenu->addAction(mirror);
    confMenu->addAction(conf);
    config_button->setIcon(KIcon("configure"));
    config_button->setMenu(confMenu);

    connect(sequence_name, SIGNAL(textChanged(const QString&)), this, SLOT(sequenceNameChanged(const QString&)));
    connect(sequence_name, SIGNAL(currentIndexChanged(int)), live_button, SLOT(setFocus()));

    // Video widget holder
    QVBoxLayout *layout = new QVBoxLayout;
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setSpacing(0);
    m_monitor->videoBox->setLineWidth(4);
    layout->addWidget(m_monitor->videoBox);

    if (KdenliveSettings::decklink_device_found()) {
        // Found a BlackMagic device
    }

    if (QFile::exists(KdenliveSettings::video4vdevice())) {
#ifdef USE_V4L
        // Video 4 Linux device detection
        for (int i = 0; i < 10; i++) {
            QString path = "/dev/video" + QString::number(i);
            if (QFile::exists(path)) {
                QStringList deviceInfo = V4lCaptureHandler::getDeviceName(path);
                if (!deviceInfo.isEmpty()) {
                    capture_device->addItem(deviceInfo.at(0), "v4l");
                    capture_device->setItemData(capture_device->count() - 1, path, Qt::UserRole + 1);
                    capture_device->setItemData(capture_device->count() - 1, deviceInfo.at(1), Qt::UserRole + 2);
                    if (path == KdenliveSettings::video4vdevice()) capture_device->setCurrentIndex(capture_device->count() - 1);
                }
            }
        }
#endif /* USE_V4L */
    }

    connect(capture_device, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDeviceHandler()));
    /*if (m_bmCapture) {
        connect(m_bmCapture, SIGNAL(frameSaved(const QString &)), this, SLOT(slotNewThumb(const QString &)));
        connect(m_bmCapture, SIGNAL(gotFrame(QImage)), this, SIGNAL(gotFrame(QImage)));
    } else live_button->setEnabled(false);*/

    m_frame_preview = new MyLabel(this);
    connect(m_frame_preview, SIGNAL(seek(bool)), this, SLOT(slotSeekFrame(bool)));
    connect(m_frame_preview, SIGNAL(switchToLive()), this, SLOT(slotSwitchLive()));
    layout->addWidget(m_frame_preview);
    m_frame_preview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    video_preview->setLayout(layout);

    //kDebug()<<video_preview->winId();

    QString profilePath;
    // Create MLT producer data
    if (capture_device->itemData(capture_device->currentIndex()) == "v4l") {
        // Capture using a video4linux device
        profilePath = KStandardDirs::locateLocal("appdata", "profiles/video4linux");
    }
    else {
        // Decklink capture
        profilePath = KdenliveSettings::current_profile();
    }

    m_captureDevice = new MltDeviceCapture(profilePath, m_monitor->videoSurface, this);
    m_captureDevice->sendFrameForAnalysis = KdenliveSettings::analyse_stopmotion();
    m_monitor->setRender(m_captureDevice);
    connect(m_captureDevice, SIGNAL(frameSaved(const QString &)), this, SLOT(slotNewThumb(const QString &)));

    live_button->setChecked(false);
    button_addsequence->setEnabled(false);
    connect(live_button, SIGNAL(toggled(bool)), this, SLOT(slotLive(bool)));
    connect(button_addsequence, SIGNAL(clicked(bool)), this, SLOT(slotAddSequence()));
    connect(preview_button, SIGNAL(clicked(bool)), this, SLOT(slotPlayPreview(bool)));
    connect(frame_list, SIGNAL(currentRowChanged(int)), this, SLOT(slotShowSelectedFrame()));
    connect(frame_list, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(slotShowSelectedFrame()));
    connect(this, SIGNAL(doCreateThumbs(QImage, int)), this, SLOT(slotCreateThumbs(QImage, int)));

    frame_list->addAction(removeCurrent);
    frame_list->setContextMenuPolicy(Qt::ActionsContextMenu);
    frame_list->setHidden(!KdenliveSettings::showstopmotionthumbs());
    parseExistingSequences();
    QTimer::singleShot(500, this, SLOT(slotLive()));
    connect(&m_intervalTimer, SIGNAL(timeout()), this, SLOT(slotCaptureFrame()));
    m_intervalTimer.setSingleShot(true);
    m_intervalTimer.setInterval(KdenliveSettings::captureinterval() * 1000);
}
예제 #30
0
파일: viewer.cpp 프로젝트: amkhlv/pdfviewer
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()));
}