int Tiled::Internal::TilesetManager::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: tilesetChanged((*reinterpret_cast< Tileset*(*)>(_a[1]))); break; case 1: fileChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 2: fileChangedTimeout(); break; default: ; } _id -= 3; } return _id; }
int Tiled::Internal::AutomaticMappingManager::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: automap((*reinterpret_cast< QRegion(*)>(_a[1])),(*reinterpret_cast< Layer*(*)>(_a[2]))); break; case 1: fileChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 2: fileChangedTimeout(); break; default: ; } _id -= 3; } return _id; }
/*! Creates thread */ QFileInfoGatherer::QFileInfoGatherer(QObject *parent) : QThread(parent), abort(false), #ifndef QT_NO_FILESYSTEMWATCHER watcher(0), #endif m_iconProvider(&defaultProvider) { userId = getuid(); groupId = getgid(); #ifndef QT_NO_FILESYSTEMWATCHER watcher = new QFileSystemWatcher(this); connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(list(QString))); connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(updateFile(QString))); #endif start(LowPriority); }
ScriptEngine::ScriptEngine() : QObject(NULL) { DEBUG_BLOCK setObjectName("ScriptEngine"); qRegisterMetaType<ArenaWidget::Flags>("Flags"); qRegisterMetaType<ArenaWidget::Flags>("ArenaWidget::Flags"); connect(WulforSettings::getInstance(), SIGNAL(strValueChanged(QString,QString)), this, SLOT(slotWSKeyChanged(QString,QString))); connect(&watcher, SIGNAL(fileChanged(QString)), this, SLOT(slotScriptChanged(QString))); connect(GlobalTimer::getInstance(), SIGNAL(second()), this ,SLOT(slotProcessChangedFiles())); loadScripts(); }
LDeskBarPlugin::LDeskBarPlugin(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){ this->layout()->setContentsMargins(0,0,0,0); this->setStyleSheet( "QToolButton::menu-indicator{ image: none; } QToolButton{ padding: 0px; }"); //initialize the desktop bar items initializeDesktop(); //setup the directory watcher QString fav = QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/favorites.list"; if(!QFile::exists(fav)){ QProcess::execute("touch \""+fav+"\""); } watcher = new QFileSystemWatcher(this); watcher->addPath( fav ); connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(filechanged(QString)) ); QTimer::singleShot(1,this, SLOT(updateFiles()) ); //make sure to load it the first time QTimer::singleShot(0,this, SLOT(OrientationChange()) ); //adjust sizes/layout connect(QApplication::instance(), SIGNAL(DesktopFilesChanged()), this, SLOT(updateFiles()) ); }
FontRenderer::FontRenderer(QObject *parent,const FontConfig* config) : QObject(parent), m_config(config) { m_ft_library = 0; m_ft_face = 0; connect(config,SIGNAL(fileChanged()),this,SLOT(on_fontFileChanged())); connect(config,SIGNAL(faceIndexChanged()),this,SLOT(on_fontFaceIndexChanged())); connect(config,SIGNAL(sizeChanged()),this,SLOT(on_fontSizeChanged())); connect(config,SIGNAL(charactersChanged()),this,SLOT(on_fontCharactersChanged())); connect(config,SIGNAL(renderingOptionsChanged()),this,SLOT(on_fontOptionsChanged())); int error = FT_Init_FreeType(&m_ft_library); if (error) { qDebug() << "FT_Init_FreeType error " << error; m_ft_library = 0; } }
void MainWindow::init() { watcher = new QFileSystemWatcher(this); timer = NULL; connect(watcher,SIGNAL(fileChanged(QString)),this,SLOT(onFileChanged(QString))); connect(watcher,SIGNAL(directoryChanged(QString)),this,SLOT(onDirectoryChanged(QString))); connect(ui->watchEdit,SIGNAL(textChanged()),this,SLOT(onWatchEditChanged())); connect(ui->compareEdit,SIGNAL(textChanged()),this,SLOT(onCompareEditChanged())); connect(ui->exceptEdit,SIGNAL(textChanged()),this,SLOT(onExceptEditChanged())); // 注册表 pReg = new regeditHelper; connect(pReg,SIGNAL(getetInfoFinished(vector<pair<QString,bool>>)),this,SLOT(onGetRegInfo(vector<pair<QString,bool>>))); connect(ui->listWidget,SIGNAL(removeRegItem(QString)),pReg,SLOT(removeRegItem(QString))); connect(ui->listWidget,SIGNAL(enableRegItem(QString)),pReg,SLOT(enableRegItem(QString))); connect(ui->listWidget,SIGNAL(addRegItem(QString)),pReg,SLOT(addRegItem(QString))); pReg->refreshListView(); }
QuickVideoPreview::QuickVideoPreview(QQuickItem *parent) : #if CONFIG_FBO_ITEM QuickFBORenderer(parent) #else QQuickItemRenderer(parent) #endif { connect(&m_extractor, SIGNAL(positionChanged()), this, SIGNAL(timestampChanged())); connect(&m_extractor, SIGNAL(frameExtracted(QtAV::VideoFrame)), SLOT(displayFrame(QtAV::VideoFrame))); connect(&m_extractor, SIGNAL(error()), SLOT(displayNoFrame())); connect(this, SIGNAL(fileChanged()), SLOT(displayNoFrame())); } void QuickVideoPreview::setTimestamp(int value) { m_extractor.setPosition((qint64)value); }
int QFileSystemWatcher::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: fileChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 1: directoryChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 2: d_func()->_q_fileChanged((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break; case 3: d_func()->_q_directoryChanged((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break; default: ; } _id -= 4; } return _id; }
////////////////////////////////////////////////////////////////////////// /// Add a FileSystemWatcher to the directory /// /// Creates a FileSystemWatcher, connects all the signals, adds it to the /// list of watchers and starts it. ////////////////////////////////////////////////////////////////////////// void SyncSystem::slotStartNodeWatching(const QString& dir) { QString watchDir = joinPath(m_CurrentSourcePath, dir); qDebug() << "[SyncSystem.Debug] slotStartNodeWatching in dir " << watchDir; FileSystemWatcher* watcher = new FileSystemWatcher(); connect(watcher, SIGNAL(fileAdded(QString)), SLOT(slotFileAdded(QString))); connect(watcher, SIGNAL(fileDeleted(QString)), SLOT(slotFileDeleted(QString))); connect(watcher, SIGNAL(fileChanged(QString)), SLOT(slotFileChanged(QString))); connect(watcher, SIGNAL(fileRenamed(QString,QString)), SLOT(slotFileRenamed(QString,QString))); connect(watcher, SIGNAL(filewatchError(QString)), SLOT(slotFilewatchError(QString))); connect(watcher, SIGNAL(filewatchLostSync(QString)), SLOT(slotLostSync())); m_FileSystemWatchers.append(watcher); watcher->setWatchDir(watchDir); watcher->setRelativeDir(dir); watcher->start(); }
void TailView::setFile(const QString & filename) { m_filename = filename; setWindowFilePath(m_filename); if(!filename.isEmpty()) { m_watcher.reset(new YFileSystemWatcherThread(filename, this)); connect(m_watcher.data(), SIGNAL(fileChanged()), SLOT(onFileChanged())); } else { m_watcher.reset(); } verticalScrollBar()->setSliderPosition(0); horizontalScrollBar()->setSliderPosition(0); onFileChanged(); }
AppLauncherPlugin::AppLauncherPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID){ QVBoxLayout *lay = new QVBoxLayout(); this->setLayout(lay); lay->setContentsMargins(0,0,0,0); button = new OutlineToolButton(this); button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); button->setAutoRaise(true); button->setText("...\n..."); //Need to set something here so that initial sizing works properly button->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); lay->addWidget(button, 0, Qt::AlignCenter); connect(button, SIGNAL(DoubleClicked()), this, SLOT(buttonClicked()) ); button->setContextMenuPolicy(Qt::NoContextMenu); watcher = new QFileSystemWatcher(this); connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT( loadButton()) ); QTimer::singleShot(200,this, SLOT(loadButton()) ); }
void PickFileRadio::init(QPushButton* button, LineEdit* edit) { Q_ASSERT(button); if (mEdit) mEdit->disconnect(this); mEdit = edit; mButton = button; mButton->setEnabled(false); connect(mButton, SIGNAL(clicked()), SLOT(slotPickFile())); if (mEdit) { mEdit->setEnabled(false); connect(mEdit, SIGNAL(textChanged(QString)), SIGNAL(fileChanged())); } connect(mGroup, SIGNAL(buttonSet(QAbstractButton*)), SLOT(slotSelectionChanged(QAbstractButton*))); setReadOnly(RadioButton::isReadOnly()); }
//========= // PRIVATE //========= void SystemFlagWatcher::watchFlagDir(){ if(!QFile::exists(FLAGDIR)){ //just to silence all the warnings about missing directory pcbsd::Utils::runShellCommand("pc-systemflag CHECKDIR"); } watcher->addPath(FLAGDIR); //Now manually run the detection routine watcherNotification(); //Now check that the directory is being watched if(watcher->directories().isEmpty()){ //flag dir does not exist yet, try again in 2 minutes QTimer::singleShot(60000, this, SLOT(watchFlagDir()) ); //qDebug() << "Nothing watched: wait 1 minute"; }else{ connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(watcherNotification()) ); connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(watcherNotification()) ); } }
bool FileSystem::renameReplace(const QString& originFileName, const QString& destinationFileName, qint64 destinationSize, time_t destinationMtime, QString* errorString) { if (fileExists(destinationFileName) && fileChanged(destinationFileName, destinationSize, destinationMtime)) { if (errorString) { *errorString = qApp->translate("FileSystem", "The destination file has an unexpected size or modification time"); } return false; } return uncheckedRenameReplace(originFileName, destinationFileName, errorString); }
/*! Creates thread */ QFileInfoGatherer::QFileInfoGatherer(QObject *parent) : QThread(parent), abort(false), #ifndef QT_NO_FILESYSTEMWATCHER watcher(0), #endif #ifdef Q_OS_WIN m_resolveSymlinks(true), #endif m_iconProvider(&defaultProvider) { #ifndef QT_NO_FILESYSTEMWATCHER watcher = new QFileSystemWatcher(this); connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(list(QString))); connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(updateFile(QString))); #endif start(LowPriority); }
Library::Library(QString path, QObject *parent) : QObject(parent), directory(path), onlineSync(*this), mFilter(tvShows, directory), searchThread(NULL) { if (!directory.exists() && !QDir::root().mkpath(directory.absolutePath())) { qDebug() << "could not create library dir"; } addWallpaperDownloader(new Moebooru::Client(("http://konachan.com"))); addWallpaperDownloader(new Moebooru::Client(("https://yande.re"))); addWallpaperDownloader(new Gelbooru::Client()); fileSystemWatcher = new QFileSystemWatcher(this); connect(fileSystemWatcher, SIGNAL(fileChanged(QString)), this, SLOT(fileChangedInSearchDirectory(QString))); connect(fileSystemWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(fileChangedInSearchDirectory(QString))); }
YFileSystemWatcher::YFileSystemWatcher(const QString & filename) : m_watcher(new QFileSystemWatcher(this)) , m_timer(new QTimer(this)) , m_status(NoActivity) , m_filename(filename) , m_lastSize(0) { connect(m_watcher.data(), SIGNAL(fileChanged(QString)), SLOT(on_watcher_fileChanged(const QString &))); connect(m_timer.data(), SIGNAL(timeout()), SLOT(on_timer_timeout())); m_watcher->addPath(m_filename); QFileInfo info(m_filename); m_lastModification = info.lastModified(); m_lastSize = info.size(); m_timer->start(250); }
RazorWorkSpaceManager::RazorWorkSpaceManager(const QString & configId, RazorSettings * config) : DesktopPlugin(configId, config) , m_scene(0) , m_desktopCount(1) { qDebug() << "RazorWorkSpaceManager::RazorWorkSpaceManager" << configId; DesktopConfig::instance()->config = config; DesktopConfig::instance()->configId = configId; m_scene = new DesktopScene(this); m_scene->setBackgroundBrush(Qt::transparent); setup(); connect(razorApp, SIGNAL(themeChanged()), this, SLOT(setup())); QFileSystemWatcher *fw = new QFileSystemWatcher(this); fw->addPath(config->fileName()); connect(fw, SIGNAL(fileChanged(QString)), this, SLOT(setup())); }
XCodeProject::XCodeProject(XCodeManager *projectManager, const QString &projectFilePath) : d(new PrivateXCodeProject()) { d->m_projectManager = projectManager; d->m_projectFilePath = projectFilePath; d->m_projectFileWatcher = new QFileSystemWatcher(this); d->m_rootNode = new XCodeProjectNode(projectFilePath); d->m_projectFile.reset(new XCodeProjectFile(projectFilePath)); setProjectContext(Core::Context(Constants::XCODE_PROJECT_CONTEXT)); setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX)); connect(&d->m_modelReloadWatcher, SIGNAL(finished()), this, SLOT(parsingFinished())); startReparsing(); d->m_projectFileWatcher->addPath(projectFilePath); connect(d->m_projectFileWatcher, SIGNAL(fileChanged(QString)), this, SLOT(startReparsing())); }
ModelMapper::ModelMapper(QObject *parent) : QObject(parent) { m_watcher.addPath(QDir::currentPath()); qDebug() << Q_FUNC_INFO << "watching" << QDir::currentPath(); QDir dir; QStringList entryFilter; entryFilter << "*.json"; QStringList entries = dir.entryList(entryFilter, QDir::Files); foreach (const QString entry, entries){ if (addModel(entry)) { m_watcher.addPath(entry); qDebug() << Q_FUNC_INFO << "watching" << entry; } } connect(&m_watcher, SIGNAL(directoryChanged(QString)), this, SLOT(updateModelConfig(QString))); connect(&m_watcher, SIGNAL(fileChanged(QString)), this, SLOT(updateModelConfig(QString))); }
void FcitxQtConnectionPrivate::initialize() { m_serviceWatcher->setConnection(QDBusConnection::sessionBus()); m_serviceWatcher->addWatchedService(m_serviceName); QFileInfo info(socketFile()); QDir dir(info.path()); if (!dir.exists()) { QDir rt(QDir::root()); rt.mkpath(info.path()); } m_watcher->addPath(info.path()); if (info.exists()) { m_watcher->addPath(info.filePath()); } connect(m_watcher, SIGNAL(fileChanged(QString)), this, SLOT(socketFileChanged())); connect(m_watcher, SIGNAL(directoryChanged(QString)), this, SLOT(socketFileChanged())); m_initialized = true; }
void on_sourceAdded(const OSSIA::Value* val) { auto str_val = dynamic_cast<const OSSIA::String*>(val); if(!str_val) return; // Create the sound auto sound_obj = new SoundObj{str_val->value}; sound_obj->setParent(&m_scene); m_scene.sounds().insert(sound_obj); auto& sound = sound_obj->sound; // Create the callbacks and OSC device commands auto src_node = *m_sourcesListNode->emplace(m_sourcesListNode->children().cend(), str_val->value); // Position auto src_pos_node = *src_node->emplace(src_node->children().cend(), "pos"); add_position(src_pos_node, make_parameter( [&] () { return sound.source().Position(); }, [&] (const auto& elt) { sound.source().Position(elt); } )); // Enablement add_child(src_node, "enabled", OSSIA::Value::Type::BOOL, [&,sound_obj] (const OSSIA::Value* val) { auto enablement_val = dynamic_cast<const OSSIA::Bool*>(val); if(!enablement_val) return; sound_obj->enablementChanged(enablement_val->value); }); // Audio file add_child(src_node, "file", OSSIA::Value::Type::STRING, [&,sound_obj] (const OSSIA::Value* val) { auto filename_val = dynamic_cast<const OSSIA::String*>(val); if(!filename_val) return; sound_obj->fileChanged(QString::fromStdString(filename_val->value)); }); }
/*! Creates thread */ QFileInfoGatherer::QFileInfoGatherer(QObject *parent) : QThread(parent), abort(false), #ifndef QT_NO_FILESYSTEMWATCHER watcher(0), #endif m_resolveSymlinks(false), m_iconProvider(&defaultProvider) { #ifdef Q_OS_WIN m_resolveSymlinks = true; #elif !defined(Q_OS_INTEGRITY) && !defined(Q_OS_VXWORKS) userId = getuid(); groupId = getgid(); #endif #ifndef QT_NO_FILESYSTEMWATCHER watcher = new QFileSystemWatcher(this); connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(list(QString))); connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(updateFile(QString))); #endif start(LowPriority); }
void ImageFileDialog::init() { _preview = 0; QSplitter *splitter; splitter = ((QFileDialog*)this)->findChild<QSplitter*>("splitter"); if (splitter == 0) { return; } _preview = new QLabel(); QRect geomerty = _preview->geometry(); geomerty.setWidth(160); _preview->setGeometry(geomerty); splitter->addWidget(_preview); connect(this, SIGNAL(currentChanged(QString)), this, SLOT(fileChanged(QString))); }
BootManager::BootManager() : m_service(0), m_currentState(BOOT_STATE_STARTUP), m_compositorAvailable(false) { m_states[BOOT_STATE_STARTUP] = new BootStateStartup(); m_states[BOOT_STATE_FIRSTUSE] = new BootStateFirstUse(); m_states[BOOT_STATE_NORMAL] = new BootStateNormal(); startService(); connect(WebAppMgrProxy::instance(), SIGNAL(connectionStatusChanged()), this, SLOT(onWebAppMgrConnectionStatusChanged())); m_fileWatch.addPath("/var/luna/preferences"); connect(&m_fileWatch, SIGNAL(directoryChanged(QString)), this, SLOT(onFileChanged(QString))); connect(&m_fileWatch, SIGNAL(fileChanged(QString)), this, SLOT(onFileChanged(QString))); QTimer::singleShot(0, this, SLOT(onInitialize())); }
LDesktop::LDesktop(int deskNum) : QObject(){ DPREFIX = "desktop-"+QString::number(deskNum)+"/"; desktopnumber = deskNum; desktop = new QDesktopWidget(); defaultdesktop = (deskNum== desktop->primaryScreen()); xoffset = 0; for(int i=0; i<desktopnumber; i++){ xoffset += desktop->screenGeometry(i).width(); } deskMenu = new QMenu(0); appmenu = new AppMenu(0); workspacelabel = new QLabel(0); workspacelabel->setAlignment(Qt::AlignCenter); wkspaceact = new QWidgetAction(0); wkspaceact->setDefaultWidget(workspacelabel); //Setup the internal variables settings = new QSettings(QSettings::UserScope, "LuminaDE","desktopsettings", this); //qDebug() << " - Desktop Settings File:" << settings->fileName(); if(!QFile::exists(settings->fileName())){ settings->setValue(DPREFIX+"background/filelist",QStringList()<<"default"); settings->sync(); } bgtimer = new QTimer(this); bgtimer->setSingleShot(true); connect(bgtimer, SIGNAL(timeout()), this, SLOT(UpdateBackground()) ); watcher = new QFileSystemWatcher(this); connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(SettingsChanged()) ); watcher->addPath(settings->fileName()); bgWindow = new QWidget(0); bgWindow->setObjectName("bgWindow"); bgWindow->setContextMenuPolicy(Qt::CustomContextMenu); LX11::SetAsDesktop(bgWindow->winId()); bgWindow->setGeometry(xoffset,0,desktop->screenGeometry().width(), desktop->screenGeometry().height()); connect(bgWindow, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowMenu()) ); //Start the update processes QTimer::singleShot(1,this, SLOT(UpdateMenu()) ); QTimer::singleShot(1,this, SLOT(UpdateBackground()) ); QTimer::singleShot(1,this, SLOT(UpdateDesktop()) ); QTimer::singleShot(1,this, SLOT(UpdatePanels()) ); }
void FileInfo::readFile() { m_errorMessage = ""; m_fileInfo = QFileInfo(m_file); if (!m_fileInfo.exists()) m_errorMessage = tr("File does not exist"); emit fileChanged(); emit kindChanged(); emit iconChanged(); emit permissionsChanged(); emit sizeChanged(); emit modifiedChanged(); emit createdChanged(); emit absolutePathChanged(); emit nameChanged(); emit suffixChanged(); emit symLinkTargetChanged(); emit errorMessageChanged(); }
ProjectItem::ProjectItem(QObject *obj) : obj(obj) { if(const Camera *cam = qobject_cast<const Camera *>(obj)) { connect(cam, SIGNAL(nameChanged(QString)), SLOT(update())); } else if(const ImageSet *imageSet = qobject_cast<const ImageSet *>(obj)) { connect(imageSet, SIGNAL(nameChanged(QString)), SLOT(update())); connect(imageSet, SIGNAL(nameChanged(QString)), SLOT(update())); connect(imageSet, SIGNAL(nameChanged(QString)), SLOT(update())); } else if(const ProjectImage *image = qobject_cast<const ProjectImage *>(obj)) { connect(image, SIGNAL(fileChanged(QString)), SLOT(update())); connect(image, SIGNAL(cameraChanged(CameraPtr,CameraPtr)), SLOT(update(CameraPtr,CameraPtr))); if(CameraPtr cam = image->camera()) connect(cam.get(), SIGNAL(nameChanged(QString)), SLOT(update())); } // XXX Does this remove me from tree widget? connect(obj, SIGNAL(destroyed()), SLOT(deleteLater())); update(); }
void DatabaseFileWatcher::setEnabled(bool enabled) { if (!m_watcher) { m_watcher = new QFileSystemWatcher(this); connect(m_watcher, SIGNAL(fileChanged(QString)), SLOT(databaseChanged(QString))); connect(m_watcher, SIGNAL(directoryChanged(QString)), SLOT(databaseDirectoryChanged(QString))); } if (enabled) { if (QFile::exists(m_databasePath)) { if (!m_watcher->files().contains(m_databasePath)) m_watcher->addPath(m_databasePath); } else { restartDirMonitoring(QString()); } } else { m_watcher->removePath(m_databasePath); } }