예제 #1
0
/* 初始化相应的信号与槽 */
void TextEditer::initConnection()
{
	/* menuFile里的信号与槽 */
	connect(actNew, SIGNAL(triggered()), this, SLOT(doNew()));
	connect(actOpen, SIGNAL(triggered()), this, SLOT(doOpen()));
	connect(actClose, SIGNAL(triggered()), this, SLOT(doClose()));
	connect(actSave, SIGNAL(triggered()), this, SLOT(doSave()));
	connect(actASave, SIGNAL(triggered()), this, SLOT(doASave()));
	connect(actExit, SIGNAL(triggered()), this, SLOT(doExit()));

	/* menuEdit里的信号与槽 */
	connect(actUndo, SIGNAL(triggered()), this, SLOT(doUndo()));
	connect(actRedo, SIGNAL(triggered()), this, SLOT(doRedo()));
	connect(actCut, SIGNAL(triggered()), this, SLOT(doCut()));
	connect(actCopy, SIGNAL(triggered()), this, SLOT(doCopy()));
	connect(actPast, SIGNAL(triggered()), this, SLOT(doPast()));
	connect(actAll, SIGNAL(triggered()), this, SLOT(doSelectAll()));

	/* menuTool里的信号与槽 */
	connect(actFont, SIGNAL(triggered()), this, SLOT(setFontForText()));

	/* 当当前文本内容改变后, 自动调用doModified() */
	connect(textEdit->document(), SIGNAL(contentsChanged()),
				this, SLOT(doModified()));

	/* 当文档修改后, 刷新光标所在的位置 */
	connect(textEdit->document(), SIGNAL(contentsChanged()),
			this, SLOT(doCursorChanged()));
}
END_BP_SERVICE_DESC

void
OpenContainingFolder::open(const bplus::service::Transaction& tran, const bplus::Map& args) {
    // dig out args
    const bplus::Path* bpPath = dynamic_cast<const bplus::Path*>(args.value("file"));
    if (!bpPath) {
        throw std::string("required files parameter missing");
    }
    boost::filesystem::path path((bplus::tPathString)*bpPath);
    if (!bp::file::pathExists(path)) {
        std::string msg = bp::file::nativeUtf8String(path) + " does not exist";
        log(BP_ERROR, msg);
        tran.error("openError", msg.c_str());
        return;
    }
    std::string errMsg;
    if (!doOpen(path, errMsg)) {
        log(BP_ERROR, errMsg);
        tran.error("openError", errMsg.c_str());
        return;
    }
    // return massive success
    bplus::Map results;
    results.add("success", new bplus::Bool(true));
    tran.complete(results);
}
예제 #3
0
 InterfaceUART::InterfaceUART(const std::string& dev, unsigned baud_rate):
   m_baud_rate(baud_rate),
   m_dev(dev),
   m_handle(NULL)
 {
   doOpen();
 }
