Example #1
0
///////////////////////////////////////////////////////////
//                                                       //
// File Menu                                             //
//                                                       //
///////////////////////////////////////////////////////////
void WinImage::setupFileMenu()
{
  // Actions
  QAction* open = new QAction( "&Open", this );
  open->setShortcut( Qt::CTRL + Qt::Key_O );
  open->setStatusTip( "This will open a file");
  connect( open, SIGNAL( triggered() ), this, SLOT( slotOpen() ) );

  //QAction* save = new QAction( "&Save", this );
  //connect( save, SIGNAL( triggered() ), this, SLOT( save() ) );

  QAction* saveAs = new QAction( "Save &As", this );
  saveAs->setShortcut( Qt::CTRL + Qt::Key_A );
  connect( saveAs, SIGNAL( triggered() ), this, SLOT( slotSaveAs() ) );

  QAction* quit = new QAction( "&Quit", this );
  quit->setShortcut( Qt::CTRL + Qt::Key_Q );
  quit->setStatusTip("This will quit the application unconditionally");
  quit->setWhatsThis("This is a button, stupid!");
  connect( quit, SIGNAL( triggered() ), qApp, SLOT( quit() ) );

  // Menubarvoid Test::paintEvent( QPaintEvent* )

  QMenu* file = new QMenu( "&File", menuBar());
  menuBar()->addMenu( file);
  file->addAction( open);
  //file->addAction( save);
  file->addAction( saveAs);
  file->addAction( quit);
}
Example #2
0
void K3bDataFileView::setupActions()
{
  m_actionCollection = new KActionCollection( this );

  m_actionProperties = new KAction( i18n("Properties"), "misc", 0, this, SLOT(slotProperties()),
				    actionCollection(), "properties" );
  m_actionNewDir = new KAction( i18n("New Directory..."), "folder_new", CTRL+Key_N, this, SLOT(slotNewDir()),
				actionCollection(), "new_dir" );
  m_actionRemove = new KAction( i18n("Remove"), "editdelete", Key_Delete, this, SLOT(slotRemoveItem()),
				actionCollection(), "remove" );
  KShortcut renameShortCut( Key_F2 );
  renameShortCut.append( KShortcut(CTRL+Key_R) ); // backwards compatibility
  m_actionRename = new KAction( i18n("Rename"), "edit", renameShortCut, this, SLOT(slotRenameItem()),
				actionCollection(), "rename" );
  m_actionParentDir = new KAction( i18n("Parent Directory"), "up", 0, this, SLOT(slotParentDir()),
				   actionCollection(), "parent_dir" );
  m_actionOpen = new KAction( i18n("Open"), "fileopen", 0, this, SLOT(slotOpen()),
				   actionCollection(), "open" );

  m_popupMenu = new KActionMenu( m_actionCollection, "contextMenu" );
  m_popupMenu->insert( m_actionParentDir );
  m_popupMenu->insert( new KActionSeparator( this ) );
  m_popupMenu->insert( m_actionRename );
  m_popupMenu->insert( m_actionRemove );
  m_popupMenu->insert( m_actionNewDir );
  m_popupMenu->insert( new KActionSeparator( this ) );
  m_popupMenu->insert( m_actionOpen );
  m_popupMenu->insert( new KActionSeparator( this ) );
  m_popupMenu->insert( m_actionProperties );
  m_popupMenu->insert( new KActionSeparator( this ) );
  m_popupMenu->insert( m_view->actionCollection()->action("project_burn") );
}
MenuBar::MenuBar(QObject *parent) : QObject(parent)
{
    mMenuBar=new QMenuBar();
    mHostDialog=new QInputDialog();
    mFileDialog=new QFileDialog();


    QVector<QMenu*> listMenu;
    QList<QAction*> listActions;

    listMenu.append(new QMenu(tr("&File")));
    listMenu.append(new QMenu(tr("&Settings")));

    listActions.append(new QAction(tr("Open"),this));
    connect(listActions.at(0),SIGNAL(triggered()),this,SLOT(slotOpen()));
    listMenu.at(0)->addActions(listActions);
    listActions.clear();

    listActions.append(new QAction(tr("Host"),this));
    listActions.append(new QAction(tr("About"),this));
    connect(listActions.at(0),SIGNAL(triggered()),this,SLOT(slotHost()));
    connect(listActions.at(1),SIGNAL(triggered()),this,SLOT(slotAbout()));
    listMenu.at(1)->addActions(listActions);

    for(int cpt=0 ; cpt < listMenu.size() ; ++cpt)
    {
        mMenuBar->addMenu(listMenu.at(cpt));
    }
}
Example #4
0
MainWindow::MainWindow(const QUrl& url)
    : m_markpad(0)
    , m_recentFiles(0)
    , m_firstTextChange(false)
{
    m_markpad = new Markpado(this);
    
    setupAction();
    setupConnect();
    
    
    setCentralWidget(m_markpad);
    setupGUI(QSize(500,600), Default, "markpado.rc");
    guiFactory()->addClient(m_markpad->m_editor);
    setStandardToolBarMenuEnabled(true);
    
    // FIXME: make sure the config dir exists, any idea how to do it more cleanly?
    QDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation)).mkpath(QStringLiteral("."));    
    
    setAutoSaveSettings();
    readConfig();
    
    slotOpen(url);
    show();
}
MainWindow::MainWindow(QGLWidget *context, QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    connect(ui->actionOpen, SIGNAL(activated()), SLOT(slotOpen()));
    connect(ui->actionQuit, SIGNAL(activated()), SLOT(slotQuit()));

    m_displayWidget = new DisplayWidget(context, this);
    setCentralWidget(m_displayWidget);
}
Example #6
0
KMapDialog::KMapDialog(QWidget *parent)
    : QDialog(parent)
{
	ui.setupUi(this);
	m_btnOpen = ui.buttonBox->addButton(tr("Open..."), QDialogButtonBox::ActionRole);
    m_btnSave = ui.buttonBox->addButton(tr("Save As..."), QDialogButtonBox::ActionRole);
    m_btnOpen->setIcon(style()->standardIcon(QStyle::StandardPixmap(QStyle::SP_DialogOpenButton)));
    m_btnSave->setIcon(style()->standardIcon(QStyle::StandardPixmap(QStyle::SP_DialogSaveButton)));
	connect(m_btnOpen, SIGNAL(clicked()), SLOT(slotOpen()));
    connect(m_btnSave, SIGNAL(clicked()), SLOT(slotSave()));
}
Example #7
0
void MainWindow::setupAction()
{
    actionCollection()->addAction( KStandardAction::Close, "file_close", this, SLOT(slotClose()) );
    actionCollection()->addAction( KStandardAction::New, "file_new", this, SLOT(slotNew()) );
    actionCollection()->addAction( KStandardAction::Open, "file_open", this, SLOT(slotOpen()) );

    QAction *previewAction = actionCollection()->addAction("file_preview", this, SLOT(slotPreview()));
    previewAction->setIcon(QIcon::fromTheme(QLatin1String("document-preview")));
    previewAction->setText(i18n("Preview"));
    previewAction->setCheckable(true);
    actionCollection()->setDefaultShortcut(previewAction, QKeySequence("F8"));
    
    QAction *splitAction = actionCollection()->addAction("window_split", this, SLOT(slotSplit()));
    splitAction->setIcon(QIcon::fromTheme(QLatin1String("view-split-left-right")));
    splitAction->setText(i18n("Split"));
    splitAction->setCheckable(true);

    m_recentFiles = KStandardAction::openRecent(this, SLOT(slotOpen(QUrl)), this);
    actionCollection()->addAction(m_recentFiles->objectName(), m_recentFiles);
    m_recentFiles->setWhatsThis(i18n("This lists files which you have opened recently, and allows you to easily open them again."));
}
KoVersionDialog::KoVersionDialog(QWidget* parent, KoDocument *doc)
        : KoDialog(parent)
{
    setCaption(i18n("Version"));
    setButtons(Close);
    setDefaultButton(Close);
    m_doc = doc;

    QWidget* page = new QWidget(this);
    setMainWidget(page);
    setModal(true);

    QGridLayout* grid1 = new QGridLayout(page);

    list = new QTreeWidget(page);
    list->setColumnCount(3);
    QStringList h;
    h.append(i18n("Date & Time"));
    h.append(i18n("Saved By"));
    h.append(i18n("Comment"));
    list->setHeaderLabels(h);

    updateVersionList();

    grid1->addWidget(list, 0, 0, 9, 1);

    m_pAdd = new QPushButton(i18n("&Add"), page);
    grid1->addWidget(m_pAdd, 1, 2);

    m_pRemove = new QPushButton(i18n("&Remove"), page);
    grid1->addWidget(m_pRemove, 2, 2);

    m_pModify = new QPushButton(i18n("&Modify"), page);
    grid1->addWidget(m_pModify, 3, 2);

    m_pOpen = new QPushButton(i18n("&Open"), page);
    grid1->addWidget(m_pOpen, 4, 2);


    connect(m_pRemove, SIGNAL(clicked()), this, SLOT(slotRemove()));
    connect(m_pAdd, SIGNAL(clicked()), this, SLOT(slotAdd()));
    connect(m_pOpen, SIGNAL(clicked()), this, SLOT(slotOpen()));
    connect(m_pModify, SIGNAL(clicked()), this, SLOT(slotModify()));
    connect(list, SIGNAL(itemActivated(QTreeWidgetItem *, int)), this, SLOT(slotOpen()));

    updateButton();

    resize(600, 250);

}
Example #9
0
void KWrite::setupActions()
{
    m_closeAction = actionCollection()->addAction(KStandardAction::Close, QStringLiteral("file_close"), this, SLOT(slotFlush()));
    m_closeAction->setWhatsThis(i18n("Use this command to close the current document"));
    m_closeAction->setDisabled(true);

    // setup File menu
    actionCollection()->addAction(KStandardAction::New, QStringLiteral("file_new"), this, SLOT(slotNew()))
    ->setWhatsThis(i18n("Use this command to create a new document"));
    actionCollection()->addAction(KStandardAction::Open, QStringLiteral("file_open"), this, SLOT(slotOpen()))
    ->setWhatsThis(i18n("Use this command to open an existing document for editing"));

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

    QAction *a = actionCollection()->addAction(QStringLiteral("view_new_view"));
    a->setIcon(QIcon::fromTheme(QStringLiteral("window-new")));
    a->setText(i18n("&New Window"));
    connect(a, SIGNAL(triggered()), this, SLOT(newView()));
    a->setWhatsThis(i18n("Create another view containing the current document"));

    actionCollection()->addAction(KStandardAction::Quit, this, SLOT(close()))
    ->setWhatsThis(i18n("Close the current document view"));

    // setup Settings menu
    setStandardToolBarMenuEnabled(true);

    m_paShowMenuBar = KStandardAction::showMenubar(this, SLOT(toggleMenuBar()), actionCollection());

    m_paShowStatusBar = KStandardAction::showStatusbar(this, SLOT(toggleStatusBar()), this);
    actionCollection()->addAction(m_paShowStatusBar->objectName(), m_paShowStatusBar);
    m_paShowStatusBar->setWhatsThis(i18n("Use this command to show or hide the view's statusbar"));

    m_paShowPath = new KToggleAction(i18n("Sho&w Path in Titlebar"), this);
    actionCollection()->addAction(QStringLiteral("set_showPath"), m_paShowPath);
    connect(m_paShowPath, SIGNAL(triggered()), this, SLOT(documentNameChanged()));
    m_paShowPath->setWhatsThis(i18n("Show the complete document path in the window caption"));

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

    a = actionCollection()->addAction(KStandardAction::ConfigureToolbars, QStringLiteral("options_configure_toolbars"),
                                      this, SLOT(editToolbars()));
    a->setWhatsThis(i18n("Configure which items should appear in the toolbar(s)."));

    a = actionCollection()->addAction(QStringLiteral("help_about_editor"));
    a->setText(i18n("&About Editor Component"));
    connect(a, SIGNAL(triggered()), this, SLOT(aboutEditor()));
}
Example #10
0
void AnnoqtConfEditor::createActions()
{
  newAct = new QAction( QIcon( ":/filenew.xpm" ), tr( "&New" ), this );
  newAct->setShortcut( tr( "Ctrl+N" ) );
  newAct->setStatusTip( tr( "Create a new file" ) );
  connect( newAct, SIGNAL( triggered() ), this, SLOT( slotNewConfiguration() ) );

  openAct = new QAction( QIcon( ":/fileopen.xpm" ), tr( "&Open..." ), this );
  openAct->setShortcut( tr( "Ctrl+O" ) );
  openAct->setStatusTip( tr( "Open an existing file" ) );
  connect( openAct, SIGNAL( triggered() ), this, SLOT( slotOpen() ) );

  saveAct = new QAction( QIcon( ":/filesave.xpm" ), tr( "&Save" ), this );
  saveAct->setShortcut( tr( "Ctrl+S" ) );
  saveAct->setStatusTip( tr( "Save the document to disk" ) );
  connect( saveAct, SIGNAL( triggered() ), this, SLOT( slotSave() ) );

  saveAsAct = new QAction( tr( "Save &As..." ), this );
  saveAsAct->setStatusTip( tr( "Save the document under a new name" ) );
  connect( saveAsAct, SIGNAL( triggered() ), this, SLOT( slotSaveAs() ) );

  exitAct = new QAction( tr( "E&xit" ), this );
  exitAct->setShortcut( tr( "Ctrl+Q" ) );
  exitAct->setStatusTip( tr( "Exit the application" ) );
  connect( exitAct, SIGNAL( triggered() ), this, SLOT( close() ) );

  cutAct = new QAction( QIcon( ":/editcut.xpm" ), tr( "Cu&t" ), this );
  cutAct->setShortcut( tr( "Ctrl+X" ) );
  cutAct->setStatusTip( tr( "Cut the current selection's contents to the "
                            "clipboard" ) );
  connect( cutAct, SIGNAL( triggered() ), this, SLOT( slotCut() ) );

  addItemAction = new QAction( QIcon( ":/item.xpm" ), tr( "New entity type" ), this );
  addItemAction->setShortcut( tr( "Ctrl+E" ) );
  addItemAction->setStatusTip( tr( "Add a new entity type" ) );
  connect( addItemAction, SIGNAL( triggered() ), this, SLOT( slotAddItemAction() ) );
  
  aboutAct = new QAction( tr( "&About" ), this );
  aboutAct->setStatusTip( tr( "Show the application's About box" ) );
  connect( aboutAct, SIGNAL( triggered() ), this, SLOT( slotAbout() ) );

  aboutQtAct = new QAction( tr( "About &Qt" ), this );
  aboutQtAct->setStatusTip( tr( "Show the Qt library's About box" ) );
  connect( aboutQtAct, SIGNAL( triggered() ), qApp, SLOT( aboutQt() ) );

  cutAct->setEnabled( true );
}
Example #11
0
KonqSessionDlg::KonqSessionDlg( KonqViewManager *manager, QWidget *parent )
    : KDialog( parent )
    , d( new KonqSessionDlgPrivate( manager, this ) )
{
    d->layout()->setMargin( 0 );
    setMainWidget( d );
    
    setObjectName( QLatin1String( "konq_session_dialog" ) );
    setModal( true );
    setCaption( i18nc( "@title:window", "Manage Sessions" ) );
    setButtons( BTN_OPEN | Close );
    setDefaultButton( Close );
    
    setButtonGuiItem( BTN_OPEN, KGuiItem( i18n( "&Open" ), "document-open" ) );
    d->m_pSaveCurrentButton->setIcon(KIcon("document-save"));
    d->m_pRenameButton->setIcon(KIcon("edit-rename"));
    d->m_pDeleteButton->setIcon(KIcon("edit-delete"));
    d->m_pNewButton->setIcon(KIcon("document-new"));
    
    QString dir = KStandardDirs::locateLocal("appdata", "sessions/");
    
    d->m_pModel = new KDirModel(d->m_pListView);
    d->m_pModel->sort(QDir::Name);
    d->m_pModel->dirLister()->setDirOnlyMode(true);
    d->m_pModel->dirLister()->openUrl(dir);
    d->m_pListView->setModel(d->m_pModel);
    
    d->m_pListView->setMinimumSize( d->m_pListView->sizeHint() );
    
    connect( d->m_pListView->selectionModel(), SIGNAL( selectionChanged(
        const QItemSelection  &, const QItemSelection &) ), this, SLOT(
        slotSelectionChanged() ) );
    
    enableButton( BTN_OPEN, d->m_pListView->currentIndex().isValid() );
    slotSelectionChanged();

    d->m_pOpenTabsInsideCurrentWindow->setChecked(
	KonqSettings::openTabsInsideCurrentWindow());

    connect( this,SIGNAL(user1Clicked()),SLOT(slotOpen()));
    connect( d->m_pNewButton, SIGNAL(clicked()),SLOT(slotNew()));
    connect( d->m_pSaveCurrentButton, SIGNAL(clicked()),SLOT(slotSave()));
    connect( d->m_pRenameButton, SIGNAL(clicked()),SLOT(slotRename()));
    connect( d->m_pDeleteButton, SIGNAL(clicked()),SLOT(slotDelete()));
    
    resize( sizeHint() );
}
Example #12
0
XSDMainWindow::XSDMainWindow(const QStringList &files ){
	setupUi();
	editor = KTextEditor::Editor::instance();

	QUrl url;
	for( auto &file : files ){
		const QRegularExpression withProtocol(QStringLiteral("^[a-zA-Z]+://")); // TODO: remove after Qt supports this on its own

    if (withProtocol.match(file).hasMatch()) {
      url = QUrl::fromUserInput(file);
    } else {
      url = QUrl::fromLocalFile(QDir::current().absoluteFilePath(file));
    }

    if (url.isLocalFile() && QFile::exists(file)) {
			slotOpen(url);
		}
	}
}
MainWindow::MainWindow() :
    m_qrcEditor(new  SharedTools::QrcEditor())
{
    m_qrcEditor->setResourceDragEnabled(true);
    setWindowTitle(QLatin1String("Test resource editor"));
    QMenu* fMenu = menuBar()->addMenu(QLatin1String("File"));

    QAction* oa = fMenu->addAction(QLatin1String("Open..."));
    connect(oa, SIGNAL(triggered()), this, SLOT(slotOpen()));

    QAction* sa = fMenu->addAction(QLatin1String("Save"));
    connect(sa, SIGNAL(triggered()), this, SLOT(slotSave()));

    QAction* xa = fMenu->addAction(QLatin1String("Exit!"));
    connect(xa, SIGNAL(triggered()), this, SLOT(close()));


    QWidget *cw = new QWidget();
    setCentralWidget(cw);
    QVBoxLayout *lt = new QVBoxLayout(cw);
    lt->addWidget(m_qrcEditor);
    setMinimumSize(QSize(500, 500));
}
Example #14
0
void MainWindow::slotOpen()
{
    QUrl url = KEncodingFileDialog::getOpenUrlAndEncoding().URLs.first();
    
    slotOpen(url);
}
Example #15
0
void KMMimePartTree::itemRightClicked( QListViewItem* item,
                                       const QPoint& point )
{
    // TODO: remove this member var?
    mCurrentContextMenuItem = dynamic_cast<KMMimePartTreeItem*>( item );
    if ( 0 == mCurrentContextMenuItem ) {
        kdDebug(5006) << "Item was not a KMMimePartTreeItem!" << endl;
    }
    else {
        kdDebug(5006) << "\n**\n** KMMimePartTree::itemRightClicked() **\n**" << endl;

        QPopupMenu* popup = new QPopupMenu;
        if ( mCurrentContextMenuItem->node()->nodeId() > 2 &&
             mCurrentContextMenuItem->node()->typeString() != "Multipart" ) {
          popup->insertItem( SmallIcon("fileopen"), i18n("to open", "Open"), this, SLOT(slotOpen()) );
          popup->insertItem( i18n("Open With..."), this, SLOT(slotOpenWith()) );
          popup->insertItem( i18n("to view something", "View"), this, SLOT(slotView()) );
        }
        popup->insertItem( SmallIcon("filesaveas"),i18n( "Save &As..." ), this, SLOT( slotSaveAs() ) );
        /*
         * FIXME mkae optional?
        popup->insertItem( i18n( "Save as &Encoded..." ), this,
                           SLOT( slotSaveAsEncoded() ) );
        */
        popup->insertItem( i18n( "Save All Attachments..." ), this,
                           SLOT( slotSaveAll() ) );
        // edit + delete only for attachments
        if ( mCurrentContextMenuItem->node()->nodeId() > 2 &&
             mCurrentContextMenuItem->node()->typeString() != "Multipart" ) {
          popup->insertItem( SmallIcon("editcopy"), i18n("Copy"), this, SLOT(slotCopy()) );
          if ( GlobalSettings::self()->allowAttachmentDeletion() )
            popup->insertItem( SmallIcon("editdelete"), i18n( "Delete Attachment" ),
                               this, SLOT( slotDelete() ) );
          if ( GlobalSettings::self()->allowAttachmentEditing() )
            popup->insertItem( SmallIcon( "edit" ), i18n( "Edit Attachment" ),
                               this, SLOT( slotEdit() ) );
        }
        if ( mCurrentContextMenuItem->node()->nodeId() > 0 )
          popup->insertItem( i18n("Properties"), this, SLOT(slotProperties()) );
        popup->exec( point );
        delete popup;
        mCurrentContextMenuItem = 0;
    }
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent)
{

    FileDock *filedock = new FileDock("Files", this);
    filedock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);

    QTreeWidget *tree = new QTreeWidget(this);

    filedock->setWidget(tree);

    addDockWidget(Qt::LeftDockWidgetArea, filedock);

    QTabWidget *tab = new QTabWidget(this);


    this->setCentralWidget(tab);

    editor = new TextEdit(this);
    tab->addTab(editor,"Hello");

    QToolBar *toolbar = new QToolBar("mainbar", this);
    this->addToolBar(toolbar);

    QMenuBar *menubar = new QMenuBar(this);
    this->setMenuBar(menubar);

    QMenu *projectMenu = new QMenu(menubar);
    projectMenu->setTitle("Project");

    menubar->addMenu(projectMenu);

    QMenu *buildMenu = new QMenu(menubar);
    buildMenu->setTitle("Build");
    menubar->addMenu(buildMenu);

    QMenu *deployMenu = new QMenu(menubar);
    deployMenu->setTitle("Deploy");
    menubar->addMenu(deployMenu);

    open = new QAction(QIcon(":/images/open.png"), "Open",this);
    open->setStatusTip("Open project");
    open->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));

    save = new QAction(QIcon(":/images/save.png"), "Save", this);
    save->setStatusTip("Save project");
    save->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));

    create = new QAction(QIcon(":/images/new.png"), "Create", this);
    create->setStatusTip("Create project");
    create->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N));

    toolbar->addAction(create);
    toolbar->addAction(open);
    toolbar->addAction(save);

    projectMenu->addAction(create);
    projectMenu->addAction(open);
    projectMenu->addAction(save);

    connect(open, SIGNAL(triggered()), this, SLOT(slotOpen()));
    connect(save, SIGNAL(triggered()), this, SLOT(slotSave()));

}
Example #17
0
void KWrite::slotOpen()
{
    const QList<QUrl> urls = QFileDialog::getOpenFileUrls(this, i18n("Open File"), m_view->document()->url());
    Q_FOREACH(QUrl url, urls) {
        slotOpen(url);
    }
Example #18
0
    // buttons
    QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
    hb->addWidget(buttonBox);

    QPushButton *cancelButton = new QPushButton();
    KGuiItem::assign(cancelButton, KStandardGuiItem::quit());
    connect(cancelButton, SIGNAL(clicked()), this, SLOT(slotCancel()));
    buttonBox->addButton(cancelButton, QDialogButtonBox::RejectRole);

    m_openButton = new QPushButton(QIcon::fromTheme(QStringLiteral("document-open")), i18n("Open Session"));
    m_openButton->setEnabled(m_sessions->currentIndex().isValid());
    m_openButton->setDefault(true);
    m_openButton->setFocus();
    buttonBox->addButton(m_openButton, QDialogButtonBox::ActionRole);
    connect(m_openButton, SIGNAL(clicked()), this, SLOT(slotOpen()));

    QPushButton *newButton = new QPushButton(QIcon::fromTheme(QStringLiteral("document-new")), i18n("New Session"));
    buttonBox->addButton(newButton, QDialogButtonBox::ActionRole);
    connect(newButton, SIGNAL(clicked()), this, SLOT(slotNew()));

    setResult(resultNone);
    selectionChanged(NULL, NULL);
}

