コード例 #1
0
ファイル: tscoremeasure.cpp プロジェクト: SeeLook/nootka
void TscoreMeasure::fill() {
  QList<TscoreNote*> notesToShift;
  int remainDur = m_staff->shiftFromMeasure(id() + 1, m_free, notesToShift);
  qDebug() << debug() << "fill, remain" << remainDur << "to shift:" << notesToShift.count();
  for (int i = 0; i < notesToShift.size(); ++i) {
    m_notes.append(notesToShift[i]);
    connect(notesToShift[i], &TscoreNote::noteGoingToChange, this, &TscoreMeasure::noteChangedSlot);
  }
  if (remainDur) { // next measure has a part of a new note
      qDebug() << debug() << remainDur << "remained in the next measure";
      auto firstInNext = m_staff->measures()[id() + 1]->firstNote()->note();
      Tnote newNote(*firstInNext, Trhythm(remainDur, firstInNext->isRest()));
      auto inserted = m_staff->insertNote(newNote, lastNoteId() + 1, lastNote()->isReadOnly());
//       copyRhythmParams(inserted, firstInNext->rtm);
      fixStemDirection(inserted);
      insertNote(inserted->index() - firstNoteId(), inserted);
      m_staff->updateNotesPos();
      if (!inserted->note()->isRest()) // add a tie
        inserted->tieWithNext();
  } else {
      updateRhythmicGroups();
      resolveBeaming(0);
      checkBarLine();
  }

  content(this);
}
コード例 #2
0
void FluidInstrument::addNoteParam(InstrumentParameter param, bool dampable = true)
{
    FluidNote newNote(0, name, param.noteType);
    newNote.setStatus(ON);
    newNote.setSource(param.source);
    newNote.setDirty();
    newNote.isDampable = dampable;
    (param.noteType == INSTRUMENT_PLAYS_CC) ? newNote.setCCchan(param.channel) : newNote.setCCchan(0);
    
    noteParams.push_back(newNote);
}
コード例 #3
0
void InstrumentTrack::processOutEvent( const MidiEvent& event, const MidiTime& time, f_cnt_t offset )
{
	// do nothing if we do not have an instrument instance (e.g. when loading settings)
	if( m_instrument == NULL )
	{
		return;
	}

	const MidiEvent transposedEvent = applyMasterKey( event );
	const int key = transposedEvent.key();

	switch( event.type() )
	{
		case MidiNoteOn:
			m_midiNotesMutex.lock();
			m_piano.setKeyState( event.key(), true );	// event.key() = original key

			if( key >= 0 && key < NumKeys )
			{
				if( m_runningMidiNotes[key] > 0 )
				{
					m_instrument->handleMidiEvent( MidiEvent( MidiNoteOff, midiPort()->realOutputChannel(), key, 0 ), time, offset );
				}
				++m_runningMidiNotes[key];
				m_instrument->handleMidiEvent( MidiEvent( MidiNoteOn, midiPort()->realOutputChannel(), key, event.velocity() ), time, offset );

			}
			m_midiNotesMutex.unlock();
			emit newNote();
			break;

		case MidiNoteOff:
			m_midiNotesMutex.lock();
			m_piano.setKeyState( event.key(), false );	// event.key() = original key

			if( key >= 0 && key < NumKeys && --m_runningMidiNotes[key] <= 0 )
			{
				m_instrument->handleMidiEvent( MidiEvent( MidiNoteOff, midiPort()->realOutputChannel(), key, 0 ), time, offset );
			}
			m_midiNotesMutex.unlock();
			break;

		default:
			m_instrument->handleMidiEvent( transposedEvent, time, offset );
			break;
	}

	// if appropriate, midi-port does futher routing
	m_midiPort.processOutEvent( event, time );
}
コード例 #4
0
ファイル: NotepadPlugin.cpp プロジェクト: KhuramAli/lumina
NotePadPlugin::NotePadPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID){
  QVBoxLayout *vlay = new QVBoxLayout();
  this->setLayout( new QVBoxLayout() );
    this->layout()->setContentsMargins(0,0,0,0);
    vlay->setContentsMargins(3,3,3,3);
    frame = new QFrame(this);
      frame->setObjectName("notepadbase");
      frame->setStyleSheet("QFrame#notepadbase{border-size: 1px; background: rgba(255,255,255,50); color: black;} QFrame{ border: none; border-radius: 3px; background: rgba(255,255,255,100); color: black;}");
    this->layout()->addWidget(frame);
    frame->setLayout(vlay);
   
  //Setup the title bar header buttons
  QHBoxLayout *hlay = new QHBoxLayout();
  next = new QToolButton(this);
    next->setAutoRaise(true);
  prev = new QToolButton(this);
    prev->setAutoRaise(true);
  add = new QToolButton(this);
    add->setAutoRaise(true);
  rem = new QToolButton(this);
    rem->setAutoRaise(true);
  label = new QLabel(this);
    label->setAlignment(Qt::AlignCenter);
    hlay->addWidget(prev);
    hlay->addWidget(next);
    hlay->addWidget(label);
    hlay->addWidget(add);
    hlay->addWidget(rem);
    vlay->addLayout(hlay);
	
  //Setup the main text widget
  edit = new QPlainTextEdit(this);
    edit->setReadOnly(false);
    vlay->addWidget(edit);
	
  //Now setup the initial values
  cnote = this->settings->value("currentNote", 1).toInt();
  maxnote = this->settings->value("availableNotes",1).toInt();
  this->setInitialSize(200,300);
  //Setup the button connections
  connect(next, SIGNAL(clicked()), this, SLOT(nextNote()) );
  connect(prev, SIGNAL(clicked()), this, SLOT(prevNote()) );
  connect(add, SIGNAL(clicked()), this, SLOT(newNote()) );
  connect(rem, SIGNAL(clicked()), this, SLOT(remNote()) );
  connect(edit, SIGNAL(textChanged()), this, SLOT(noteChanged()) );
  QTimer::singleShot(0,this, SLOT(loadIcons()) );
  QTimer::singleShot(0,this, SLOT(updateContents()) );
  
}
コード例 #5
0
void NMainMenuBar::setupNoteMenu() {

    noteMenu = this->addMenu(tr("&Note"));
    QFont f = global.getGuiFont(QFont());
    noteMenu->setFont(f);

    newNoteAction = new QAction(tr("New &Note"), noteMenu);
    setupShortcut(newNoteAction, QString("File_Note_Add"));
    noteMenu->addAction(newNoteAction);
    connect(newNoteAction, SIGNAL(triggered()), parent, SLOT(newNote()));

    duplicateNoteAction = new QAction(tr("Dupl&icate Note"), noteMenu);
    setupShortcut(duplicateNoteAction, QString("File_Note_Duplicate"));
    noteMenu->addAction(duplicateNoteAction);
    connect(duplicateNoteAction, SIGNAL(triggered()), parent, SLOT(duplicateCurrentNote()));

    deleteNoteAction = new QAction(tr("&Delete"), noteMenu);
    setupShortcut(deleteNoteAction, QString("File_Note_Delete"));
    noteMenu->addAction(deleteNoteAction);
    connect(deleteNoteAction, SIGNAL(triggered()), parent, SLOT(deleteCurrentNote()));

    reindexNoteAction = new QAction(tr("Reindex Note"), noteMenu);
    setupShortcut(reindexNoteAction, QString("File_Note_Reindex"));
    noteMenu->addAction(reindexNoteAction);
    connect(reindexNoteAction, SIGNAL(triggered()), parent, SLOT(reindexCurrentNote()));

    if (parent->hunspellPluginAvailable) {
        noteMenu->addSeparator();
        spellCheckAction = new QAction(tr("&Spell Check"), noteMenu);
        // setupShortcut(spellCheckAction, QString("Tools_Spell_Check"));  This shortcut is done by the editor button bar
        noteMenu->addAction(spellCheckAction);
        connect(spellCheckAction, SIGNAL(triggered()), parent, SLOT(spellCheckCurrentNote()));
    }


    noteMenu->addSeparator();

    pinNoteAction = new QAction(tr("&Pin Note"), noteMenu);
    setupShortcut(pinNoteAction, QString("NOTE_PIN"));
    noteMenu->addAction(pinNoteAction);
    connect(pinNoteAction, SIGNAL(triggered()), parent, SLOT(pinCurrentNote()));

    unpinNoteAction = new QAction(tr("&UnPin Note"), noteMenu);
    setupShortcut(unpinNoteAction, QString("NOTE_UNPIN"));
    noteMenu->addAction(unpinNoteAction);
    connect(unpinNoteAction, SIGNAL(triggered()), parent, SLOT(unpinCurrentNote()));

}
コード例 #6
0
ファイル: notedialog.cpp プロジェクト: sloubi/YellowNote-Qt
bool NoteDialog::save()
{
    if (m_noteEdit->hasChanged())
    {
        // Si c'est un ajout
        if (m_note == 0)
        {
            // Création de la note
            Note *note = new Note(title(), content());
            note->addToDb();
            setNote(note);

            // Ajout de la note dans la liste
            emit newNote(note);
        }

        // Modification
        else
        {
            // Mise à jour de la note elle-même
            m_note->setTitle(title());
            m_note->setContent(content());
            m_note->setToSync(true);
            m_note->editInDb();

            // Mise à jour de la note dans la liste
            m_note->item()->update();

            // Si la note est dans le panneau, on le met à jour
            if (m_note->notePanel())
            {
                m_note->notePanel()->update();
            }
        }

        // Mise à jour du titre (après génération automatique)
        m_noteEdit->setTitle(m_note->title());
        setWindowTitle(m_note->title());

        // Enregistrement terminée, il n'y a donc plus de changements en attente
        m_noteEdit->setNoChange();
        return true;
    }
    return false;
}
コード例 #7
0
ファイル: mainwindow.cpp プロジェクト: weilaidb/qtexample
bool MainWindow::checkNoteAction(QPoint &pos)
{
    int releaseRect = rectHitTest(pos);
    if(m_nPressRect == releaseRect)
    {
        if(m_nPressRect == 0)
        {
            newNote();
            return true;
        }
        else if(m_nPressRect > 0)
        {
            openNote(m_notes.at(m_nPressRect + m_nStartNote - 1));
            return true;
        }
    }
    return false;
}
コード例 #8
0
ファイル: kmarknote.cpp プロジェクト: xulunfan/marketo
void KMarkNote::setupAction()
{
    KStandardAction::openNew(this, SLOT(newNote()), actionCollection());
    KStandardAction::close(this, SLOT(close()), actionCollection());

    KAction* oneColAction = actionCollection()->addAction("win_onecol", m_view, SLOT(oneColView()));
    KAction* twoColAction = actionCollection()->addAction("win_twocol", m_view, SLOT(twoColView()));
    KAction* threeColAction = actionCollection()->addAction("win_threecol", m_view, SLOT(threeColView()));

    oneColAction->setText(i18n("One Column View"));
    twoColAction->setText(i18n("Two Column View"));
    threeColAction->setText(i18n("Three Column View"));

    oneColAction->setIcon(KIcon("view-split-top-bottom"));
    twoColAction->setIcon(KIcon("view-split-left-right"));
    threeColAction->setIcon(KIcon("view-file-columns"));

    KAction* terminalAction = actionCollection()->addAction("toggle_terminal", m_view, SLOT(toggleTerminal()));
    KShortcut terminalShortcut = terminalAction->shortcut();
    terminalShortcut.setPrimary(QKeySequence("F4"));
    terminalAction->setShortcut(terminalShortcut);
}
コード例 #9
0
ファイル: editnote.cpp プロジェクト: psi-plus/plugins
void EditNote::ok()
{
    QString text = ui_.pte_text->toPlainText();
    QString title = ui_.le_title->text();
    QString tags = ui_.le_tags->text();

    QDomDocument doc;
    QDomElement noteElem = doc.createElement("note");
    QDomElement titleElem = doc.createElement("title");
    QDomElement textElem = doc.createElement("text");
    textElem.appendChild(doc.createTextNode(text));
    titleElem.appendChild(doc.createTextNode(title));
    noteElem.setAttribute("tags", tags);
    noteElem.appendChild(titleElem);
    noteElem.appendChild(textElem);
    doc.appendChild(noteElem);

    if(!text.isEmpty() || !title.isEmpty() || !tags.isEmpty())
        newNote(doc.documentElement());

    editNote(doc.documentElement(), index_);

    close();
}
コード例 #10
0
ファイル: mainwindow.cpp プロジェクト: MidoriYakumo/hippo
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    EdamProtocol *edam = EdamProtocol::GetInstance();

    ui->setupUi(this);

    pdfCache * pdf = new pdfCache(this);

    CustomNetworkAccessManager *nm = new CustomNetworkAccessManager(ui->editor->page()->networkAccessManager(), this, pdf);
    edam->setCNAM(nm);
    ui->editor->page()->setNetworkAccessManager(nm);

    Speller::setSettings(new DBSpellSettings(this, ui->editor));

    ui->editor->setContextMenuPolicy(Qt::CustomContextMenu);
    ui->editor->load(QUrl("qrc:///html/noteajax.html"));

    jsB = new jsBridge(this, pdf);
    jsB->setWebView(ui->editor);
    enmlWritter = new enml2(this);

    connect(ui->editor->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(addJSObject()));

    loaded = false;
    editingEnabled = false;


    tagsActions = new QActionGroup(this);
    newTag = new TagLabel(this);
    newTag->hide();
    ui->tagsBar->addWidget(newTag);

    appIcon = QIcon(":img/hippo64.png");

    trayIcon = NULL;

    bool sysTrayEnabled = sql::readSyncStatus("systemTray", true).toBool();

    if (QSystemTrayIcon::isSystemTrayAvailable() && sysTrayEnabled)
        enableSystemTrayIcon(true);

    connect(edam, SIGNAL(AuthenticateFailed()), this, SLOT(authentificationFailed()));
    connect(edam, SIGNAL(syncFinished()), this, SLOT(syncFinished()));
    connect(edam, SIGNAL(syncStarted(int)), this, SLOT(syncStarted(int)));
    connect(edam, SIGNAL(noteGuidChanged(QString,QString)), this, SLOT(changeNoteGuid(QString,QString)));
    connect(ui->notebooks, SIGNAL(itemSelectionChanged()), this, SLOT(switchNotebook()));
    connect(ui->tags, SIGNAL(itemSelectionChanged()), this, SLOT(switchTag()));
    connect(ui->tags, SIGNAL(tagAdded(QString,QString)), this, SLOT(addTag(QString,QString)));
    connect(ui->tags, SIGNAL(tagsUpdated()), this, SLOT(updateTagsToolBar()));
    connect(ui->tags, SIGNAL(tagsUpdated()), this, SLOT(switchTag()));
    connect(ui->NotesList, SIGNAL(noteSwitched()), this, SLOT(switchNote()));
    connect(ui->action_Abaut, SIGNAL(triggered()), this, SLOT(loadAboutInfo()));
    connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(closeWindow()));
    connect(ui->actionNew_Note, SIGNAL(triggered()), this, SLOT(newNote()));
    connect(ui->actionSync, SIGNAL(triggered()), this, SLOT(sync()));
    connect(ui->noteTitle, SIGNAL(textEdited(QString)), this, SLOT(noteTitleChange(QString)));
    connect(ui->actionAccount_info, SIGNAL(triggered()), this, SLOT(showUserInfo()));
    connect(ui->editor->page(), SIGNAL(linkClicked(QUrl)), this, SLOT(openURL(QUrl)));
    connect(ui->editor->page(), SIGNAL(microFocusChanged()), this, SLOT(updateEditButtonsState()));
    connect(ui->editor, SIGNAL(selectionChanged()), this, SLOT(updateSelectionButtonsState()));
    connect(ui->editor->page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest)));
    connect(ui->editor, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(editorContextMenuRequested(QPoint)));
    connect(ui->editor, SIGNAL(fileInserted(QString)), this, SLOT(insertFile(QString)));
    connect(ui->notebooks, SIGNAL(noteMoved(QString,QString)), this, SLOT(moveNote(QString,QString)));
    connect(ui->notebooks, SIGNAL(noteDeleted(QString)), this, SLOT(deleteNote(QString)));
    connect(ui->notebooks, SIGNAL(noteRestored(QString,QString)), this, SLOT(restoreNote(QString,QString)));
    connect(ui->NotesList, SIGNAL(noteDeleted(QString)), this, SLOT(deleteNote(QString)));
    connect(ui->NotesList, SIGNAL(noteRestored(QString)), this, SLOT(restoreNote(QString)));
    connect(ui->NotesList, SIGNAL(noteCreated()), this, SLOT(newNote()));
    connect(ui->NotesList, SIGNAL(reloaded()), this, SLOT(updateCurrentNoteName()));
    connect(ui->editButton, SIGNAL(toggled(bool)), this, SLOT(setEditable(bool)));
    connect(ui->actionDelete_Note, SIGNAL(triggered()), this, SLOT(deleteNote()));
    connect(ui->toolBox, SIGNAL(currentChanged(int)), this, SLOT(changeTab(int)));
    connect(ui->editor->page(), SIGNAL(linkHovered(QString,QString,QString)), this, SLOT(linkHovered(QString,QString,QString)));
    connect(jsB, SIGNAL(hintMessage(QString,int)), ui->statusbar, SLOT(showMessage(QString,int)));
    connect(jsB, SIGNAL(noteChanged(QString)), this, SLOT(updateTagsToolBar(QString)));
    connect(jsB, SIGNAL(activeNoteSelectionChanged(bool)), ui->actionDelete_Note, SLOT(setEnabled(bool)));
    connect(jsB, SIGNAL(activeNoteSelectionChanged(bool)), ui->editButton, SLOT(setEnabled(bool)));
    connect(jsB, SIGNAL(editingStarted(bool)), ui->editButton, SLOT(setChecked(bool)));
    connect(jsB, SIGNAL(titleUpdated(QString,QString)), this, SLOT(updateNoteTitle(QString,QString)));
    connect(jsB, SIGNAL(conflictAdded(qint64,QString,bool)), this, SLOT(addConflict(qint64,QString,bool)));
    connect(jsB, SIGNAL(noteSelectionChanged(bool)), ui->actionNote_Info, SLOT(setEnabled(bool)));
    connect(jsB, SIGNAL(noteSelectionChanged(bool)), ui->actionExport, SLOT(setEnabled(bool)));
    connect(jsB, SIGNAL(noteSelectionChanged(bool)), ui->actionPrint, SLOT(setEnabled(bool)));
    connect(ui->editor, SIGNAL(tagUpdated(QString,bool)), this, SLOT(updateTag(QString,bool)));
    connect(tagsActions, SIGNAL(triggered(QAction*)), this, SLOT(tagClicked(QAction*)));
    connect(newTag, SIGNAL(tagCreated(QString)), this, SLOT(createTag(QString)));
    connect(ui->actionKeep_only_this_Version, SIGNAL(triggered()), this, SLOT(keepThisVersion()));
    connect(ui->actionNote_Info, SIGNAL(triggered()), this, SLOT(showNoteInfo()));
    connect(ui->actionExport, SIGNAL(triggered()), this, SLOT(exportNote()));
    connect(ui->actionPrint, SIGNAL(triggered()), this, SLOT(print()));
    connect(this, SIGNAL(titleChanged(QString,QString)), jsB, SIGNAL(titleChanged(QString,QString)));


    setWindowIcon(appIcon);
    setWindowTitle("Hippo Notes");

    setTabOrder(ui->noteTitle, ui->editor);

    ui->notebooks->setSortingEnabled(true);
    ui->notebooks->sortByColumn(0, Qt::AscendingOrder);
    ui->editBar->setVisible(false);

    ui->mainToolBar->addAction(ui->actionNew_Note);
    ui->mainToolBar->addAction(ui->actionSync);

    QFontComboBox *font = new QFontComboBox(this);
    font->setDisabled(true);
    font->setFontFilters(QFontComboBox::ScalableFonts);
    font->setEditable(false);
    connect(this, SIGNAL(editButtonsStateChanged(bool)), font, SLOT(setEnabled(bool)));
    connect(this, SIGNAL(updateFont(QFont)), font, SLOT(setCurrentFont(QFont)));
    connect(font, SIGNAL(activated(QString)), this, SLOT(changeFont(QString)));
    ui->editBar->addWidget(font);

    QComboBox *fontSize = new QComboBox(this);
    fontSize->setDisabled(true);
    fontSize->setEditable(false);
    for (int i = 1; i <= 7; i++)
        fontSize->addItem(QString::number(i));
    connect(this, SIGNAL(editButtonsStateChanged(bool)), fontSize, SLOT(setEnabled(bool)));
    connect(this, SIGNAL(updateFontSize(int)), fontSize, SLOT(setCurrentIndex(int)));
    connect(fontSize, SIGNAL(activated(QString)), this, SLOT(changeFontSize(QString)));
    ui->editBar->addWidget(fontSize);

    QAction *boldIco = ui->editor->pageAction(QWebPage::ToggleBold);
    boldIco->setIcon(QIcon::fromTheme("format-text-bold"));
    ui->editBar->addAction(boldIco);

    QAction *italicIco = ui->editor->pageAction(QWebPage::ToggleItalic);
    italicIco->setIcon(QIcon::fromTheme("format-text-italic"));
    ui->editBar->addAction(italicIco);

    QAction *underlineIco = ui->editor->pageAction(QWebPage::ToggleUnderline);
    underlineIco->setIcon(QIcon::fromTheme("format-text-underline"));
    ui->editBar->addAction(underlineIco);

    QAction *strikethroughIco = ui->editor->pageAction(QWebPage::ToggleStrikethrough);
    strikethroughIco->setIcon(QIcon::fromTheme("format-text-strikethrough"));
    ui->editBar->addAction(strikethroughIco);

    ui->editBar->addSeparator();

    QAction *undoIco = ui->editor->pageAction(QWebPage::Undo);
    undoIco->setIcon(QIcon::fromTheme("edit-undo"));
    undoIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z));
    ui->editBar->addAction(undoIco);
    ui->menu_Edit->addAction(undoIco);

    QAction *redoIco = ui->editor->pageAction(QWebPage::Redo);
    redoIco->setIcon(QIcon::fromTheme("edit-redo"));
    redoIco->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Z));
    ui->editBar->addAction(redoIco);
    ui->menu_Edit->addAction(redoIco);

    ui->editBar->addSeparator();

    QAction *rformatIco = ui->editor->pageAction(QWebPage::RemoveFormat);
    rformatIco->setIcon(QIcon::fromTheme("edit-clear"));
    ui->editBar->addAction(rformatIco);

    ui->editBar->addSeparator();

    QAction *leftIco = ui->editor->pageAction(QWebPage::AlignLeft);
    leftIco->setIcon(QIcon::fromTheme("format-justify-left"));
    ui->editBar->addAction(leftIco);

    QAction *centerIco = ui->editor->pageAction(QWebPage::AlignCenter);
    centerIco->setIcon(QIcon::fromTheme("format-justify-center"));
    ui->editBar->addAction(centerIco);

    QAction *rightIco = ui->editor->pageAction(QWebPage::AlignRight);
    rightIco->setIcon(QIcon::fromTheme("format-justify-right"));
    ui->editBar->addAction(rightIco);

    QAction *fillIco = ui->editor->pageAction(QWebPage::AlignJustified);
    fillIco->setIcon(QIcon::fromTheme("format-justify-fill"));
    ui->editBar->addAction(fillIco);

    ui->editBar->addSeparator();

    QAction *indentIco = ui->editor->pageAction(QWebPage::Indent);
    indentIco->setIcon(QIcon::fromTheme("format-indent-more"));
    ui->editBar->addAction(indentIco);

    QAction *outdentIco = ui->editor->pageAction(QWebPage::Outdent);
    outdentIco->setIcon(QIcon::fromTheme("format-indent-less"));
    ui->editBar->addAction(outdentIco);

    QAction *superscriptIco = ui->editor->pageAction(QWebPage::ToggleSuperscript);
    superscriptIco->setIcon(QIcon::fromTheme("format-text-superscript"));
    ui->editBar->addAction(superscriptIco);

    QAction *subscriptIco = ui->editor->pageAction(QWebPage::ToggleSubscript);
    subscriptIco->setIcon(QIcon::fromTheme("format-text-subscript"));
    ui->editBar->addAction(subscriptIco);

    QAction *unorderedIco = ui->editor->pageAction(QWebPage::InsertUnorderedList);
    unorderedIco->setIcon(QIcon::fromTheme("format-list-unordered"));
    ui->editBar->addAction(unorderedIco);

    QAction *orderedIco = ui->editor->pageAction(QWebPage::InsertOrderedList);
    orderedIco->setIcon(QIcon::fromTheme("format-list-ordered"));
    ui->editBar->addAction(orderedIco);

    QAction *lineIco = new QAction("Insert horizontal line", this);
    lineIco->setIcon(QIcon::fromTheme("insert-horizontal-rule"));
    lineIco->setDisabled(true);
    connect(this, SIGNAL(editButtonsStateChanged(bool)), lineIco, SLOT(setEnabled(bool)));
    connect(lineIco, SIGNAL(triggered()), this, SLOT(insertHorizontalLine()));
    ui->editBar->addAction(lineIco);

    ui->menu_Edit->addSeparator();

    QAction *cutIco = ui->editor->pageAction(QWebPage::Cut);
    cutIco->setIcon(QIcon::fromTheme("edit-cut"));
    cutIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X));
    ui->menu_Edit->addAction(cutIco);

    QAction *copyIco = ui->editor->pageAction(QWebPage::Copy);
    copyIco->setIcon(QIcon::fromTheme("edit-copy"));
    copyIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
    ui->menu_Edit->addAction(copyIco);

    QAction *pasteIco = ui->editor->pageAction(QWebPage::Paste);
    pasteIco->setIcon(QIcon::fromTheme("edit-paste"));
    pasteIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V));
    ui->menu_Edit->addAction(pasteIco);

    QAction *pasteSpecialIco = ui->editor->pageAction(QWebPage::PasteAndMatchStyle);
    pasteSpecialIco->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_V));
    ui->menu_Edit->addAction(pasteSpecialIco);

    ui->menu_Edit->addSeparator();

    QAction *insertUrlIco = new QAction("Create link", this);
    insertUrlIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));
    insertUrlIco->setDisabled(true);
    insertUrlIco->setIcon(QIcon::fromTheme("insert-link"));
    connect(this, SIGNAL(selectionButtonsStateChanged(bool)), insertUrlIco, SLOT(setDisabled(bool)));
    connect(insertUrlIco, SIGNAL(triggered()), this, SLOT(insertUrl()));
    ui->menu_Edit->addAction(insertUrlIco);

    QAction *todoIco = new QAction("Insert To-do Checkbox", this);
    todoIco->setIcon(QIcon::fromTheme("checkbox"));
    todoIco->setDisabled(true);
    connect(this, SIGNAL(editButtonsStateChanged(bool)), todoIco, SLOT(setEnabled(bool)));
    connect(todoIco, SIGNAL(triggered()), jsB, SIGNAL(insertToDo()));
    ui->menu_Edit->addAction(todoIco);

    QAction *insertImage = new QAction("Insert Image", this);
    insertImage->setIcon(QIcon::fromTheme("insert-image"));
    insertImage->setDisabled(true);
    connect(this, SIGNAL(editButtonsStateChanged(bool)), insertImage, SLOT(setEnabled(bool)));
    connect(insertImage, SIGNAL(triggered()), this, SLOT(insertImg()));
    ui->menu_Edit->addAction(insertImage);

    QAction *insertFile = new QAction("Insert File", this);
    insertFile->setDisabled(true);
    connect(this, SIGNAL(editButtonsStateChanged(bool)), insertFile, SLOT(setEnabled(bool)));
    connect(insertFile, SIGNAL(triggered()), this, SLOT(insertFile()));
    ui->menu_Edit->addAction(insertFile);

    QAction *encryptIco = new QAction("Encrypt Selected Text...", this);
    encryptIco->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_X));
    encryptIco->setDisabled(true);
    encryptIco->setIcon(QIcon::fromTheme("document-edit-encrypt"));
    connect(this, SIGNAL(selectionButtonsStateChanged(bool)), encryptIco, SLOT(setDisabled(bool)));
    connect(encryptIco, SIGNAL(triggered()), jsB, SIGNAL(encryptText()));
    ui->menu_Edit->addAction(encryptIco);

    ui->menu_Edit->addSeparator();

    QAction *options = new QAction("&Options...", this);
    options->setIcon(QIcon::fromTheme("preferences-other"));
    connect(options, SIGNAL(triggered()), this, SLOT(showOptions()));
    ui->menu_Edit->addAction(options);


    clearConflictBar();
    connect(jsB, SIGNAL(showConflict()), ui->conflictBar, SLOT(show()));
    connect(jsB, SIGNAL(showConflict()), ui->conflictBarBottom, SLOT(show()));

    conflictsGroup = new QActionGroup(this);
    connect(conflictsGroup, SIGNAL(triggered(QAction*)), this, SLOT(changeNoteVersion(QAction*)));

    searchIndex = new SearchIndex(this);
    connect(ui->searchButton, SIGNAL(clicked()), this, SLOT(search()));
    connect(edam, SIGNAL(syncFinished()), searchIndex, SLOT(buildSearchIndex()));
    connect(jsB, SIGNAL(noteUpdated(QString)), searchIndex, SLOT(updateNoteIndex(QString)));
    connect(edam, SIGNAL(noteUpdated(QString)), searchIndex, SLOT(dropNoteIndex(QString)));
    connect(ui->searchInput, SIGNAL(returnPressed()), this, SLOT(search()));

    QByteArray mainWindowGeometry = sql::readSyncStatus("mainWindowGeometry").toString().toLatin1();
    if (!mainWindowGeometry.isEmpty())
        restoreGeometry(QByteArray::fromBase64(mainWindowGeometry));

    QByteArray mainWidgetsSplitterState = sql::readSyncStatus("mainWidgetsSplitterState").toString().toLatin1();
    if (!mainWidgetsSplitterState.isEmpty())
        ui->mainWidgetsSplitter->restoreState(QByteArray::fromBase64(mainWidgetsSplitterState));

    //showWindow();
    edam->init();
}
コード例 #11
0
ファイル: fenetre.cpp プロジェクト: pcrouillere/NoteManager
void Fenetre::newVideo(){newNote("Audio");}
コード例 #12
0
ファイル: fenetre.cpp プロジェクト: pcrouillere/NoteManager
void Fenetre::newAudio(){newNote("Audio");}
コード例 #13
0
ファイル: InstrumentTrack.cpp プロジェクト: Orpheon/lmms
void InstrumentTrack::processOutEvent( const midiEvent & _me,
							const midiTime & _time )
{
	int k;

	switch( _me.m_type )
	{
		case MidiNoteOn:
			if( !configManager::inst()->value( "ui",
						"manualchannelpiano" ).toInt() )
			{
				m_piano.setKeyState( _me.key(), true );
			}
			if( !configManager::inst()->value( "ui",
				"disablechannelactivityindicators" ).toInt() )
			{
				if( m_notes[_me.key()] == NULL )
				{
					emit newNote();
				}
			}
			k = masterKey( _me.key() );
			if( k >= 0 && k < NumKeys )
			{
				if( m_runningMidiNotes[k] > 0 )
				{
					m_instrument->handleMidiEvent(
	midiEvent( MidiNoteOff, midiPort()->realOutputChannel(), k, 0 ),
									_time );
				}
				++m_runningMidiNotes[k];
				m_instrument->handleMidiEvent(
	midiEvent( MidiNoteOn, midiPort()->realOutputChannel(), k,
						_me.velocity() ), _time );
			}
			break;

		case MidiNoteOff:
			if( !configManager::inst()->value( "ui",
						"manualchannelpiano" ).toInt() )
			{
				m_piano.setKeyState( _me.key(), false );
			}
			k = masterKey( _me.key() );
			if( k >= 0 && k < NumKeys &&
						--m_runningMidiNotes[k] <= 0 )
			{
				m_runningMidiNotes[k] = qMax( 0, m_runningMidiNotes[k] );
				m_instrument->handleMidiEvent(
	midiEvent( MidiNoteOff, midiPort()->realOutputChannel(), k, 0 ),
									_time );
			}
			break;

		default:
			if( m_instrument != NULL )
			{
				m_instrument->handleMidiEvent(
							applyMasterKey( _me ),
									_time );
			}
			break;
	}

	// if appropriate, midi-port does futher routing
	m_midiPort.processOutEvent( _me, _time );
}
コード例 #14
0
InstrumentTrackView::InstrumentTrackView( InstrumentTrack * _it, TrackContainerView* tcv ) :
	TrackView( _it, tcv ),
	m_window( NULL ),
	m_lastPos( -1, -1 )
{
	setAcceptDrops( true );
	setFixedHeight( 32 );

	m_tlb = new TrackLabelButton( this, getTrackSettingsWidget() );
	m_tlb->setCheckable( true );
	m_tlb->setIcon( embed::getIconPixmap( "instrument_track" ) );
	m_tlb->move( 3, 1 );
	m_tlb->show();

	connect( m_tlb, SIGNAL( toggled( bool ) ),
			this, SLOT( toggleInstrumentWindow( bool ) ) );

	connect( _it, SIGNAL( nameChanged() ),
			m_tlb, SLOT( update() ) );

	// creation of widgets for track-settings-widget
	int widgetWidth;
	if( ConfigManager::inst()->value( "ui",
					  "compacttrackbuttons" ).toInt() )
	{
		widgetWidth = DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT;
	}
	else
	{
		widgetWidth = DEFAULT_SETTINGS_WIDGET_WIDTH;
	}

	m_volumeKnob = new Knob( knobSmall_17, getTrackSettingsWidget(),
							tr( "Volume" ) );
	m_volumeKnob->setVolumeKnob( true );
	m_volumeKnob->setModel( &_it->m_volumeModel );
	m_volumeKnob->setHintText( tr( "Volume:" ), "%" );
	m_volumeKnob->move( widgetWidth-2*24, 2 );
	m_volumeKnob->setLabel( tr( "VOL" ) );
	m_volumeKnob->show();
	m_volumeKnob->setWhatsThis( tr( volume_help ) );

	m_panningKnob = new Knob( knobSmall_17, getTrackSettingsWidget(),
							tr( "Panning" ) );
	m_panningKnob->setModel( &_it->m_panningModel );
    m_panningKnob->setHintText( tr( "Panning:" ), "%" );
	m_panningKnob->move( widgetWidth-24, 2 );
	m_panningKnob->setLabel( tr( "PAN" ) );
	m_panningKnob->show();

	m_midiMenu = new QMenu( tr( "MIDI" ), this );

	// sequenced MIDI?
	if( !Engine::mixer()->midiClient()->isRaw() )
	{
		_it->m_midiPort.m_readablePortsMenu = new MidiPortMenu(
							MidiPort::Input );
		_it->m_midiPort.m_writablePortsMenu = new MidiPortMenu(
							MidiPort::Output );
		_it->m_midiPort.m_readablePortsMenu->setModel(
							&_it->m_midiPort );
		_it->m_midiPort.m_writablePortsMenu->setModel(
							&_it->m_midiPort );
		m_midiInputAction = m_midiMenu->addMenu(
					_it->m_midiPort.m_readablePortsMenu );
		m_midiOutputAction = m_midiMenu->addMenu(
					_it->m_midiPort.m_writablePortsMenu );
	}
	else
	{
		m_midiInputAction = m_midiMenu->addAction( "" );
		m_midiOutputAction = m_midiMenu->addAction( "" );
		m_midiInputAction->setCheckable( true );
		m_midiOutputAction->setCheckable( true );
		connect( m_midiInputAction, SIGNAL( changed() ), this,
						SLOT( midiInSelected() ) );
		connect( m_midiOutputAction, SIGNAL( changed() ), this,
					SLOT( midiOutSelected() ) );
		connect( &_it->m_midiPort, SIGNAL( modeChanged() ),
				this, SLOT( midiConfigChanged() ) );
	}

	m_midiInputAction->setText( tr( "Input" ) );
	m_midiOutputAction->setText( tr( "Output" ) );

	m_activityIndicator = new FadeButton( QApplication::palette().color( QPalette::Active,
							QPalette::Background),
						QApplication::palette().color( QPalette::Active,
							QPalette::BrightText ),
						getTrackSettingsWidget() );
	m_activityIndicator->setGeometry(
					 widgetWidth-2*24-11, 2, 8, 28 );
	m_activityIndicator->show();
	connect( m_activityIndicator, SIGNAL( pressed() ),
				this, SLOT( activityIndicatorPressed() ) );
	connect( m_activityIndicator, SIGNAL( released() ),
				this, SLOT( activityIndicatorReleased() ) );
	connect( _it, SIGNAL( newNote() ),
			 m_activityIndicator, SLOT( activate() ) );
	connect( &_it->m_mutedModel, SIGNAL( dataChanged() ), this, SLOT( muteChanged() ) );

	setModel( _it );
}
コード例 #15
0
void HexSequencer::processOP1Event(midiPacket &event){
    
//    cout << "event name: "<<event.event<<", element name: "<<event.elementName<<endl;
    
    
    if (event.elementName=="encoder_blue") {
        
//        cout << "event.event is"<<event.event<<endl;

        if(event.event == "button_up"){
            
            gates[currentHover].active = !gates[currentHover].active;
            
            return;
        }
        
        int nextHover = (currentHover>12)?0:currentHover; //weirdly sometimes overflows
        
        gates[nextHover].selected = false;
        
        if (event.event == "encoder_cw"){
            nextHover ++;
        }else if(event.event == "encoder_ccw"){
            nextHover --;
        }
        
        nextHover = (nextHover>12)?0:nextHover;
        nextHover = (nextHover<0)?12:nextHover;
        
        currentHover = nextHover;
        
        gates[currentHover].selected = true;
        
//        cout << "blue encoder event"<<endl;
        return;
    }
    
    if (event.elementName=="encoder_green") {
        
        if (event.event == "button_down"){
            //
        }else if (event.event == "button_up"){
            randomiseGates(0);
        }else{ //turning
            
            int nextTurretAngle = gates[currentHover].turretZeroDir;
            
            if (event.event == "encoder_cw"){
                nextTurretAngle ++;
            }else if(event.event == "encoder_ccw"){
                nextTurretAngle --;
            }
            
            nextTurretAngle = (nextTurretAngle>5)?0:nextTurretAngle;
            nextTurretAngle = (nextTurretAngle<0)?5:nextTurretAngle;
            
            gates[currentHover].turretZeroDir = nextTurretAngle;
            gates[currentHover].turretZeroGate = gates[currentHover].neighbours[nextTurretAngle];
            
            if (gates[currentHover].turretOneDir == nextTurretAngle){
                gates[currentHover].turretOneDir = -1;
                gates[currentHover].turretActive = 0;
            }
                
        }

        
//        cout << "green encoder event"<<endl;
        return;
    }
    
    if (event.elementName=="encoder_white") {
        
        if (event.event == "button_down"){
            //
        }else if (event.event == "button_up"){
            randomiseGates(1);
        }else{ //turning
            
            int nextTurretAngle = gates[currentHover].turretOneDir;
            
            if (nextTurretAngle==-1){
                nextTurretAngle = gates[currentHover].turretZeroDir;
            }
            
            if (event.event == "encoder_cw"){
                nextTurretAngle ++;
            }else if(event.event == "encoder_ccw"){
                nextTurretAngle --;
            }
            
            nextTurretAngle = (nextTurretAngle>5)?0:nextTurretAngle;
            nextTurretAngle = (nextTurretAngle<0)?5:nextTurretAngle;
            
            gates[currentHover].turretOneDir = nextTurretAngle;
            gates[currentHover].turretOneGate = gates[currentHover].neighbours[nextTurretAngle];
            
            if (gates[currentHover].turretZeroDir == nextTurretAngle){
                gates[currentHover].turretOneDir = -1;
                gates[currentHover].turretActive = 0;
            }
        }
        
//        cout << "white encoder event"<<endl;
        return;
    }
    
    if (event.elementName=="encoder_orange") {
        
        if (event.event == "encoder_cw"){
            if (!orangeEncoderDown){
                if (noteLength<32) noteLength++;
                noteLengthName = getNoteLengthName(noteLength);
            }else{
                bpm ++;
                metro.setBPM(bpm);
            }
            
        }else if(event.event == "encoder_ccw"){
            if (!orangeEncoderDown){
                if (noteLength>1) noteLength--;
                noteLengthName = getNoteLengthName(noteLength);
            }else{
                if (bpm>2)bpm --;
                metro.setBPM(bpm);
            }
            
        }else if (event.event == "button_down"){
            orangeEncoderDown = true;
        }else if (event.event == "button_up"){
            orangeEncoderDown = false;
        }
        
        
        
//        cout << "orange encoder event"<<endl;
        return;
    }
    
    if (event.event == "key_down"){ //keyboard press
        
        if (insertNotes){
            
            Note newNote(scale);
            newNote.inputMidiId = newNote.playedMidiId = event.elementId;
            newNote.posX = gates[currentHover].posX; //makes it stay in place
            newNote.posY = gates[currentHover].posY;
            newNote.targetGateX = newNote.posX;
            newNote.targetGateX = newNote.posY;
            newNote.lastGateX = newNote.posX;
            newNote.lastGateX = newNote.posY;
            newNote.moveNote = false;
            gates[currentHover].notesIncoming.push_back(newNote);
            
//            cout << "added new note. midi id is"<<newNote.inputMidiId <<endl;
            
        }else{ //transpose notes
            
            transposition = event.elementId-64; //offset from middle-ish of keyboard (E)
            
            cout << "elem id "<<event.elementId<<"gives new transposition: "<<transposition<<endl;
            
        }
            
    }
    
    
    
    if(event.event == "button_down"){
        
//        cout << "button down is: "<<event.elementName<<endl;
        
        if (event.elementName == "One"){
            insertNotes = true;
        }else if (event.elementName == "Two"){
            insertNotes = false;
        }else if (event.elementName == "Sequencer"){
            toggleView();
        }
        
    }
    
}
コード例 #16
0
ファイル: munger~.c プロジェクト: Cycling74/percolate
void munger_perform64(t_munger *x, t_object *dsp64, double **ins, long numins, double **outs, long numouts, long sampleframes, long flags, void *userparam)
{
	t_double *in = (t_double *)(ins[0]);
	
	t_double grate 		= x->grate_connected? 		*(t_double *)(ins[0]) : x->grate;
	t_double grate_var 	= x->grate_var_connected? 	*(t_double *)(ins[1]) : x->grate_var;
	t_double glen 		= x->glen_connected? 		*(t_double *)(ins[2]) : x->glen;
	t_double glen_var 	= x->glen_var_connected? 	*(t_double *)(ins[3]) : x->glen_var;
	t_double gpitch 	= x->gpitch_connected? 		*(t_double *)(ins[4]) : x->gpitch;
	t_double gpitch_var	= x->gpitch_var_connected? 	*(t_double *)(ins[5]) : x->gpitch_var;
	t_double gpan_spread= x->gpan_spread_connected? *(t_double *)(ins[6]) : x->gpan_spread;
	
	t_double outsamp[MAXCHANNELS], samp;
	int newvoice, i, j;
	long n;
	t_double *out[MAXCHANNELS];
	//t_double *outL = (t_double *)(w[10]);
	//t_double *outR = (t_double *)(w[11]);
	
	for (i=0;i<x->num_channels;i++) {
		out[i] = (t_double *)(outs[i]);
	}
	n = sampleframes;
	
	//make sure vars are updated if signals are connected; stupid, lazy, boob.
	x->grate = grate;
	x->grate_var = grate_var;
	x->glen = glen;
	x->glen_var = glen_var;
	x->gpitch = gpitch;
	x->gpitch_var = gpitch_var;
	x->gpan_spread = gpan_spread;
		
	//grate = grate + RAND01 * grate_var;
	//grate = grate + ((t_double)rand() - 16384.) * ONE_OVER_HALFRAND * grate_var;
	//gimme = x->srate_ms * grate; //grate is actually time-distance between grains

	if(gpan_spread > 1.) gpan_spread = 1.;
	if(gpan_spread < 0.) gpan_spread = 0.;

	if(!x->power) {
		while(n--) { 	//copy and zero out when unpowered (this is slightly less efficient than
						//the z_disabled approach, but some users expect it now
			for(i=0;i<x->num_channels;i++) {
				*out[i]++ = 0.;
			}
		}
	}
	else {
		t_buffer_obj	*buffer = buffer_ref_getobject(x->l_buffer);
		t_float			*tab = buffer_locksamples(buffer);
		double			frames = 0;
		double			nc = 0;

		if (tab) {
			frames = buffer_getframecount(buffer);
			nc = buffer_getchannelcount(buffer);
		}
		
		while(n--) {
			//outsampL = outsampR = 0.;
			for(i=0;i<x->num_channels;i++) outsamp[i] = 0.;
			
			//record a sample
			//if(x->recordOn) recordSamp(x, *in++);
			recordSamp(x, *in++);
			
			//grab a note if requested; works in oneshot mode or otherwise
			while(x->newnote > 0) {
				newvoice = findVoice(x);
				if(newvoice >= 0) {
					x->gvoiceCurrent[newvoice] = newNote(x, newvoice, x->newnote, frames);
				}
				x->newnote--;
			}
			
			//find a voice if it's time (high resolution). ignore if in "oneshot" mode		
			if(!x->oneshot) {
				if(x->time >= (long)x->gimme) {
					x->time = 0;
					newvoice = findVoice(x);
					if(newvoice >= 0) {
						x->gvoiceCurrent[newvoice] = newSetup(x, newvoice, frames);
					}
					grate = grate + ((t_double)rand() - RAND_MAX * 0.5) * ONE_OVER_HALFRAND * grate_var;
					x->gimme = x->srate_ms * grate; //grate is actually time-distance between grains
				}
			} 
			x->time++;
			
			//mix 'em, pan 'em
			for(i=0; i< x->maxvoices; i++) {
			//for(i=0; i<x->voices; i++) {
				if(x->gvoiceOn[i]) {
					//get a sample, envelope it
					if(x->externalBuffer) samp = getExternalSamp(x, x->gvoiceCurrent[i], tab, frames, nc);
					else samp = getSamp(x, x->gvoiceCurrent[i]);
					if (!x->gvoiceADSRon[i]) samp = envelope(x, i, samp) * x->gvoiceGain[i];
					else samp = samp * ADSR_ADRtick(&x->gvoiceADSR[i]) * x->gvoiceGain[i];
					
					//pan it
					if(x->num_channels == 2) {
						outsamp[0] += samp * x->gvoiceLPan[i];
						outsamp[1] += samp * x->gvoiceRPan[i];
					}
					else { //multichannel subroutine
						for(j=0;j<x->num_channels;j++) {
							outsamp[j] += samp * x->gvoiceSpat[i][j];
						}
					}
					
					//see if grain is done after jumping to next sample point
					x->gvoiceCurrent[i] += (double)x->gvoiceDirection[i] * (double)x->gvoiceSpeed[i];
					if (!x->gvoiceADSRon[i]) {
						if(++x->gvoiceDone[i] >= x->gvoiceSize[i]) x->gvoiceOn[i] = 0;
					}
					else {
						if(ADSR_getState(&x->gvoiceADSR[i]) == DONE) x->gvoiceOn[i] = 0;
					}
				}
			}
			for(i=0;i<x->num_channels;i++) {
				*out[i]++ = outsamp[i];
			}
		}
		if (tab)
			buffer_unlocksamples(buffer);
	}
}
コード例 #17
0
ファイル: fenetre.cpp プロジェクト: pcrouillere/NoteManager
void Fenetre::newArticle(){newNote("Article");}
コード例 #18
0
ファイル: fenetre.cpp プロジェクト: pcrouillere/NoteManager
void Fenetre::newDocument(){newNote("Document");}
コード例 #19
0
KNotesApp::KNotesApp()
  : QWidget(), m_alarm( 0 ), m_listener( 0 ), m_publisher( 0 ), m_find( 0 ), m_findPos( 0 )
{
  new KNotesAdaptor( this );
  QDBusConnection::sessionBus().registerObject( "/KNotes" , this );
  kapp->setQuitOnLastWindowClosed( false );

  // create the dock widget...
  m_tray = new KStatusNotifierItem(0);

  m_tray->setToolTipTitle( i18n( "KNotes: Sticky notes for KDE" ) );
  m_tray->setIconByName( "knotes" );
  m_tray->setToolTipIconByName( "knotes" );
  m_tray->setStatus( KStatusNotifierItem::Active );
  m_tray->setCategory( KStatusNotifierItem::ApplicationStatus );
  m_tray->setStandardActionsEnabled(false);
  connect( m_tray, SIGNAL(activateRequested(bool,QPoint)), this, SLOT(slotActivateRequested(bool,QPoint)) );
  connect( m_tray, SIGNAL(secondaryActivateRequested(QPoint)), this, SLOT(slotSecondaryActivateRequested(QPoint)) );

  // set the initial style
#ifdef __GNUC__
#warning FIXME
#endif
  //    KNote::setStyle( KNotesGlobalConfig::style() );

  // create the GUI...
  KAction *action  = new KAction( KIcon( "document-new" ),
                                  i18n( "New Note" ), this );
  actionCollection()->addAction( "new_note", action );
  action->setGlobalShortcut( KShortcut( Qt::ALT + Qt::SHIFT + Qt::Key_N ));
  connect( action, SIGNAL(triggered()), SLOT(newNote()) );

  action  = new KAction( KIcon( "edit-paste" ),
                         i18n( "New Note From Clipboard" ), this );
  actionCollection()->addAction( "new_note_clipboard", action );
  action->setGlobalShortcut( KShortcut( Qt::ALT + Qt::SHIFT + Qt::Key_C ));
  connect( action, SIGNAL(triggered()), SLOT(newNoteFromClipboard()) );

  action  = new KAction( KIcon( "knotes" ), i18n( "Show All Notes" ), this );
  actionCollection()->addAction( "show_all_notes", action );
  action->setGlobalShortcut( KShortcut( Qt::ALT + Qt::SHIFT + Qt::Key_S ));
  connect( action, SIGNAL(triggered()), SLOT(showAllNotes()) );

  action  = new KAction( KIcon( "window-close" ),
                         i18n( "Hide All Notes" ), this );
  actionCollection()->addAction( "hide_all_notes", action );
  action->setGlobalShortcut( KShortcut( Qt::ALT + Qt::SHIFT + Qt::Key_H ));
  connect( action, SIGNAL(triggered()), SLOT(hideAllNotes()) );

  new KHelpMenu( this, KGlobal::mainComponent().aboutData(), false,
                 actionCollection() );

  m_findAction = KStandardAction::find( this, SLOT(slotOpenFindDialog()),
                         actionCollection() );
  KStandardAction::preferences( this, SLOT(slotPreferences()),
                         actionCollection() );
  KStandardAction::keyBindings( this, SLOT(slotConfigureAccels()),
                         actionCollection() );
  //FIXME: no shortcut removing!?
  KStandardAction::quit( this, SLOT(slotQuit()),
                         actionCollection() )->setShortcut( 0 );

  setXMLFile( componentData().componentName() + "appui.rc" );

  m_guiBuilder = new KXMLGUIBuilder( this );
  m_guiFactory = new KXMLGUIFactory( m_guiBuilder, this );
  m_guiFactory->addClient( this );

  m_contextMenu = static_cast<KMenu *>( m_guiFactory->container(
                                        "knotes_context",
                                        this ) );
  m_noteMenu = static_cast<KMenu *>( m_guiFactory->container(
                                      "notes_menu", this ) );
  m_tray->setContextMenu( m_contextMenu );
  // get the most recent XML UI file
  QString xmlFileName = componentData().componentName() + "ui.rc";
  QString filter = componentData().componentName() + '/' + xmlFileName;
  const QStringList fileList =
      componentData().dirs()->findAllResources( "data", filter ) +
      componentData().dirs()->findAllResources( "data", xmlFileName );

  QString doc;
  KXMLGUIClient::findMostRecentXMLFile( fileList, doc );
  m_noteGUI.setContent( doc );

  KConfigGroup config( KGlobal::config(), "Global Keybindings" );

  // clean up old config files
  KNotesLegacy::cleanUp();

  // create the resource manager
  m_manager = new KNotesResourceManager();
  connect( m_manager, SIGNAL(sigRegisteredNote(KCal::Journal*)),
           this,      SLOT(createNote(KCal::Journal*)) );
  connect( m_manager, SIGNAL(sigDeregisteredNote(KCal::Journal*)),
           this,      SLOT(killNote(KCal::Journal*)) );

  // read the notes
  m_manager->load();

  // read the old config files, convert and add them
  KCal::CalendarLocal calendar( QString::fromLatin1( "UTC" ) );
  if ( KNotesLegacy::convert( &calendar ) ) {
    KCal::Journal::List notes = calendar.journals();
    KCal::Journal::List::ConstIterator it;
    for ( it = notes.constBegin(); it != notes.constEnd(); ++it ) {
      m_manager->addNewNote( *it );
    }

    m_manager->save();
  }

  // set up the alarm reminder - do it after loading the notes because this
  // is used as a check if updateNoteActions has to be called for a new note
  m_alarm = new KNotesAlarm( m_manager, this );

   updateNetworkListener();

  if ( m_notes.size() == 0 && !kapp->isSessionRestored() ) {
      newNote();
  }

  updateNoteActions();
}
コード例 #20
0
ファイル: fenetre.cpp プロジェクト: pcrouillere/NoteManager
void Fenetre::newImage(){newNote("Image");}
コード例 #21
0
ファイル: InstrumentTrack.cpp プロジェクト: Orpheon/lmms
InstrumentTrackView::InstrumentTrackView( InstrumentTrack * _it,
						trackContainerView * _tcv ) :
	trackView( _it, _tcv ),
	m_window( NULL ),
	m_lastPos( -1, -1 )
{
	setAcceptDrops( true );
	setFixedHeight( 32 );

	m_tlb = new trackLabelButton( this, getTrackSettingsWidget() );
	m_tlb->setCheckable( true );
	m_tlb->setIcon( embed::getIconPixmap( "instrument_track" ) );
	m_tlb->move( 3, 1 );
	m_tlb->show();

	connect( m_tlb, SIGNAL( toggled( bool ) ),
			this, SLOT( toggleInstrumentWindow( bool ) ) );

	connect( _it, SIGNAL( nameChanged() ),
			m_tlb, SLOT( update() ) );

	// creation of widgets for track-settings-widget
	m_volumeKnob = new knob( knobSmall_17, getTrackSettingsWidget(),
							tr( "Volume" ) );
	m_volumeKnob->setVolumeKnob( true );
	m_volumeKnob->setModel( &_it->m_volumeModel );
	m_volumeKnob->setHintText( tr( "Volume:" ) + " ", "%" );
	m_volumeKnob->move( DEFAULT_SETTINGS_WIDGET_WIDTH-24*2, 4 );
	m_volumeKnob->setLabel( tr( "VOL" ) );
	m_volumeKnob->show();
	m_volumeKnob->setWhatsThis( tr( volume_help ) );

	m_panningKnob = new knob( knobSmall_17, getTrackSettingsWidget(),
							tr( "Panning" ) );
	m_panningKnob->setModel( &_it->m_panningModel );
	m_panningKnob->setHintText( tr( "Panning:" ) + " ", "%" );
	m_panningKnob->move( DEFAULT_SETTINGS_WIDGET_WIDTH-24, 4 );
	m_panningKnob->setLabel( tr( "PAN" ) );
	m_panningKnob->show();


	m_midiMenu = new QMenu( tr( "MIDI" ), this );

	// sequenced MIDI?
	if( !engine::getMixer()->midiClient()->isRaw() )
	{
		_it->m_midiPort.m_readablePortsMenu = new MidiPortMenu(
							MidiPort::Input );
		_it->m_midiPort.m_writablePortsMenu = new MidiPortMenu(
							MidiPort::Output );
		_it->m_midiPort.m_readablePortsMenu->setModel(
							&_it->m_midiPort );
		_it->m_midiPort.m_writablePortsMenu->setModel(
							&_it->m_midiPort );
		m_midiInputAction = m_midiMenu->addMenu(
					_it->m_midiPort.m_readablePortsMenu );
		m_midiOutputAction = m_midiMenu->addMenu(
					_it->m_midiPort.m_writablePortsMenu );
	}
	else
	{
		m_midiInputAction = m_midiMenu->addAction( "" );
		m_midiOutputAction = m_midiMenu->addAction( "" );
		m_midiInputAction->setCheckable( true );
		m_midiOutputAction->setCheckable( true );
		connect( m_midiInputAction, SIGNAL( changed() ), this,
						SLOT( midiInSelected() ) );
		connect( m_midiOutputAction, SIGNAL( changed() ), this,
					SLOT( midiOutSelected() ) );
		connect( &_it->m_midiPort, SIGNAL( modeChanged() ),
				this, SLOT( midiConfigChanged() ) );
	}

	m_midiInputAction->setText( tr( "Input" ) );
	m_midiOutputAction->setText( tr( "Output" ) );

	m_activityIndicator = new fadeButton( QColor( 56, 60, 72 ),
						QColor( 64, 255, 16 ),
						getTrackSettingsWidget() );
	m_activityIndicator->setGeometry(
			DEFAULT_SETTINGS_WIDGET_WIDTH-2*24-11, 2, 8, 28 );
	m_activityIndicator->show();
	connect( m_activityIndicator, SIGNAL( pressed() ),
				this, SLOT( activityIndicatorPressed() ) );
	connect( m_activityIndicator, SIGNAL( released() ),
				this, SLOT( activityIndicatorReleased() ) );
	connect( _it, SIGNAL( newNote() ),
				m_activityIndicator, SLOT( activate() ) );


	setModel( _it );
}
コード例 #22
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
	// open database connection
    db = QSqlDatabase::addDatabase("QSQLITE");
    db.setDatabaseName("/Users/jdoud/dev/brainstorm.sqlite");
	if(!db.open())
	{
		qDebug() << db.lastError();
		qFatal("Failed to connect.");
	}

	// setup UI
    ui->setupUi(this);
	ui->toolBar->addWidget(ui->comboFonts);
	ui->toolBar->addWidget(ui->comboFontSizes);
	ui->toolBar->addWidget(ui->comboColors);

	// set text editor defaults
	ui->textNote->document()->setIndentWidth(20);
	ui->textNote->setTabStopWidth(20);
	ui->textNote->setTabChangesFocus(false);
	ui->actionIncrease_Indent->setShortcut(Qt::Key_Tab);
	ui->actionDecrease_Indent->setShortcut(Qt::Key_Backtab);

	// setup comboColors
	QPixmap pix(16, 16);
	pix.fill(Qt::white);
	ui->comboColors->addItem(pix, "");
	pix.fill(Qt::black);
	ui->comboColors->addItem(pix, "");
	pix.fill(Qt::red);
	ui->comboColors->addItem(pix, "");
	pix.fill(Qt::blue);
	ui->comboColors->addItem(pix, "");
	pix.fill(Qt::darkGreen);
	ui->comboColors->addItem(pix, "");
	pix.fill(Qt::gray);
	ui->comboColors->addItem(pix, "");


	// create system tray icon
	createActions();
	createTrayIcon();

	// create models
    categoriesModel = new QSqlTableModel();
	categoriesModel->setTable("categories");
	categoriesModel->setSort(1, Qt::AscendingOrder);
	categoriesModel->select();
	ui->listCategories->setModel(categoriesModel);
	ui->listCategories->setModelColumn(1);

    notesModel = new QSqlTableModel();
	notesModel->setTable("notes");
	ui->listNotes->setModel(notesModel);
	ui->listNotes->setModelColumn(2);

    // set splitter size
    QList<int> sizes;
    sizes << 230 << 150;
    ui->splitterLists->setSizes(sizes);
    sizes.clear();
    sizes << 230 << 600;
    ui->splitterNote->setSizes(sizes);

    // connect File menu slots
    connect(ui->actionNew_Category, SIGNAL(triggered()), this, SLOT(newCategory()));
    connect(ui->actionRename_Category, SIGNAL(triggered()), this, SLOT(renameCategory()));
    connect(ui->actionDelete_Category, SIGNAL(triggered()), this, SLOT(deleteCategory()));
    connect(ui->actionNew_Note, SIGNAL(triggered()), this, SLOT(newNote()));
    connect(ui->actionRename_Note, SIGNAL(triggered()), this, SLOT(renameNote()));
    connect(ui->actionSave_Note, SIGNAL(triggered()), this, SLOT(saveNote()));
    connect(ui->actionDelete_Note, SIGNAL(triggered()), this, SLOT(deleteNote()));
    connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(quit()));
    // connect Edit menu slots	
    connect(ui->actionFind_Replace, SIGNAL(triggered()), this, SLOT(findAndReplace()));
    // connect Format menu slots
    connect(ui->actionBold, SIGNAL(triggered()), this, SLOT(bold()));
    connect(ui->actionItalic, SIGNAL(triggered()), this, SLOT(italic()));
    connect(ui->actionUnderline, SIGNAL(triggered()), this, SLOT(underline()));
    connect(ui->actionStrikethrough, SIGNAL(triggered()), this, SLOT(strikethrough()));
    connect(ui->actionBullet_List, SIGNAL(triggered()), this, SLOT(bulletList()));
    connect(ui->actionNumber_List, SIGNAL(triggered()), this, SLOT(numberList()));
    connect(ui->actionIncrease_Indent, SIGNAL(triggered()), this, SLOT(increaseIndent()));
    connect(ui->actionDecrease_Indent, SIGNAL(triggered()), this, SLOT(decreaseIndent()));
    connect(ui->actionShow_Colors, SIGNAL(triggered()), this, SLOT(showColors()));
    connect(ui->actionShow_Fonts, SIGNAL(triggered()), this, SLOT(showFonts()));
    connect(ui->actionIncrease_Font, SIGNAL(triggered()), this, SLOT(increaseFont()));
    connect(ui->actionDecrease_Font, SIGNAL(triggered()), this, SLOT(decreaseFont()));
    connect(ui->actionReset_Font, SIGNAL(triggered()), this, SLOT(resetFont()));
    connect(ui->actionAlign_Left, SIGNAL(triggered()), this, SLOT(alignLeft()));
    connect(ui->actionAlign_Center, SIGNAL(triggered()), this, SLOT(alignCenter()));
    connect(ui->actionAlign_Right, SIGNAL(triggered()), this, SLOT(alignRight()));
    connect(ui->actionAlign_Justify, SIGNAL(triggered()), this, SLOT(alignJustify()));
    // connect View menu slots
    connect(ui->actionHide_Window, SIGNAL(triggered()), this, SLOT(hide()));
    connect(ui->actionPrevious_Category, SIGNAL(triggered()), this, SLOT(previousCategory()));
    connect(ui->actionNext_Category, SIGNAL(triggered()), this, SLOT(nextCategory()));
    connect(ui->actionPrevious_Note, SIGNAL(triggered()), this, SLOT(previousNote()));
    connect(ui->actionNext_Note, SIGNAL(triggered()), this, SLOT(nextNote()));
    // connect Help menu slots
    connect(ui->actionAbout_Brainstorm, SIGNAL(triggered()), this, SLOT(aboutBrainstorm()));
    connect(ui->actionAbout_Qt, SIGNAL(triggered()), this, SLOT(aboutQt()));
	// connect application slots
	connect(ui->textNote, SIGNAL(cursorPositionChanged()), this, SLOT(updateMenus()));
	connect(ui->textNote, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(updateMenus()));
    connect(ui->comboFonts, SIGNAL(activated(QString)), this, SLOT(setFont(QString)));
    connect(ui->comboFontSizes, SIGNAL(activated(QString)), this, SLOT(setFontSize(QString)));
    connect(ui->comboColors, SIGNAL(activated(int)), this, SLOT(setFontColor(int)));
	// connect category list slots
	connect(ui->listCategories->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(updateNoteList(QModelIndex)));
	// connect note list slots
	connect(ui->listNotes->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(updateNoteText(QModelIndex)));
	// connect text slots
	ui->textNote->installEventFilter((this));
	// connect system tray icon
    connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));

	// initialize default data
	ui->listCategories->selectionModel()->setCurrentIndex(categoriesModel->index(0, 1), QItemSelectionModel::SelectCurrent);

}