BufferID Notepad_plus::openAllFilesInDirectory(NotepadFile notepadFile)
{
	vector<generic_string> fileNames;
	vector<generic_string> patterns;
	patterns.push_back(TEXT("*.*"));


	generic_string fileNameStr = notepadFile.getLongFileName();
	if (notepadFile.getLongFileName()[lstrlen(notepadFile.getLongFileName()) - 1] != '\\')
		fileNameStr += TEXT("\\");

	getMatchedFileNames(fileNameStr.c_str(), patterns, fileNames, true, false);
	size_t nbFiles2Open = fileNames.size();

	bool ok2Open = true;
	if (nbFiles2Open > 200) {
		int answer = _nativeLangSpeaker.messageBox("NbFileToOpenImportantWarning",
										getMainWindowHandle(),
										TEXT("$INT_REPLACE$ files are about to be opened.\rAre you sure to open them?"),
										TEXT("Amount of files to open is too large"),
										MB_YESNO|MB_APPLMODAL,
										nbFiles2Open);
		ok2Open = answer == IDYES;
	}

	if (ok2Open) {
		for (size_t i = 0 ; i < nbFiles2Open ; i++)
			doOpen(fileNames[i].c_str());
	}
	return BUFFER_INVALID;

}
예제 #5
0
int QTshotWidget::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: doHelp(); break;
        case 1: doQuit(); break;
        case 2: doOpen(); break;
        case 3: doNew(); break;
        case 4: doSave(); break;
        case 5: doData(); break;
        case 6: doExport(); break;
        case 7: doExportOK(); break;
        case 8: doOptions(); break;
        case 9: doToggle(); break;
        case 10: doCollapse(); break;
        case 11: doPlan(); break;
        case 12: doExtended(); break;
        case 13: do3D(); break;
        case 14: doCrossSection((*reinterpret_cast< DBlock*(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2])),(*reinterpret_cast< bool(*)>(_a[3]))); break;
        case 15: doCrossSection((*reinterpret_cast< DBlock*(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break;
        case 16: value_changed((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 17: double_clicked((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3])),(*reinterpret_cast< const QPoint(*)>(_a[4]))); break;
        }
        _id -= 18;
    }
    return _id;
}
예제 #6
0
파일: Interface.cpp 프로젝트: retlaw84/dune
 void
 Interface::open(bool query)
 {
   doOpen();
   if (query)
     getFirmwareInfo();
 }
예제 #7
0
			MemoryOutputStreamBuffer(std::string const & fn, int64_t const rbuffersize)
			: 
			  fd(doOpen(fn)), 
			  buffersize((rbuffersize < 0) ? getDefaultBlockSize() : rbuffersize), 
			  buffer(buffersize,false)
			{
				setp(buffer.begin(),buffer.end()-1);
			}
			LinuxStreamingPosixFdOutputStreamBuffer(std::string const & fn, int64_t const rbuffersize)
			: fd(doOpen(fn)), closefd(true), 
			  optblocksize((rbuffersize < 0) ? getOptimalIOBlockSize(fd,std::string()) : rbuffersize),
			  buffersize(optblocksize),
			  buffer(buffersize,false), prevwrite(0,0)
			{
				setp(buffer.begin(),buffer.end()-1);
			}
예제 #9
0
/* Convert a FILE* to PGPFile* in Write Mode */
PGPFile *
pgpFileWriteOpen (PGPContextRef	cdkContext,
	FILE *file, PGPCFBContext *cfbp)
{
	(void)cfbp;		/* Avoid warning */
	pgpAssert (cfbp == NULL);
	return doOpen ( cdkContext, file, PGP_FILE_WRITE);
} 
예제 #10
0
void QJDTextBrowser::initConnect()
{
    connect(ui->textEdit,SIGNAL(cursorPositionChanged()),this,SLOT(doCursorChanged()));
    connect(ui->action_Open,SIGNAL(triggered()),this,SLOT(doOpen()));
    connect(ui->action_Exit,SIGNAL(triggered()),this,SLOT(doQuit()));
    connect(ui->action_Copy,SIGNAL(triggered()),this,SLOT(doCopy()));
    connect(ui->action_All,SIGNAL(triggered()),this,SLOT(doAll()));
}
예제 #11
0
파일: File.cpp 프로젝트: susu/papyrus-war
bool File::open()
{
  if (!isOpen())
  {
    m_opened = doOpen();
    return m_opened;
  }
  return false;
}
예제 #12
0
/* Same as above, but don't close the FILE automatically */
PGPFile *
pgpFileWriteOpenDontClose (PGPContextRef context,
	FILE *file, PGPCFBContext *cfbp)
{
	(void)cfbp;		/* Avoid warning */
	pgpAssert (cfbp == NULL);
	return doOpen ( context,
			file, PGP_FILE_WRITE | FLAGS_DONTCLOSE);
} 
예제 #13
0
파일: Socket.cpp 프로젝트: RGB-RSL/rgb
void Socket::open()
{
	doOpen(m_socket);
	m_open = true;
	int err = setCloseOnExec();
	if(err < 0)
	{
		err = errno;
		close();
		throw OpenErr(err);
	}
}
예제 #14
0
/* Convert a FILE* to PGPFile* in Read Mode */
PGPFile *
pgpFileReadOpen ( PGPContextRef context,
	FILE *file, PGPUICb const *ui, void *ui_arg)
{
	(void)ui;
	(void)ui_arg;
	/*
	 * We still need to check the file for encryption and obtain
	 * the decryption key, somehow.
	 */

	return doOpen ( context, file, PGP_FILE_READ);
}
예제 #15
0
/**
 * @brief EngineClient::~LocalServer
 *  Destructor
 */
