bool KLineEdit::copySqueezedText(bool clipboard) const { if (!d->squeezedText.isEmpty() && d->squeezedStart) { int start, end; KLineEdit *that = const_cast<KLineEdit *>(this); if (!that->getSelection(&start, &end)) return false; if (start >= d->squeezedStart+3) start = start - 3 - d->squeezedStart + d->squeezedEnd; else if (start > d->squeezedStart) start = d->squeezedStart; if (end >= d->squeezedStart+3) end = end - 3 - d->squeezedStart + d->squeezedEnd; else if (end > d->squeezedStart) end = d->squeezedEnd; if (start == end) return false; QString t = d->squeezedText; t = t.mid(start, end - start); disconnect( QApplication::clipboard(), SIGNAL(selectionChanged()), this, 0); QApplication::clipboard()->setText( t, clipboard ? QClipboard::Clipboard : QClipboard::Selection ); connect( QApplication::clipboard(), SIGNAL(selectionChanged()), this, SLOT(clipboardChanged()) ); return true; } return false; }
QLCFixtureEditor::QLCFixtureEditor(QWidget* parent, QLCFixtureDef* fixtureDef, const QString& fileName) : QWidget(parent) , m_fixtureDef(fixtureDef) , m_fileName(fileName) , m_modified(false) { setupUi(this); init(); setCaption(); setModified(false); /* Connect to be able to enable/disable clipboard actions */ connect(_app, SIGNAL(clipboardChanged()), this, SLOT(slotClipboardChanged())); /* Initial update to clipboard actions */ slotClipboardChanged(); QSettings settings; QVariant var = settings.value(SETTINGS_GEOMETRY); if (var.isValid() == true) parentWidget()->restoreGeometry(var.toByteArray()); }
ClipboardSingleton::ClipboardSingleton(QObject *parent /* = NULL */) : QObject(parent) { connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardChanged())); qRegisterMetaType<ClipboardType>("ClipboardType"); }
void ClipboardPoll::timeout() { Klipper::updateTimestamp(); if( !kapp->clipboard()->ownsSelection() && checkTimestamp( selection ) ) { #ifdef NOISY_KLIPPER_ kDebug() << "SELECTION CHANGED"; #endif emit clipboardChanged( true ); } if( !kapp->clipboard()->ownsClipboard() && checkTimestamp( clipboard ) ) { #ifdef NOISY_KLIPPER_ kDebug() << "CLIPBOARD CHANGED"; #endif emit clipboardChanged( false ); } }
void SimpleList::do_connections() { connect(ui->tableViewFM, SIGNAL(clicked(QModelIndex)), this, SLOT(onRowClicked(QModelIndex))); connect(ui->tableViewFM, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onOpenItem(QModelIndex))); connect(m_model, SIGNAL(pathChanged(QString)), this, SLOT(onPathChanged(QString))); connect(ui->toolButtonUp, SIGNAL(clicked()), m_model, SLOT(cdUp())); connect(ui->toolButtonBack, SIGNAL(clicked()), m_model, SLOT(goBack())); connect(ui->actionCopy, SIGNAL(triggered()), m_model, SLOT(copySelection())); connect(ui->actionCut, SIGNAL(triggered()), m_model, SLOT(cutSelection())); connect(ui->actionDelete, SIGNAL(triggered()), m_model, SLOT(removeSelection())); connect(ui->actionPaste, SIGNAL(triggered()), m_model, SLOT(paste())); connect(ui->actionMoveToTrash,SIGNAL(triggered()), m_model, SLOT(moveSelectionToTrash())); connect(ui->actionTerminnal, SIGNAL(triggered()), this, SLOT(onOpenTerminal())); connect(ui->actionRestoreFromTrash, SIGNAL(triggered()), m_model, SLOT(restoreSelectionFromTrash())); connect(ui->checkBoxShowDirs, SIGNAL(clicked(bool)), m_model, SLOT(setShowDirectories(bool))); connect(ui->checkBoxShowHidden, SIGNAL(clicked(bool)), m_model, SLOT(setShowHiddenFiles(bool))); connect(ui->checkBoxExtFsWatcher, SIGNAL(clicked(bool)), m_model, SLOT(setEnabledExternalFSWatcher(bool))); connect(ui->checkBoxShowMediaInfo, SIGNAL(clicked(bool)),m_model, SLOT(setReadsMediaMetadata(bool))); connect(ui->checkBoxMultiSelection,SIGNAL(clicked(bool)), m_selection, SLOT(setMultiSelection(bool))); connect(ui->comboBoxPath, SIGNAL(activated(int)), this, SLOT(onPathChoosedFromList(int))); connect(ui->comboBoxPath->lineEdit(), SIGNAL(returnPressed()), this, SLOT(onPathComboEdited())); connect(ui->tableViewFM->horizontalHeader(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(onSetSort(int,Qt::SortOrder))); connect(m_model, SIGNAL(progress(int,int,int)), this, SLOT(onProgress(int,int,int))); connect(m_model, SIGNAL(clipboardChanged()), this, SLOT(onClipboardChanged())); connect(m_model, SIGNAL(error(QString,QString)), this, SLOT(onError(QString,QString))); connect(m_model, SIGNAL(awaitingResultsChanged()), this, SLOT(onStatusChanged())); connect(m_selection, SIGNAL(selectionChanged(int)), this, SLOT(onSelectionChanged(int))); connect(ui->listViewPlaces, SIGNAL(clicked(QModelIndex)), this, SLOT(onPlacesClicked(QModelIndex))); connect(m_pbar, SIGNAL(cancel()), this, SLOT(onCancelAction())); }
bool ClipboardPoll::x11Event( XEvent* e ) { // note that this is also installed as app-wide filter #ifdef HAVE_XFIXES if( xfixes_event_base != -1 && e->type == xfixes_event_base + XFixesSelectionNotify ) { XFixesSelectionNotifyEvent* ev = reinterpret_cast< XFixesSelectionNotifyEvent* >( e ); if( ev->selection == XA_PRIMARY && !kapp->clipboard()->ownsSelection()) { #ifdef NOISY_KLIPPER_ kDebug() << "SELECTION CHANGED (XFIXES)"; #endif QX11Info::setAppTime( ev->timestamp ); emit clipboardChanged( true ); } else if( ev->selection == xa_clipboard && !kapp->clipboard()->ownsClipboard()) { #ifdef NOISY_KLIPPER_ kDebug() << "CLIPBOARD CHANGED (XFIXES)"; #endif QX11Info::setAppTime( ev->timestamp ); emit clipboardChanged( false ); } } #endif if( e->type == SelectionNotify && e->xselection.requestor == winId()) { if( changedTimestamp( selection, *e ) ) { #ifdef NOISY_KLIPPER_ kDebug() << "SELECTION CHANGED (GOT TIMESTAMP)"; #endif emit clipboardChanged( true ); } if ( changedTimestamp( clipboard, *e ) ) { #ifdef NOISY_KLIPPER_ kDebug() << "CLIPBOARD CHANGED (GOT TIMESTAMP)"; #endif emit clipboardChanged( false ); } return true; // filter out } return false; }
void QLineEdit::clipboardChanged() { #if defined(_WS_X11_) disconnect( QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardChanged()) ); markDrag = markAnchor = cursorPos; repaint( !hasFocus() ); #endif }
// The hack for Windows: periodically check for clipboard changes void ImodClipboard::clipHackTimeout() { QClipboard *cb = QApplication::clipboard(); //cb->setSelectionMode(false); if (cb->text() == mSavedClipboard) return; mSavedClipboard = cb->text(); clipboardChanged(); }
void QLineEdit::copy() const { QString t = markedText(); if ( !t.isEmpty() ) { disconnect( QApplication::clipboard(), SIGNAL(dataChanged()), this, 0); QApplication::clipboard()->setText( t ); connect( QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardChanged()) ); } }
void App::setCopyChannel(QLCChannel* ch) { if (m_copyChannel != NULL) delete m_copyChannel; m_copyChannel = NULL; if (ch != NULL) m_copyChannel = new QLCChannel(ch); emit clipboardChanged(); }
/** * Initialize vim * * - Set default colors * - Create window and shell * - Read settings */ int gui_mch_init() { window = new MainWindow(&gui); // Load qVim settings QSettings settings("Vim", "qVim"); settings.beginGroup("mainwindow"); window->restoreState( settings.value("state").toByteArray() ); window->resize( settings.value("size", QSize(400, 400)).toSize() ); settings.endGroup(); vimshell = window->vimShell(); // Load qVim style QSettings ini(QSettings::IniFormat, QSettings::UserScope, "Vim", "qVim"); QFile styleFile( QFileInfo(ini.fileName()).absoluteDir().absoluteFilePath("qVim.style") ); if ( styleFile.open(QIODevice::ReadOnly) ) { window->setStyleSheet( styleFile.readAll() ); styleFile.close(); } // Clipboard - the order matters, for safety clip_plus.clipboardMode = QClipboard::Selection; clip_star.clipboardMode = QClipboard::Clipboard; QObject::connect(QApplication::clipboard(), SIGNAL(changed(QClipboard::Mode)), vimshell, SLOT(clipboardChanged(QClipboard::Mode))); display_errors(); /* Colors */ gui.norm_pixel = VimWrapper::toColor(QColor(Qt::black)); gui.back_pixel = VimWrapper::toColor(QColor(Qt::white)); set_normal_colors(); gui_check_colors(); highlight_gui_started(); gui.def_norm_pixel = VimWrapper::toColor(QColor(Qt::black)); gui.def_back_pixel = VimWrapper::toColor(QColor(Qt::white)); // The Scrollbar manages the scrollbars gui.scrollbar_width = 0; gui.scrollbar_height = 0; // Background color hint vimshell->setBackground(VimWrapper::backgroundColor() ); return OK; }
void TextShow::slotSelectionChanged() { #if COMPAT_QT_VERSION >= 0x030100 disconnect(QApplication::clipboard(), SIGNAL(selectionChanged()), this, 0); if (QApplication::clipboard()->supportsSelection()){ QTextDrag *drag = dragObject(NULL); if ( !drag ) return; QApplication::clipboard()->setData(drag, QClipboard::Selection); connect( QApplication::clipboard(), SIGNAL(selectionChanged()), this, SLOT(clipboardChanged())); } #endif }
void Controller::createConnections() { connect(_clipboard,SIGNAL(changed(QClipboard::Mode)),this,SLOT(clipboardChanged(QClipboard::Mode))); connect(_history,SIGNAL(added(ClipboardEntity*,int)),this,SLOT(history_itemAdded(ClipboardEntity*,int))); connect(_history,SIGNAL(removed(int,int)),this,SLOT(history_removed(int,int))); connect(_history,SIGNAL(cleared()),this,SLOT(history_cleared())); connect(_history,SIGNAL(locationExchanged(int,int)),this,SLOT(locationExchanged(int,int))); connect(_manager,SIGNAL(shown()),this,SLOT(manager_shown())); connect(_manager,SIGNAL(hidden()),this,SLOT(manager_hidden())); connect(_manager,SIGNAL(hidden()),_trayIcon,SLOT(managerHidden())); connect(_manager,SIGNAL(shown()),_trayIcon,SLOT(managerShown())); connect(_manager,SIGNAL(settingsDialogRequested()),this,SLOT(settingsWindowRequested())); connect(_manager,SIGNAL(itemSelected(int)),this,SLOT(itemSelected(int))); connect(_manager,SIGNAL(showContentRequested(ClipboardEntity*)),this,SLOT(showContent(ClipboardEntity*))); connect(_manager,SIGNAL(locationExchangeRequested(int,int)),this,SLOT(locationExchangeRequested(int,int))); connect(_trayIcon,SIGNAL(showHideManagerTriggerd()),this,SLOT(showHideManagerRequest())); connect(_trayIcon,SIGNAL(itemSelected(int)),this,SLOT(itemSelected(int))); connect(_trayIcon,SIGNAL(settingsDialogRequested()),this,SLOT(settingsWindowRequested())); connect(_trayIcon,SIGNAL(turnOffGenius()),this,SLOT(turnOffRequest())); connect(_trayIcon,SIGNAL(turnOnGenius()),this,SLOT(turnOnRequest())); connect(_trayIcon,SIGNAL(exitRequested()),this,SLOT(exitRequested())); connect(_trayIcon,SIGNAL(pause()),this,SLOT(pauseRequested())); connect(_trayIcon,SIGNAL(resume()),this,SLOT(resumeRequested())); connect(_selector,SIGNAL(closing(int)),this,SLOT(selectorClosed(int))); connect(_settingsWindow,SIGNAL(hiding()),this,SLOT(settingsWindow_hidden())); if(_openSelectorHotkey) connect(_openSelectorHotkey,SIGNAL(activated()),this,SLOT(openSelectorHKtriggered())); if(_clearHistoryHotKey) connect(_clearHistoryHotKey,SIGNAL(activated()),this,SLOT(clearHistoryHKTrigered())); if(_pasteLastHotKey) connect(_pasteLastHotKey,SIGNAL(activated()),this,SLOT(pasteLasteHKTrigered())); if(_openManagerHotKey) connect(_openManagerHotKey,SIGNAL(activated()),this,SLOT(openManagerHKTriggered())); if(_openSettingsHotKey) connect(_openSettingsHotKey,SIGNAL(activated()),this,SLOT(openSettingsHKTriggered())); if(_historyMenuHotKey) connect(_historyMenuHotKey,SIGNAL(activated()),this,SLOT(historyMenuHotkeyActivated())); }
int App::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: clipboardChanged(); break; case 1: slotFileNew(); break; case 2: slotFileOpen(); break; case 3: slotFileSave(); break; case 4: slotFileSaveAs(); break; case 5: slotFileQuit(); break; case 6: slotHelpIndex(); break; case 7: slotHelpAbout(); break; case 8: slotHelpAboutQt(); break; default: ; } _id -= 9; } return _id; }
ImodClipboard::ImodClipboard(bool useStdin, bool doingInitialLoad) : QObject() { QClipboard *cb = QApplication::clipboard(); //cb->setSelectionMode(false); mHandling = false; mDeferredHandling = 0; mExiting = 0; mDisconnected = false; mClipHackTimer = NULL; mStdinTimer = NULL; mUseStdin = useStdin; sInitialLoad = doingInitialLoad; if (useStdin) { #if defined(_WIN32) && defined(QT_THREAD_SUPPORT) sStdThread = new StdinThread(); sStdThread->start(); #endif mStdinTimer = new QTimer(this); connect(mStdinTimer, SIGNAL(timeout()), this, SLOT(stdinTimeout())); mStdinTimer->start(STDIN_INTERVAL); } else { // If the hack is needed, start a timer to check the clipboard #ifdef CLIPBOARD_TIMER_HACK mClipHackTimer = new QTimer(this); connect(mClipHackTimer, SIGNAL(timeout()), this, SLOT(clipHackTimeout())); mSavedClipboard = cb->text(); mClipHackTimer->start(CLIPBOARD_TIMER_HACK); #else // Otherwise just connect to signal for changes connect(cb, SIGNAL(dataChanged()), this, SLOT(clipboardChanged())); #endif } }
ArrangerView::ArrangerView(QWidget* parent) : TopWin(TopWin::ARRANGER, parent, "arrangerview", Qt::Window) { setWindowTitle(tr("MusE: Arranger")); setFocusPolicy(Qt::NoFocus); arranger = new Arranger(this, "arranger"); setCentralWidget(arranger); //setFocusProxy(arranger); scoreOneStaffPerTrackMapper = new QSignalMapper(this); scoreAllInOneMapper = new QSignalMapper(this); editSignalMapper = new QSignalMapper(this); QShortcut* sc = new QShortcut(shortcuts[SHRT_DELETE].key, this); sc->setContext(Qt::WindowShortcut); connect(sc, SIGNAL(activated()), editSignalMapper, SLOT(map())); editSignalMapper->setMapping(sc, CMD_DELETE); // Toolbars --------------------------------------------------------- editTools = new EditToolBar(this, arrangerTools); addToolBar(editTools); editTools->setObjectName("arrangerTools"); visTracks = new VisibleTracks(this); addToolBar(visTracks); connect(editTools, SIGNAL(toolChanged(int)), arranger, SLOT(setTool(int))); connect(visTracks, SIGNAL(visibilityChanged()), MusEGlobal::song, SLOT(update()) ); connect(arranger, SIGNAL(editPart(MusECore::Track*)), MusEGlobal::muse, SLOT(startEditor(MusECore::Track*))); connect(arranger, SIGNAL(dropSongFile(const QString&)), MusEGlobal::muse, SLOT(loadProjectFile(const QString&))); connect(arranger, SIGNAL(dropMidiFile(const QString&)), MusEGlobal::muse, SLOT(importMidi(const QString&))); connect(arranger, SIGNAL(startEditor(MusECore::PartList*,int)), MusEGlobal::muse, SLOT(startEditor(MusECore::PartList*,int))); connect(arranger, SIGNAL(toolChanged(int)), editTools, SLOT(set(int))); connect(MusEGlobal::muse, SIGNAL(configChanged()), arranger, SLOT(configChanged())); connect(arranger, SIGNAL(setUsedTool(int)), editTools, SLOT(set(int))); connect(arranger, SIGNAL(selectionChanged()), SLOT(selectionChanged())); connect(MusEGlobal::song, SIGNAL(songChanged(MusECore::SongChangedFlags_t)), this, SLOT(songChanged(MusECore::SongChangedFlags_t))); //-------- Edit Actions editCutAction = new QAction(QIcon(*editcutIconSet), tr("C&ut"), this); editCopyAction = new QAction(QIcon(*editcopyIconSet), tr("&Copy"), this); editCopyRangeAction = new QAction(QIcon(*editcopyIconSet), tr("Copy in range"), this); editPasteAction = new QAction(QIcon(*editpasteIconSet), tr("&Paste"), this); editPasteCloneAction = new QAction(QIcon(*editpasteCloneIconSet), tr("Paste c&lone"), this); editPasteToTrackAction = new QAction(QIcon(*editpaste2TrackIconSet), tr("Paste to selected &track"), this); editPasteCloneToTrackAction = new QAction(QIcon(*editpasteClone2TrackIconSet), tr("Paste clone to selected trac&k"), this); editPasteDialogAction = new QAction(QIcon(*editpasteIconSet), tr("Paste (show dialo&g)"), this); editInsertEMAction = new QAction(QIcon(*editpasteIconSet), tr("&Insert Empty Measure"), this); editDeleteSelectedAction = new QAction(QIcon(*edit_track_delIcon), tr("Delete Selected Tracks"), this); editDuplicateSelTrackAction = new QAction(QIcon(*edit_track_addIcon), tr("Duplicate Selected Tracks"), this); editShrinkPartsAction = new QAction(tr("Shrink selected parts"), this); editExpandPartsAction = new QAction(tr("Expand selected parts"), this); editCleanPartsAction = new QAction(tr("Purge hidden events from selected parts"), this); addTrack = new QMenu(tr("Add Track"), this); addTrack->setIcon(QIcon(*edit_track_addIcon)); select = new QMenu(tr("Select"), this); select->setIcon(QIcon(*selectIcon)); editSelectAllAction = new QAction(QIcon(*select_allIcon), tr("Select &All"), this); editDeselectAllAction = new QAction(QIcon(*select_deselect_allIcon), tr("&Deselect All"), this); editInvertSelectionAction = new QAction(QIcon(*select_invert_selectionIcon), tr("Invert &Selection"), this); editInsideLoopAction = new QAction(QIcon(*select_inside_loopIcon), tr("&Inside Loop"), this); editOutsideLoopAction = new QAction(QIcon(*select_outside_loopIcon), tr("&Outside Loop"), this); editAllPartsAction = new QAction( QIcon(*select_all_parts_on_trackIcon), tr("All &Parts on Track"), this); scoreSubmenu = new QMenu(tr("Score"), this); scoreSubmenu->setIcon(QIcon(*scoreIconSet)); scoreAllInOneSubsubmenu = new QMenu(tr("all tracks in one staff"), this); scoreOneStaffPerTrackSubsubmenu = new QMenu(tr("one staff per track"), this); scoreSubmenu->addMenu(scoreAllInOneSubsubmenu); scoreSubmenu->addMenu(scoreOneStaffPerTrackSubsubmenu); updateScoreMenus(); startScoreEditAction = new QAction(*scoreIconSet, tr("New score window"), this); startPianoEditAction = new QAction(*pianoIconSet, tr("Pianoroll"), this); startDrumEditAction = new QAction(QIcon(*edit_drummsIcon), tr("Drums"), this); startListEditAction = new QAction(QIcon(*edit_listIcon), tr("List"), this); startWaveEditAction = new QAction(QIcon(*edit_waveIcon), tr("Wave"), this); master = new QMenu(tr("Mastertrack"), this); master->setIcon(QIcon(*edit_mastertrackIcon)); masterGraphicAction = new QAction(QIcon(*mastertrack_graphicIcon),tr("Graphic"), this); masterListAction = new QAction(QIcon(*mastertrack_listIcon),tr("List"), this); midiTransformerAction = new QAction(QIcon(*midi_transformIcon), tr("Midi &Transform"), this); //-------- Structure Actions strGlobalCutAction = new QAction(tr("Global Cut"), this); strGlobalInsertAction = new QAction(tr("Global Insert"), this); strGlobalSplitAction = new QAction(tr("Global Split"), this); strGlobalCutSelAction = new QAction(tr("Global Cut - selected tracks"), this); strGlobalInsertSelAction = new QAction(tr("Global Insert - selected tracks"), this); strGlobalSplitSelAction = new QAction(tr("Global Split - selected tracks"), this); //------------------------------------------------------------- // popup Edit //------------------------------------------------------------- QMenu* menuEdit = menuBar()->addMenu(tr("&Edit")); menuEdit->addActions(MusEGlobal::undoRedo->actions()); menuEdit->addSeparator(); menuEdit->addAction(editCutAction); menuEdit->addAction(editCopyAction); menuEdit->addAction(editCopyRangeAction); menuEdit->addAction(editPasteAction); menuEdit->addAction(editPasteToTrackAction); menuEdit->addAction(editPasteCloneAction); menuEdit->addAction(editPasteCloneToTrackAction); menuEdit->addAction(editPasteDialogAction); menuEdit->addAction(editInsertEMAction); menuEdit->addSeparator(); menuEdit->addAction(editShrinkPartsAction); menuEdit->addAction(editExpandPartsAction); menuEdit->addAction(editCleanPartsAction); menuEdit->addSeparator(); menuEdit->addAction(editDeleteSelectedAction); menuEdit->addMenu(addTrack); menuEdit->addAction(editDuplicateSelTrackAction); menuEdit->addMenu(select); select->addAction(editSelectAllAction); select->addAction(editDeselectAllAction); select->addAction(editInvertSelectionAction); select->addAction(editInsideLoopAction); select->addAction(editOutsideLoopAction); select->addAction(editAllPartsAction); menuEdit->addSeparator(); menuEdit->addAction(startPianoEditAction); menuEdit->addMenu(scoreSubmenu); menuEdit->addAction(startScoreEditAction); menuEdit->addAction(startDrumEditAction); menuEdit->addAction(startListEditAction); menuEdit->addAction(startWaveEditAction); menuEdit->addMenu(master); master->addAction(masterGraphicAction); master->addAction(masterListAction); menuEdit->addSeparator(); menuEdit->addAction(midiTransformerAction); QMenu* menuStructure = menuEdit->addMenu(tr("&Structure")); menuStructure->addAction(strGlobalCutAction); menuStructure->addAction(strGlobalInsertAction); menuStructure->addAction(strGlobalSplitAction); menuStructure->addSeparator(); menuStructure->addAction(strGlobalCutSelAction); menuStructure->addAction(strGlobalInsertSelAction); menuStructure->addAction(strGlobalSplitSelAction); QMenu* functions_menu = menuBar()->addMenu(tr("Functions")); QAction* func_quantize_action = functions_menu->addAction(tr("&Quantize Notes"), editSignalMapper, SLOT(map())); QAction* func_notelen_action = functions_menu->addAction(tr("Change note &length"), editSignalMapper, SLOT(map())); QAction* func_velocity_action = functions_menu->addAction(tr("Change note &velocity"), editSignalMapper, SLOT(map())); QAction* func_cresc_action = functions_menu->addAction(tr("Crescendo/Decrescendo"), editSignalMapper, SLOT(map())); QAction* func_transpose_action = functions_menu->addAction(tr("Transpose"), editSignalMapper, SLOT(map())); QAction* func_erase_action = functions_menu->addAction(tr("Erase Events (Not Parts)"), editSignalMapper, SLOT(map())); QAction* func_move_action = functions_menu->addAction(tr("Move Events (Not Parts)"), editSignalMapper, SLOT(map())); QAction* func_fixed_len_action = functions_menu->addAction(tr("Set Fixed Note Length"), editSignalMapper, SLOT(map())); QAction* func_del_overlaps_action = functions_menu->addAction(tr("Delete Overlapping Notes"), editSignalMapper, SLOT(map())); QAction* func_legato_action = functions_menu->addAction(tr("Legato"), editSignalMapper, SLOT(map())); editSignalMapper->setMapping(func_quantize_action, CMD_QUANTIZE); editSignalMapper->setMapping(func_notelen_action, CMD_NOTELEN); editSignalMapper->setMapping(func_velocity_action, CMD_VELOCITY); editSignalMapper->setMapping(func_cresc_action, CMD_CRESCENDO); editSignalMapper->setMapping(func_transpose_action, CMD_TRANSPOSE); editSignalMapper->setMapping(func_erase_action, CMD_ERASE); editSignalMapper->setMapping(func_move_action, CMD_MOVE); editSignalMapper->setMapping(func_fixed_len_action, CMD_FIXED_LEN); editSignalMapper->setMapping(func_del_overlaps_action, CMD_DELETE_OVERLAPS); editSignalMapper->setMapping(func_legato_action, CMD_LEGATO); QMenu* menuSettings = menuBar()->addMenu(tr("Window &Config")); menuSettings->addAction(tr("Configure &custom columns"), this, SLOT(configCustomColumns())); menuSettings->addSeparator(); menuSettings->addAction(subwinAction); menuSettings->addAction(shareAction); menuSettings->addAction(fullscreenAction); //-------- Edit connections connect(editCutAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editCopyAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editCopyRangeAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editPasteAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editPasteCloneAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editPasteToTrackAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editPasteCloneToTrackAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editPasteDialogAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editInsertEMAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editDeleteSelectedAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editDuplicateSelTrackAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editShrinkPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editExpandPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editCleanPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editSelectAllAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editDeselectAllAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editInvertSelectionAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editInsideLoopAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editOutsideLoopAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editAllPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); editSignalMapper->setMapping(editCutAction, CMD_CUT); editSignalMapper->setMapping(editCopyAction, CMD_COPY); editSignalMapper->setMapping(editCopyRangeAction, CMD_COPY_RANGE); editSignalMapper->setMapping(editPasteAction, CMD_PASTE); editSignalMapper->setMapping(editPasteCloneAction, CMD_PASTE_CLONE); editSignalMapper->setMapping(editPasteToTrackAction, CMD_PASTE_TO_TRACK); editSignalMapper->setMapping(editPasteCloneToTrackAction, CMD_PASTE_CLONE_TO_TRACK); editSignalMapper->setMapping(editPasteDialogAction, CMD_PASTE_DIALOG); editSignalMapper->setMapping(editInsertEMAction, CMD_INSERTMEAS); editSignalMapper->setMapping(editDeleteSelectedAction, CMD_DELETE_TRACK); editSignalMapper->setMapping(editDuplicateSelTrackAction, CMD_DUPLICATE_TRACK); editSignalMapper->setMapping(editShrinkPartsAction, CMD_SHRINK_PART); editSignalMapper->setMapping(editExpandPartsAction, CMD_EXPAND_PART); editSignalMapper->setMapping(editCleanPartsAction, CMD_CLEAN_PART); editSignalMapper->setMapping(editSelectAllAction, CMD_SELECT_ALL); editSignalMapper->setMapping(editDeselectAllAction, CMD_SELECT_NONE); editSignalMapper->setMapping(editInvertSelectionAction, CMD_SELECT_INVERT); editSignalMapper->setMapping(editInsideLoopAction, CMD_SELECT_ILOOP); editSignalMapper->setMapping(editOutsideLoopAction, CMD_SELECT_OLOOP); editSignalMapper->setMapping(editAllPartsAction, CMD_SELECT_PARTS); connect(editSignalMapper, SIGNAL(mapped(int)), this, SLOT(cmd(int))); connect(startPianoEditAction, SIGNAL(activated()), MusEGlobal::muse, SLOT(startPianoroll())); connect(startScoreEditAction, SIGNAL(activated()), MusEGlobal::muse, SLOT(startScoreQuickly())); connect(startDrumEditAction, SIGNAL(activated()), MusEGlobal::muse, SLOT(startDrumEditor())); connect(startListEditAction, SIGNAL(activated()), MusEGlobal::muse, SLOT(startListEditor())); connect(startWaveEditAction, SIGNAL(activated()), MusEGlobal::muse, SLOT(startWaveEditor())); connect(scoreOneStaffPerTrackMapper, SIGNAL(mapped(QWidget*)), MusEGlobal::muse, SLOT(openInScoreEdit_oneStaffPerTrack(QWidget*))); connect(scoreAllInOneMapper, SIGNAL(mapped(QWidget*)), MusEGlobal::muse, SLOT(openInScoreEdit_allInOne(QWidget*))); connect(masterGraphicAction, SIGNAL(activated()), MusEGlobal::muse, SLOT(startMasterEditor())); connect(masterListAction, SIGNAL(activated()), MusEGlobal::muse, SLOT(startLMasterEditor())); connect(midiTransformerAction, SIGNAL(activated()), MusEGlobal::muse, SLOT(startMidiTransformer())); //-------- Structure connections connect(strGlobalCutAction, SIGNAL(activated()), SLOT(globalCut())); connect(strGlobalInsertAction, SIGNAL(activated()), SLOT(globalInsert())); connect(strGlobalSplitAction, SIGNAL(activated()), SLOT(globalSplit())); connect(strGlobalCutSelAction, SIGNAL(activated()), SLOT(globalCutSel())); connect(strGlobalInsertSelAction, SIGNAL(activated()), SLOT(globalInsertSel())); connect(strGlobalSplitSelAction, SIGNAL(activated()), SLOT(globalSplitSel())); connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(updateShortcuts())); QClipboard* cb = QApplication::clipboard(); connect(cb, SIGNAL(dataChanged()), SLOT(clipboardChanged())); connect(cb, SIGNAL(selectionChanged()), SLOT(clipboardChanged())); finalizeInit(); // work around for probable QT/WM interaction bug. // for certain window managers, e.g xfce, this window is // is displayed although not specifically set to show(); // bug: 2811156 Softsynth GUI unclosable with XFCE4 (and a few others) // Nov 21, 2012 Hey this causes the thing not to open at all, EVER, on Lubuntu and some others! // And we had a request to remove this from a knowledgable tester. REMOVE Tim. ///show(); ///hide(); }
int main(int argc, char **argv) { int action; double timeout = 5.; int argIndex, numArgs; int interval; char *endptr; QString qstr; QTime curTime = QTime::currentTime(); int timeStamp = 60000 * curTime.minute() + 1000 * curTime.second() + curTime.msec(); for (argIndex = 1; argIndex < argc - 1 ; argIndex++) { if (argv[argIndex][0] == '-'){ switch (argv[argIndex][1]){ case 't': /* timeout interval */ timeout = strtod(argv[++argIndex], &endptr); if (endptr - argv[argIndex] < (int)strlen(argv[argIndex])) { fprintf(stderr, "ERROR: imodsendevent - invalid timeout entry %s\n", argv[argIndex]); exit(3); } break; case 'D': /* debug */ debugOut = 1; break; default: fprintf(stderr, "ERROR: imodsendevent - invalid argument %s\n", argv[argIndex]); exit(3); break; } } else break; } numArgs = argc - argIndex; if (numArgs < 2) { fprintf(stderr, "ERROR: imodsendevent - Wrong number of arguments\n" " Usage: imodsendevent [-t timeout] [-D] Window_ID action " "[arguments]\n"); exit(3); } // Check the arguments for odd characters winID = strtol(argv[argIndex], &endptr, 10); if (endptr - argv[argIndex] < (int)strlen(argv[argIndex])) { fprintf(stderr, "ERROR: imodsendevent - invalid characters in window ID" " entry %s\n", argv[argIndex]); exit(3); } action = strtol(argv[argIndex + 1], &endptr, 10); if (endptr - argv[argIndex + 1] < (int)strlen(argv[argIndex + 1])) { fprintf(stderr, "ERROR: imodsendevent - invalid characters in action " "entry %s\n", argv[argIndex + 1]); exit(3); } // Create the application ImodSendEvent a(argc, argv); setlocale(LC_NUMERIC, "C"); // Pack the arguments into a QString timeStr.sprintf(" %d ", timeStamp); timeStr = QString(argv[argIndex]) + timeStr; cmdStr = QString(argv[argIndex + 1]); for (; argIndex + 2 < argc; argIndex++) cmdStr += QString(" ") + QString(argv[argIndex + 2]); qstr = timeStr + cmdStr; // Connect to the clipboard, start the timeout, and send the text QClipboard *cb = QApplication::clipboard(); // Default for setText and text() is Clipboard mode //cb->setSelectionMode(false); cb->blockSignals(true); QObject::connect(cb, SIGNAL(dataChanged()), &a, SLOT(clipboardChanged())); cb->blockSignals(false); // Start a timeout timer if the interval is not zero. interval = (int)(1000. * timeout + 0.5); if (interval > 0) { // If this hack is defined and > 0, divide the total timeout into intervals // of this length and retry sending message #ifdef SENDEVENT_RETRY_HACK if (SENDEVENT_RETRY_HACK > 0) { retryLimit = interval / SENDEVENT_RETRY_HACK; if (!retryLimit) retryLimit = 1; interval = SENDEVENT_RETRY_HACK; } #endif a.startTimer(interval); } if (debugOut) fprintf(stderr, "Imodsendevent sending: %s\n", LATIN1(qstr)); cb->setText(qstr); // If the hack is defined as zero, just process events and set the text again #ifdef SENDEVENT_RETRY_HACK if (SENDEVENT_RETRY_HACK == 0) { qApp->processEvents(); cb->setText(qstr); } #endif return a.exec(); }
AsemanDevices::AsemanDevices(QObject *parent) : QObject(parent) { p = new AsemanDevicesPrivate; p->hide_keyboard_timer = 0; p->keyboard_stt = false; #ifdef Q_OS_ANDROID p->java_layer = AsemanJavaLayer::instance(); connect( p->java_layer, SIGNAL(incomingShare(QString,QString)), SLOT(incoming_share(QString,QString)), Qt::QueuedConnection ); connect( p->java_layer, SIGNAL(incomingImage(QString)) , SLOT(incoming_image(QString)) , Qt::QueuedConnection ); connect( p->java_layer, SIGNAL(selectImageResult(QString)) , SLOT(select_image_result(QString)) , Qt::QueuedConnection ); connect( p->java_layer, SIGNAL(activityPaused()) , SLOT(activity_paused()) , Qt::QueuedConnection ); connect( p->java_layer, SIGNAL(activityResumed()) , SLOT(activity_resumed()) , Qt::QueuedConnection ); #endif connect( QGuiApplication::inputMethod(), SIGNAL(visibleChanged()), SLOT(keyboard_changed()) ); connect( static_cast<QGuiApplication*>(QCoreApplication::instance())->clipboard(), SIGNAL(dataChanged()), SIGNAL(clipboardChanged()) ); QScreen *scr = screen(); if( scr ) connect( scr, SIGNAL(geometryChanged(QRect)), SIGNAL(geometryChanged()) ); }
void ClipboardPoll::qtClipboardChanged() { emit clipboardChanged( false ); }
void ClipboardPoll::qtSelectionChanged() { emit clipboardChanged( true ); }
GuiBehind::GuiBehind(DuktoWindow* view) : QObject(NULL), mView(view), mShowBackTimer(NULL), mPeriodicHelloTimer(NULL), mClipboard(NULL), mMiniWebServer(NULL), mSettings(NULL), mDestBuddy(NULL), mUpdatesChecker(NULL) { // Status variables mView->setGuiBehindReference(this); setCurrentTransferProgress(0); setTextSnippetSending(false); setShowUpdateBanner(false); // Clipboard object mClipboard = QApplication::clipboard(); connect(mClipboard, SIGNAL(dataChanged()), this, SLOT(clipboardChanged())); clipboardChanged(); // Add "Me" entry mBuddiesList.addMeElement(); // Add "Ip" entry mBuddiesList.addIpElement(); // Settings mSettings = new Settings(this); // Mini web server mMiniWebServer = new MiniWebServer(NETWORK_PORT + 1); // Destination buddy mDestBuddy = new DestinationBuddy(this); // Change current folder QDir::setCurrent(mSettings->currentPath()); // Set current theme color mTheme.setThemeColor(mSettings->themeColor()); // Init buddy list view->rootContext()->setContextProperty("buddiesListData", &mBuddiesList); view->rootContext()->setContextProperty("recentListData", &mRecentList); view->rootContext()->setContextProperty("ipAddressesData", &mIpAddresses); view->rootContext()->setContextProperty("guiBehind", this); view->rootContext()->setContextProperty("destinationBuddy", mDestBuddy); view->rootContext()->setContextProperty("theme", &mTheme); // Register protocol signals connect(&mDuktoProtocol, SIGNAL(peerListAdded(Peer)), this, SLOT(peerListAdded(Peer))); connect(&mDuktoProtocol, SIGNAL(peerListRemoved(Peer)), this, SLOT(peerListRemoved(Peer))); connect(&mDuktoProtocol, SIGNAL(receiveFileStart(QString)), this, SLOT(receiveFileStart(QString))); connect(&mDuktoProtocol, SIGNAL(transferStatusUpdate(qint64,qint64)), this, SLOT(transferStatusUpdate(qint64,qint64))); connect(&mDuktoProtocol, SIGNAL(receiveFileComplete(QStringList*,qint64)), this, SLOT(receiveFileComplete(QStringList*,qint64))); connect(&mDuktoProtocol, SIGNAL(receiveTextComplete(QString*,qint64)), this, SLOT(receiveTextComplete(QString*,qint64))); connect(&mDuktoProtocol, SIGNAL(sendFileComplete(QStringList*)), this, SLOT(sendFileComplete(QStringList*))); connect(&mDuktoProtocol, SIGNAL(sendFileError(int)), this, SLOT(sendFileError(int))); connect(&mDuktoProtocol, SIGNAL(receiveFileCancelled()), this, SLOT(receiveFileCancelled())); connect(&mDuktoProtocol, SIGNAL(sendFileAborted()), this, SLOT(sendFileAborted())); // Register other signals connect(this, SIGNAL(remoteDestinationAddressChanged()), this, SLOT(remoteDestinationAddressHandler())); // Say "hello" mDuktoProtocol.setPorts(NETWORK_PORT, NETWORK_PORT); mDuktoProtocol.initialize(); mDuktoProtocol.sayHello(QHostAddress::Broadcast); // Periodic "hello" timer mPeriodicHelloTimer = new QTimer(this); connect(mPeriodicHelloTimer, SIGNAL(timeout()), this, SLOT(periodicHello())); mPeriodicHelloTimer->start(60000); // Load GUI view->setSource(QUrl("qrc:/qml/dukto/Dukto.qml")); //view->setSource(QUrl::fromLocalFile("c:/users/emanuele/documenti/dukto/qml/dukto/Dukto.qml")); #ifndef Q_WS_S60 view->restoreGeometry(mSettings->windowGeometry()); #endif // Start random rotate mShowBackTimer = new QTimer(this); connect(mShowBackTimer, SIGNAL(timeout()), this, SLOT(showRandomBack())); qsrand(QDateTime::currentDateTime().toTime_t());; mShowBackTimer->start(10000); // Enqueue check for updates mUpdatesChecker = new UpdatesChecker(); connect(mUpdatesChecker, SIGNAL(updatesAvailable()), this, SLOT(showUpdatesMessage())); QTimer::singleShot(2000, mUpdatesChecker, SLOT(start())); // TEMP // Peer p(QHostAddress("172.16.3.3"), "Pippo at Pluto (Macintosh)"); // Peer p(QHostAddress("172.16.3.3"), "NomeUtenteMoltoLungoCheNonCiSta at IlMioPcCheHaUnNomeImpensabilmenteLungo (Macintosh)", 4644); // peerListAdded(p); }
void ClipboardMonitor::checkClipboard(QClipboard::Mode mode) { #ifdef COPYQ_WS_X11 m_x11->cancelSynchronization(); #endif // Check clipboard after interval because someone is updating it very quickly. bool needToWait = m_updateTimer->isActive(); if (mode == QClipboard::Clipboard) m_needCheckClipboard = needToWait; #ifdef COPYQ_WS_X11 else if (mode == QClipboard::Selection) m_needCheckSelection = needToWait; #endif else return; m_updateTimer->start(); if (needToWait) return; #ifdef COPYQ_WS_X11 if ( mode == QClipboard::Selection && m_x11->isSelectionIncomplete() ) return; if ( m_x11->maybeResetClipboard(mode) ) return; #endif COPYQ_LOG( QString("Checking for new %1 content.") .arg(mode == QClipboard::Clipboard ? "clipboard" : "selection") ); // get clipboard data const QMimeData *data = clipboardData(mode); // data retrieved? if (!data) { log( tr("Cannot access clipboard data!"), LogError ); return; } // clone only mime types defined by user #if defined(Q_OS_MAC) // On OS X, when you copy files in Finder, etc. you get: // - The file name(s) (not paths) as plain text // - The file URI(s) // - The icon (not thumbnail) for the type of item you have in various image formants // We really only want the URI list, so throw the rest away QStringList formats = m_formats; if (data->formats().contains(mimeUriList) && formats.contains(mimeUriList)) { formats = QStringList() << mimeUriList; } QVariantMap data2( cloneData(*data, formats) ); #else QVariantMap data2( cloneData(*data, m_formats) ); #endif // add window title of clipboard owner if ( !data2.contains(mimeOwner) && !data2.contains(mimeWindowTitle) ) { PlatformPtr platform = createPlatformNativeInterface(); PlatformWindowPtr currentWindow = platform->getCurrentWindow(); if (currentWindow) data2.insert( mimeWindowTitle, currentWindow->getTitle().toUtf8() ); } #ifdef COPYQ_WS_X11 m_x11->setData(mode, data2); if (mode == QClipboard::Clipboard) { if ( !ownsClipboardData(data2) && m_x11->synchronize(QClipboard::Selection) ) m_needCheckSelection = false; clipboardChanged(data2); } else { data2.insert(mimeClipboardMode, "selection"); if ( !ownsClipboardData(data2) && m_x11->synchronize(QClipboard::Clipboard) ) m_needCheckClipboard = false; if ( m_x11->hasCheckSelection() ) clipboardChanged(data2); } #else /* !COPYQ_WS_X11 */ clipboardChanged(data2); #endif }
DirModel::DirModel(QObject *parent) : DirItemAbstractListModel(parent) , mFilterDirectories(false) , mShowDirectories(true) , mAwaitingResults(false) , mIsRecursive(false) , mReadsMediaMetadata(false) , mShowHiddenFiles(false) , mOnlyAllowedPaths(false) , mSortBy(SortByName) , mSortOrder(SortAscending) , mCompareFunction(0) , mExtFSWatcher(false) , mClipboard(new Clipboard(this)) , mLocationFactory(new LocationsFactory(this)) , mCurLocation(0) , m_fsAction(new FileSystemAction(this) ) { mNameFilters = QStringList() << "*"; mSelection = new DirSelection(this, &mDirectoryContents); connect(m_fsAction, SIGNAL(progress(int,int,int)), this, SIGNAL(progress(int,int,int))); connect(m_fsAction, SIGNAL(added(DirItemInfo)), this, SLOT(onItemAdded(DirItemInfo))); connect(m_fsAction, SIGNAL(added(QString)), this, SLOT(onItemAdded(QString))); connect(m_fsAction, SIGNAL(removed(DirItemInfo)), this, SLOT(onItemRemoved(DirItemInfo))); connect(m_fsAction, SIGNAL(removed(QString)), this, SLOT(onItemRemoved(QString))); connect(m_fsAction, SIGNAL(error(QString,QString)), this, SIGNAL(error(QString,QString))); connect(this, SIGNAL(pathChanged(QString)), m_fsAction, SLOT(pathChanged(QString))); connect(mClipboard, SIGNAL(clipboardChanged()), this, SIGNAL(clipboardChanged())); connect(m_fsAction, SIGNAL(changed(DirItemInfo)), this, SLOT(onItemChanged(DirItemInfo))); connect(mClipboard, SIGNAL(clipboardChanged()), m_fsAction, SLOT(onClipboardChanged())); connect(m_fsAction, SIGNAL(recopy(QStringList,QString)), mClipboard, SLOT(copy(QStringList,QString))); setCompareAndReorder(); if (QIcon::themeName().isEmpty() && !FMUtil::hasTriedThemeName()) { FMUtil::setThemeName(); } foreach (const Location* l, mLocationFactory->availableLocations()) { connect(l, SIGNAL(itemsAdded(DirItemInfoList)), this, SLOT(onItemsAdded(DirItemInfoList))); connect(l, SIGNAL(itemsFetched()), this, SLOT(onItemsFetched())); connect(l, SIGNAL(extWatcherItemAdded(DirItemInfo)), this, SLOT(onItemAddedOutsideFm(DirItemInfo))); connect(l, SIGNAL(extWatcherItemRemoved(DirItemInfo)), this, SLOT(onItemRemovedOutSideFm(DirItemInfo))); connect(l, SIGNAL(extWatcherItemChanged(DirItemInfo)), this, SLOT(onItemChangedOutSideFm(DirItemInfo))); connect(l, SIGNAL(extWatcherChangesFetched(int)), this, SLOT(onExternalFsWorkerFinished(int))); connect(l, SIGNAL(extWatcherPathChanged(QString)), this, SLOT(onThereAreExternalChanges(QString))); connect(this, SIGNAL(enabledExternalFSWatcherChanged(bool)), l, SLOT(setUsingExternalWatcher(bool))); } }
void ClipboardMonitor::checkClipboard(QClipboard::Mode mode) { #ifdef COPYQ_WS_X11 if ( m_x11->isSynchronizing() ) return; m_x11->synchronizeNone(); #endif // Check clipboard after interval because someone is updating it very quickly. bool needToWait = m_updateTimer->isActive(); if (mode == QClipboard::Clipboard) m_needCheckClipboard = needToWait; #ifdef COPYQ_WS_X11 else if (mode == QClipboard::Selection) m_needCheckSelection = needToWait; #endif m_updateTimer->start(); if (needToWait) return; COPYQ_LOG( QString("Checking for new %1 content.") .arg(mode == QClipboard::Clipboard ? "clipboard" : "selection") ); #ifdef COPYQ_WS_X11 if (mode == QClipboard::Clipboard) { if ( QApplication::clipboard()->ownsClipboard() ) return; } else if (mode == QClipboard::Selection) { if ( (!m_checksel && !m_copysel) || QApplication::clipboard()->ownsSelection() || !updateSelection(false) ) { return; } } else { return; } #else /* !COPYQ_WS_X11 */ // check if clipboard data are needed if (mode != QClipboard::Clipboard || QApplication::clipboard()->ownsClipboard()) return; #endif // get clipboard data const QMimeData *data = clipboardData(mode); // data retrieved? if (!data) { log( tr("Cannot access clipboard data!"), LogError ); return; } // clone only mime types defined by user QMimeData *data2 = cloneData(*data, &m_formats); // any data found? if ( data2->formats().isEmpty() ) { delete data2; return; } // add window title of clipboard owner PlatformPtr platform = createPlatformNativeInterface(); data2->setData( QString(mimeWindowTitle), platform->getWindowTitle(platform->getCurrentWindow()).toUtf8() ); #ifdef COPYQ_WS_X11 if (mode == QClipboard::Clipboard) { if (m_copyclip) m_x11->synchronize(data2, QClipboard::Selection); clipboardChanged(mode, data2); } else { if (m_copysel) m_x11->synchronize(data2, QClipboard::Clipboard); if (m_checksel) clipboardChanged(mode, data2); else delete data2; } #else /* !COPYQ_WS_X11 */ clipboardChanged(mode, data2); #endif }
bool MainWindow::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: showProperties((QObject*)static_QUType_ptr.get(_o+1)); break; case 1: updateProperties((QObject*)static_QUType_ptr.get(_o+1)); break; case 2: showDialogHelp(); break; case 3: showDebugStep((QObject*)static_QUType_ptr.get(_o+1),(int)static_QUType_int.get(_o+2)); break; case 4: showStackFrame((QObject*)static_QUType_ptr.get(_o+1),(int)static_QUType_int.get(_o+2)); break; case 5: showErrorMessage((QObject*)static_QUType_ptr.get(_o+1),(int)static_QUType_int.get(_o+2),(const QString&)static_QUType_QString.get(_o+3)); break; case 6: finishedRun(); break; case 7: breakPointsChanged(); break; case 8: fileNew(); break; case 9: fileNewDialog(); break; case 10: fileNewFile(); break; case 11: fileClose(); break; case 12: fileQuit(); break; case 13: fileCloseProject(); break; case 14: fileOpen(); break; case 15: fileOpen((const QString&)static_QUType_QString.get(_o+1),(const QString&)static_QUType_QString.get(_o+2)); break; case 16: fileOpen((const QString&)static_QUType_QString.get(_o+1),(const QString&)static_QUType_QString.get(_o+2),(const QString&)static_QUType_QString.get(_o+3)); break; case 17: fileOpen((const QString&)static_QUType_QString.get(_o+1),(const QString&)static_QUType_QString.get(_o+2),(const QString&)static_QUType_QString.get(_o+3),(bool)static_QUType_bool.get(_o+4)); break; case 18: static_QUType_bool.set(_o,fileSave()); break; case 19: static_QUType_bool.set(_o,fileSaveForm()); break; case 20: static_QUType_bool.set(_o,fileSaveProject()); break; case 21: static_QUType_bool.set(_o,fileSaveAs()); break; case 22: fileSaveAll(); break; case 23: fileCreateTemplate(); break; case 24: editUndo(); break; case 25: editRedo(); break; case 26: editCut(); break; case 27: editCopy(); break; case 28: editPaste(); break; case 29: editDelete(); break; case 30: editSelectAll(); break; case 31: editLower(); break; case 32: editRaise(); break; case 33: editAdjustSize(); break; case 34: editLayoutHorizontal(); break; case 35: editLayoutVertical(); break; case 36: editLayoutHorizontalSplit(); break; case 37: editLayoutVerticalSplit(); break; case 38: editLayoutGrid(); break; case 39: editLayoutContainerHorizontal(); break; case 40: editLayoutContainerVertical(); break; case 41: editLayoutContainerGrid(); break; case 42: editBreakLayout(); break; case 43: editAccels(); break; case 44: editFunctions(); break; case 45: editConnections(); break; case 46: static_QUType_ptr.set(_o,editSource()); break; case 47: static_QUType_ptr.set(_o,editSource((SourceFile*)static_QUType_ptr.get(_o+1))); break; case 48: static_QUType_ptr.set(_o,openSourceEditor()); break; case 49: static_QUType_ptr.set(_o,createSourceEditor((QObject*)static_QUType_ptr.get(_o+1),(Project*)static_QUType_ptr.get(_o+2))); break; case 50: static_QUType_ptr.set(_o,createSourceEditor((QObject*)static_QUType_ptr.get(_o+1),(Project*)static_QUType_ptr.get(_o+2),(const QString&)static_QUType_QString.get(_o+3))); break; case 51: static_QUType_ptr.set(_o,createSourceEditor((QObject*)static_QUType_ptr.get(_o+1),(Project*)static_QUType_ptr.get(_o+2),(const QString&)static_QUType_QString.get(_o+3),(const QString&)static_QUType_QString.get(_o+4))); break; case 52: static_QUType_ptr.set(_o,createSourceEditor((QObject*)static_QUType_ptr.get(_o+1),(Project*)static_QUType_ptr.get(_o+2),(const QString&)static_QUType_QString.get(_o+3),(const QString&)static_QUType_QString.get(_o+4),(bool)static_QUType_bool.get(_o+5))); break; case 53: editFormSettings(); break; case 54: editProjectSettings(); break; case 55: editPixmapCollection(); break; case 56: editDatabaseConnections(); break; case 57: editPreferences(); break; case 58: projectInsertFile(); break; case 59: searchFind(); break; case 60: searchIncremetalFindMenu(); break; case 61: searchIncremetalFind(); break; case 62: searchIncremetalFindNext(); break; case 63: searchReplace(); break; case 64: searchGotoLine(); break; case 65: previewForm(); break; case 66: previewForm((const QString&)static_QUType_QString.get(_o+1)); break; case 67: toolsCustomWidget(); break; case 68: toolsConfigure(); break; case 69: helpContents(); break; case 70: helpManual(); break; case 71: helpAbout(); break; case 72: helpAboutQt(); break; case 73: helpRegister(); break; case 74: activeWindowChanged((QWidget*)static_QUType_ptr.get(_o+1)); break; case 75: updateUndoRedo((bool)static_QUType_bool.get(_o+1),(bool)static_QUType_bool.get(_o+2),(const QString&)static_QUType_QString.get(_o+3),(const QString&)static_QUType_QString.get(_o+4)); break; case 76: updateEditorUndoRedo(); break; case 77: toolSelected((QAction*)static_QUType_ptr.get(_o+1)); break; case 78: clipboardChanged(); break; case 79: selectionChanged(); break; case 80: windowsMenuActivated((int)static_QUType_int.get(_o+1)); break; case 81: setupWindowActions(); break; case 82: createNewTemplate(); break; case 83: projectSelected((QAction*)static_QUType_ptr.get(_o+1)); break; case 84: setupRecentlyFilesMenu(); break; case 85: setupRecentlyProjectsMenu(); break; case 86: recentlyFilesMenuActivated((int)static_QUType_int.get(_o+1)); break; case 87: recentlyProjectsMenuActivated((int)static_QUType_int.get(_o+1)); break; case 88: emitProjectSignals(); break; case 89: showStartDialog(); break; case 90: doFunctionsChanged(); break; case 91: static_QUType_bool.set(_o,openProjectSettings((Project*)static_QUType_ptr.get(_o+1))); break; default: return QMainWindow::qt_invoke( _id, _o ); } return TRUE; }
void ClipboardMonitor::onClipboardChanged(ClipboardMode mode) { QVariantMap data = m_clipboard->data(mode, m_formats); auto clipboardData = mode == ClipboardMode::Clipboard ? &m_clipboardData : &m_selectionData; if ( hasSameData(data, *clipboardData) ) { COPYQ_LOG( QString("Ignoring unchanged %1") .arg(mode == ClipboardMode::Clipboard ? "clipboard" : "selection") ); return; } *clipboardData = data; COPYQ_LOG( QString("%1 changed, owner is \"%2\"") .arg(mode == ClipboardMode::Clipboard ? "Clipboard" : "Selection", getTextData(data, mimeOwner)) ); if (mode != ClipboardMode::Clipboard) { const QString modeName = mode == ClipboardMode::Selection ? "selection" : "find buffer"; data.insert(mimeClipboardMode, modeName); } // add window title of clipboard owner if ( !data.contains(mimeOwner) && !data.contains(mimeWindowTitle) ) { PlatformPtr platform = createPlatformNativeInterface(); PlatformWindowPtr currentWindow = platform->getCurrentWindow(); if (currentWindow) data.insert( mimeWindowTitle, currentWindow->getTitle().toUtf8() ); } #ifdef HAS_MOUSE_SELECTIONS if ( (mode == ClipboardMode::Clipboard ? m_clipboardToSelection : m_selectionToClipboard) && !data.contains(mimeOwner) ) { const auto text = getTextData(data); if ( !text.isEmpty() ) { const auto targetData = mode == ClipboardMode::Clipboard ? &m_selectionData : &m_clipboardData; const auto targetText = getTextData(*targetData); emit synchronizeSelection(mode, text, qHash(targetText)); } } #endif // run automatic commands if ( anySessionOwnsClipboardData(data) ) { emit clipboardChanged(data, ClipboardOwnership::Own); } else if ( isClipboardDataHidden(data) ) { emit clipboardChanged(data, ClipboardOwnership::Hidden); } else { const auto defaultTab = m_clipboardTab.isEmpty() ? defaultClipboardTabName() : m_clipboardTab; setTextData(&data, defaultTab, mimeCurrentTab); #ifdef HAS_MOUSE_SELECTIONS if (mode == ClipboardMode::Clipboard ? m_storeClipboard : m_storeSelection) { #else if (m_storeClipboard) { #endif setTextData(&data, m_clipboardTab, mimeOutputTab); } emit clipboardChanged(data, ClipboardOwnership::Foreign); } }