KateSessionChooser::~KateSessionChooser()
{}

void KateSessionChooser::slotCopySession()
{
    m_sessions->setCurrentItem((KateSessionChooserItem *)((QAction *)sender())->data().value<void *>());
Example #19
0
MainWindow::MainWindow(QWidget *parent)
	: QMainWindow(parent)
	, m_ui(new Ui::MainWindow)
	, m_inst(0)
	, m_aspect(-1)
	, m_preview(0)
	, m_previewDock(0)
	, m_posBoxLock(false)
	, m_accelBoxLock(false)
	, m_pos(0)
	, m_setPosLock(false)
{
	static_mainWindow = this;
	m_ui->setupUi(this);

	setWindowTitle("Teleprompter - DViz");
	setWindowIcon(QIcon(":/data/icon-d.png"));

	connect(m_ui->actionOpen_Text_File, SIGNAL(triggered()), this, SLOT(slotOpen()));
	connect(m_ui->actionSave, SIGNAL(triggered()), this, SLOT(slotSave()));
	connect(m_ui->actionSave_As, SIGNAL(triggered()), this, SLOT(slotSaveAs()));
	connect(m_ui->actionSetup_Outputs, SIGNAL(triggered()), this, SLOT(slotOutputSetup()));
	connect(m_ui->actionExit, SIGNAL(triggered()), this, SLOT(slotExit()));
	
	m_ui->playBtn->setIcon(QIcon(":/data/action-play.png"));
	connect(m_ui->playBtn, SIGNAL(clicked()), this, SLOT(slotTogglePlay()));
	
	connect(m_ui->posBox, SIGNAL(valueChanged(int)), this, SLOT(slotPosBoxChanged(int)));
	connect(m_ui->accelBox, SIGNAL(valueChanged(int)), this, SLOT(slotAccelBoxChanged(int)));
	connect(m_ui->accelResetBtn, SIGNAL(clicked()), this, SLOT(slotResetAccel()));
	m_ui->accelResetBtn->setIcon(QIcon(":/data/stock-undo.png"));
	m_ui->accelResetBtn->setToolTip("Reset to Normal Speed (CTRL+SHIFT+Z)");
	m_ui->accelResetBtn->setShortcut(QString(tr("CTRL+SHIFT+Z")));
	
	connect(&m_animTimer, SIGNAL(timeout()), this, SLOT(animate()));
	m_animTimer.setInterval(ANIMATE_BASE_MS);
	
	m_editor = new RichTextEditorWidget(m_ui->mainWidget);
	QLayoutItem * firstItem = m_ui->mainWidget->layout()->takeAt(0);
	m_ui->mainWidget->layout()->addWidget(m_editor);
	m_ui->mainWidget->layout()->addItem(firstItem);
	
	connect(m_editor, SIGNAL(contentsChanged()), this, SLOT(slotTextChanged()));
	
	m_ui->actionSetup_Outputs->setIcon(QIcon(":data/stock-preferences.png"));

	QSettings s;
	bool flag = s.value("teleprompter/firstrun",true).toBool();
	if(flag)
	{
		s.setValue("teleprompter/firstrun",false);
		slotOutputSetup();
	}
	
	AppSettings::setGridEnabled(false);
	

	Output * output = AppSettings::outputs().first();
	m_previewDock = new QDockWidget(QString(tr("%1 Preiew")).arg(output->name()), this);
	m_previewDock->setObjectName(output->name());

	m_preview = new OutputViewer(0,m_previewDock);
	m_previewDock->setWidget(m_preview);
	addDockWidget(Qt::BottomDockWidgetArea, m_previewDock);
	
	m_group = new SlideGroup();
	m_group->setGroupTitle("Group"); //AbstractItem::guessTitle(QFileInfo(fileName).baseName()));
		
	m_slide = new Slide();
	
	m_textbox = new TextBoxItem();
	m_textbox->setItemId(ItemFactory::nextId());
	m_textbox->setItemName(QString("TextBoxItem%1").arg(m_textbox->itemId()));



	AbstractVisualItem * bg = dynamic_cast<AbstractVisualItem*>(m_slide->background());

// 	qDebug() << "Slide "<<slideNum<<": [\n"<<tmpList.join("\n")<<"\n]";;

	bg->setFillType(AbstractVisualItem::Solid);
	bg->setFillBrush(Qt::black);


	// Outline pen for the text
	QPen pen = QPen(Qt::black,1.5);
	pen.setJoinStyle(Qt::MiterJoin);

	m_textbox->setPos(QPointF(0,0));
	m_textbox->setOutlinePen(pen);
	m_textbox->setOutlineEnabled(true);
	m_textbox->setFillBrush(Qt::white);
	m_textbox->setFillType(AbstractVisualItem::Solid);
	m_textbox->setShadowEnabled(false);
// 	m_textbox->setShadowBrush(Qt::red);
//  	m_textbox->setShadowBlurRadius(3);

	m_slide->addItem(m_textbox);
	
	m_slide->setSlideNumber(0);
	m_group->addSlide(m_slide);
	
	openOutput();
	
	m_inst->setSlideGroup(m_group);
	
	openTextFile("test.txt");
	
}
Example #20
0
BlitzMainWindow::BlitzMainWindow()
    : QMainWindow()
{
    setWindowTitle(tr("Blitz Effect Test"));
    QScrollArea *sa = new QScrollArea(this);
    lbl = new QLabel;
    sa->setWidget(lbl);
    setCentralWidget(sa);

    QToolBar *tBar = addToolBar(tr("Effect Options"));
    QAction *openAct = tBar->addAction(tr("Open"), this, SLOT(slotOpen()));
    QAction *revertAct = tBar->addAction(tr("Revert"), this, SLOT(slotRevert()));
    qualityCB = new QCheckBox(tr("High Quality"), tBar);
    qualityCB->setChecked(true);
    tBar->addWidget(qualityCB);

    QMenuBar *mBar = menuBar();
    QMenu *fileMnu = mBar->addMenu(tr("File"));
    fileMnu->addAction(openAct);
    fileMnu->addAction(revertAct);
    fileMnu->addSeparator();
    fileMnu->addAction(tr("Close"), this, SLOT(close()));

    QMenu *effectMnu = mBar->addMenu(tr("Effects"));
    effectMnu->addAction(tr("Grayscale (MMX)"), this, SLOT(slotGrayscale()));
    effectMnu->addAction(tr("Invert (MMX)"), this, SLOT(slotInvert()));

    QMenu *subMnu = effectMnu->addMenu(tr("Threshold"));
    subMnu->addAction(tr("Threshold (Default)"), this, SLOT(slotThreshold()));
    subMnu->addAction(tr("Threshold (Red)"), this, SLOT(slotThresholdRed()));
    subMnu->addAction(tr("Threshold (Green)"), this, SLOT(slotThresholdGreen()));
    subMnu->addAction(tr("Threshold (Blue)"), this, SLOT(slotThresholdBlue()));
    subMnu->addAction(tr("Threshold (Alpha)"), this, SLOT(slotThresholdAlpha()));
    subMnu = effectMnu->addMenu(tr("Intensity (MMX)"));
    subMnu->addAction(tr("Increment Intensity"), this, SLOT(slotIncIntensity()));
    subMnu->addAction(tr("Decrement Intensity"), this, SLOT(slotDecIntensity()));
    subMnu->addSeparator();
    subMnu->addAction(tr("Increment Red Intensity"), this, SLOT(slotIncRedIntensity()));
    subMnu->addAction(tr("Decrement Red Intensity"), this, SLOT(slotDecRedIntensity()));
    subMnu->addAction(tr("Increment Green Intensity"), this, SLOT(slotIncGreenIntensity()));
    subMnu->addAction(tr("Decrement Green Intensity"), this, SLOT(slotDecGreenIntensity()));
    subMnu->addAction(tr("Increment Blue Intensity"), this, SLOT(slotIncBlueIntensity()));
    subMnu->addAction(tr("Decrement Blue Intensity"), this, SLOT(slotDecBlueIntensity()));
    effectMnu->addSeparator();

    effectMnu->addAction(tr("Spiff"), this, SLOT(slotSpiff()));
    effectMnu->addAction(tr("Dull"), this, SLOT(slotDull()));
    effectMnu->addSeparator();
    effectMnu->addAction(tr("Desaturate"), this, SLOT(slotDesaturate()));
    effectMnu->addAction(tr("Fade"), this, SLOT(slotFade()));
    effectMnu->addAction(tr("Flatten"), this, SLOT(slotFlatten()));
    effectMnu->addSeparator();
    effectMnu->addAction(tr("Sharpen"), this, SLOT(slotSharpen()));
    effectMnu->addAction(tr("Blur"), this, SLOT(slotBlur()));
    effectMnu->addAction(tr("Gaussian Sharpen (MMX)"), this, SLOT(slotGaussianSharpen()));
    effectMnu->addAction(tr("Gaussian Blur (MMX)"), this, SLOT(slotGaussianBlur()));
    effectMnu->addSeparator();

    effectMnu->addAction(tr("Sobel Edge (MMX)"), this, SLOT(slotEdge()));
    effectMnu->addAction(tr("Convolve Edge (MMX)"), this, SLOT(slotConvolveEdge()));
    effectMnu->addSeparator();

    effectMnu->addAction(tr("Equalize"), this, SLOT(slotEqualize()));
    effectMnu->addAction(tr("Normalize"), this, SLOT(slotNormalize()));
    effectMnu->addAction(tr("Despeckle"), this, SLOT(slotDespeckle()));
    effectMnu->addSeparator();

    effectMnu->addAction(tr("Charcoal"), this, SLOT(slotCharcoal()));
    effectMnu->addAction(tr("Swirl"), this, SLOT(slotSwirl()));
    effectMnu->addAction(tr("Implode"), this, SLOT(slotImplode()));
    effectMnu->addAction(tr("Wave"), this, SLOT(slotWave()));
    effectMnu->addAction(tr("Oil Paint"), this, SLOT(slotOilpaint()));
    effectMnu->addAction(tr("Emboss"), this, SLOT(slotEmboss()));
    effectMnu->addSeparator();

    effectMnu->addAction(tr("Smoothscale (MMX)..."), this, SLOT(slotSmoothscale()));
    effectMnu->addAction(tr("Smoothscale Filtered..."), this, SLOT(slotSmoothscaleFiltered()));
    effectMnu->addSeparator();
    effectMnu->addAction(tr("Modulate..."), this, SLOT(slotModulate()));
    effectMnu->addSeparator();

    effectMnu->addAction(tr("Gradient..."), this, SLOT(slotGradient()));
    effectMnu->addAction(tr("Unbalanced Gradient..."), this, SLOT(slotUnbalancedGradient()));
    effectMnu->addAction(tr("8bpp Gradient..."), this, SLOT(slotGrayscaleGradient()));
    effectMnu->addAction(tr("8bpp Unbalanced Gradient..."), this, SLOT(slotGrayscaleUnbalancedGradient()));

    resize(sizeHint());
}