EngineClient::~EngineClient()
{
    if(ipClient)
    {
        disconnect(this, SIGNAL(sendMessage(QString)), ipClient, SLOT(sendMessage(QString)));
        disconnect(ipClient, SIGNAL(messageIn(QString)), this, SLOT(slotOnData(QString)));
        disconnect(this, SIGNAL(closed()), ipClient, SLOT(doClose()));
        disconnect(this, SIGNAL(open()), ipClient, SLOT(doOpen()));
        disconnect(ipClient, SIGNAL(closeThread()), this, SLOT(connectionLost()));
        delete ipClient;
    }
    ipClient=NULL;
}
			MemoryInputOutputStreamBuffer(std::string const & fn, std::ios_base::openmode const cxxmode, int64_t const rbuffersize)
			: 
			  fd(doOpen(fn,cxxmode)), 
			  buffersize(rbuffersize < 0 ? getDefaultBlockSize() : rbuffersize), 
			  buffer(buffersize,false),
			  readpos(0),
			  writepos(0)
			{
				// empty get buffer
				setg(buffer.end(),buffer.end(),buffer.end());
				// empty put buffer
				setp(buffer.begin(),buffer.end()-1);
			}
예제 #17
0
int 
IODevice::open(void *configure)
{
    if(doConfigIOParam(configure) != MW_SUCCESS)
		return MW_FAILED;

	if(doOpen(NULL) != 0)
		return MW_FAILED;

	state_ = IODEV_READY;

	return MW_SUCCESS;
}
예제 #18
0
void BotGameUrlClickHandler::onClick(Qt::MouseButton button) const {
	auto urlText = tryConvertUrlToLocal(url());

	if (urlText.startsWith(qstr("tg://"))) {
		App::openLocalUrl(urlText);
	} else if (!_bot || _bot->isVerified() || Local::isBotTrusted(_bot)) {
		doOpen(urlText);
	} else {
		Ui::show(Box<ConfirmBox>(lng_allow_bot_pass(lt_bot_name, _bot->name), lang(lng_allow_bot), [bot = _bot, urlText] {
			Ui::hideLayer();
			Local::makeBotTrusted(bot);
			UrlClickHandler::doOpen(urlText);
		}));
	}
}
예제 #19
0
			MemoryInputStreamBuffer(
				std::string const & rfn,
				int64_t const rblocksize,
				uint64_t const rputbackspace = 0
			)
			: 
			  fd(doOpen(rfn)),
			  filesize(fd->getFileSize()),
			  blocksize((rblocksize < 0) ? getDefaultBlockSize() : rblocksize),
			  putbackspace(rputbackspace),
			  buffer(putbackspace + blocksize,false),
			  symsread(0)
			{
				init(false);
			}
예제 #20
0
int SplashWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDialog::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: doOpen(); break;
        case 1: doData(); break;
        case 2: doCancel(); break;
        }
        _id -= 3;
    }
    return _id;
}
예제 #21
0
PGPFile *
pgpFileProcWriteOpen ( 	PGPContextRef context,
	FILE *file, PGPError (*doClose) (FILE *file, void *arg),
		      void *arg)
{
	PGPFile *fp;
	File *f;

	fp = doOpen ( context, file, PGP_PROC_WRITE);
	f = (File *)fp->priv;
	pgpAssert (f);

	f->doClose = doClose;
	f->closeArg = arg;
	return fp;
}
예제 #22
0
EngineClient::EngineClient() : QThread(NULL)
{
    if(!ipClient)
    {
        ipClient = new IpsEngineClient();
        connect(this, SIGNAL(sendMessage(QString)), ipClient, SLOT(sendMessage(QString)));
        connect(ipClient, SIGNAL(messageIn(QString)), this, SLOT(slotOnData(QString)));
        connect(this, SIGNAL(closed()), ipClient, SLOT(doClose()));
        connect(this, SIGNAL(open()), ipClient, SLOT(doOpen()));
        connect(ipClient, SIGNAL(closeThread()), this, SLOT(connectionLost()));
    }
    readyToSendLvlx = false;
    _connected = false;
    _busy = false;
    working=false;
    doSendData = false;
}
예제 #23
0
ProxyChooser::ProxyChooser(ProxyManager *m, QWidget *parent, const char *name)
:QWidget(parent, name)
{
	d = new Private;
	d->m = m;
	connect(m, SIGNAL(settingsChanged()), SLOT(pm_settingsChanged()));
	QHBoxLayout *hb = new QHBoxLayout(this, 0, 4);
	d->cb_proxy = new QComboBox(this);
	QSizePolicy sp = d->cb_proxy->sizePolicy();
	d->cb_proxy->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, sp.verData()) );
	hb->addWidget(d->cb_proxy);
	d->pb_edit = new QPushButton(tr("Edit..."), this);
	connect(d->pb_edit, SIGNAL(clicked()), SLOT(doOpen()));
	hb->addWidget(d->pb_edit);

	buildComboBox();
}
예제 #24
0
void *__PHYSFS_platformOpenAppend(const char *filename)
{
    void *retval = doOpen(filename, GENERIC_WRITE, OPEN_ALWAYS, 0);
    if (retval != NULL)
    {
        HANDLE h = ((win32file *) retval)->handle;
        DWORD rc = SetFilePointer(h, 0, NULL, FILE_END);
        if (rc == PHYSFS_INVALID_SET_FILE_POINTER)
        {
            const char *err = win32strerror();
            CloseHandle(h);
            free(retval);
            BAIL_MACRO(err, NULL);
        } /* if */
    } /* if */

    return(retval);
} /* __PHYSFS_platformOpenAppend */
예제 #25
0
파일: game.cpp 프로젝트: DavidRVi/MyZork
void Game::doAction(const Actions action) {
	switch (action)
	{
	case GO: doGo(); break;
	case QUIT: doQuit(); break;
	case PICK: doPick(); break;
	case DROP: doDrop(); break;
	case READ: doRead(); break;
	case BREAK: doBreak(); break;
	case SEE: doSee(); break;
	case OPEN: doOpen(); break;
	case FILL: doFill(); break;
	case USE: doUse(); break;
	case PUT: doPut(); break;
	case NOACTION: doNothing(); break;
	default: doNothing();
	}
}
예제 #26
0
void *__PHYSFS_platformOpenAppend(const char *filename)
{
    void *retval = doOpen(filename, GENERIC_WRITE, OPEN_ALWAYS, 0);
    if (retval != NULL)
    {
        HANDLE h = ((WinApiFile *) retval)->handle;
        DWORD rc = SetFilePointer(h, 0, NULL, FILE_END);
        if (rc == PHYSFS_INVALID_SET_FILE_POINTER)
        {
            const PHYSFS_ErrorCode err = errcodeFromWinApi();
            CloseHandle(h);
            allocator.Free(retval);
            BAIL_MACRO(err, NULL);
        } /* if */
    } /* if */

    return retval;
} /* __PHYSFS_platformOpenAppend */
예제 #27
0
void CMainWindow::iniConnect()
{
	connect(textEdit, SIGNAL(cursorPositionChanged()), 
		this, SLOT(doCursorChanged()));
	connect(actNew, SIGNAL(triggered()), 
		this, SLOT(doNew()));
	connect(actOpen, SIGNAL(triggered()), 
		this, SLOT(doOpen()));
	connect(actClose, SIGNAL(triggered()), 
		this, SLOT(doClose()));
	connect(actSave, SIGNAL(triggered()), 
		this, SLOT(doSave()));
	connect(actASave, SIGNAL(triggered()), 
		this, SLOT(doASave()));
	connect(actQuit, SIGNAL(triggered()),
		this, SLOT(doQuit()));
	connect(actUndo, SIGNAL(triggered()), 
		this, SLOT(doUndo()));
	connect(actCut, SIGNAL(triggered()), 
		this, SLOT(doCut()));
	connect(actCopy, SIGNAL(triggered()), 
		this, SLOT(doCopy()));
	connect(actPaste, SIGNAL(triggered()), 
		this, SLOT(doPast()));
	connect(actAll, SIGNAL(triggered()), 
		this, SLOT(doAll()));
	connect(actFind, SIGNAL(triggered()), 
		this, SLOT(doFind()));
	connect(textEdit->document(), SIGNAL(contentsChanged()), 
		this, SLOT(doModified()));
	separatorAct = menu_F->insertSeparator(actQuit);
	separatorAct->setVisible(false);
	for (int i = 0; i < MaxRecentFiles; ++i) 
	{
         recentFileActs[i] = new QAction(this);
		 menu_F->insertAction(separatorAct, recentFileActs[i]);
         recentFileActs[i]->setVisible(false);
         connect(recentFileActs[i], SIGNAL(triggered()),
                 this, SLOT(openRecentFile()));
     }	 
	 
	actPrint = menu_T->addAction(tr("打印文档"));
	connect(actPrint, SIGNAL(triggered()), this, SLOT(doPrint()));
}
예제 #28
0
        bool
        Socket::open()
        {
            SocketDesc s;
            if( !doOpen( s ) )
                return false;

            m_handle = boost::shared_ptr< SocketDesc >( new SocketDesc( s ),
                                                        Socket::closeFD );
#if !defined(_WIN32) && !defined(__WIN32__) && !defined(WIN32)
            int err = setCloseOnExec();
            if( err < 0 )
            {
                err = errno;
                close();
                return false;
            }
#endif
            return true;
        }
예제 #29
0
void *__PHYSFS_platformOpenAppend(const char *filename)
{
	void *retval = doOpen(filename, GENERIC_WRITE, OPEN_ALWAYS, 0);
	if (retval != NULL)
	{
		HANDLE h = ((WinApiFile *)retval)->handle;
		//DWORD rc = SetFilePointer(h, 0, NULL, FILE_END);
		const LARGE_INTEGER zero = { 0 };
		DWORD rc = SetFilePointerEx(h, zero, NULL, FILE_END);
		if (rc == PHYSFS_INVALID_SET_FILE_POINTER)
		{
			const char *err = winApiStrError();
			CloseHandle(h);
			allocator.Free(retval);
			BAIL_MACRO(err, NULL);
		} /* if */
	} /* if */

	return retval;

} /* __PHYSFS_platformOpenAppend */
예제 #30
0
void Notepad_plus::fileOpen()
{
	FileDialog fDlg(_pPublicInterface->getHSelf(), _pPublicInterface->getHinst());
	fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);

	setFileOpenSaveDlgFilters(fDlg);

	BufferID lastOpened = BUFFER_INVALID;
	if (stringVector *pfns = fDlg.doOpenMultiFilesDlg())
	{
		size_t sz = pfns->size();
		for (size_t i = 0 ; i < sz ; i++) {
			BufferID test = doOpen(pfns->at(i).c_str(), fDlg.isReadOnly());
			if (test != BUFFER_INVALID)
				lastOpened = test;
		}
	}
	if (lastOpened != BUFFER_INVALID) {
		switchToFile(lastOpened);
	}
}