Esempio n. 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()));
}
Esempio n. 2
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;
}
Esempio n. 3
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()));
}
Esempio n. 4
0
void MainWindow::on_action_N_triggered()  //新建菜单
{
   doNew();
}
Esempio n. 5
0
int main(int argc, char **argv) {
	char *optstring = "c:t:b:";
	int copt;
	char bnlspecified = 0;
	int r;
	char *rptr;
	newtimestamp = time(NULL);
	argv0 = argv[0];
	if(argc < 2) {
		printUsage(argv[0]);
		return 1;
	}
	for(;;) {
		copt = getopt(argc, argv, optstring);
		if(copt == -1) break;
		if(copt == '?') {
			fprintf(stderr, "Invalid option.");
			return 1;
		}
		switch(copt) {
			case 'c':
				strcpy(configfile_dir, optarg);
				break;
			case 't':
				newtimestamp = atoi(optarg);
				break;
			case 'b':
				strcpy(bnl_filename, optarg);
				bnlspecified = 1;
				break;
		}
	}
	// Get orig directory
	rptr = getcwd(configfile_origdir, CONFIGFILE_FILENAME_LEN);
	// cd to the new directory
	r = chdir(configfile_dir);
	if(r != 0) {
		fprintf(stderr, "Error changing to configfile dir");
		return 1;
	}
	// Load config file
	if(configfile_load() != CONFIGFILE_OK) { fprintf(stderr, "Error loading config file.\n"); return 1; }
	// Load SSL error strings
	SSL_load_error_strings();
	// Initialize signatures
	if(sig_init() != SIG_OK) { fprintf(stderr, "Error initializing signatures.\n"); return 1; }
	// Command
	if(argc - optind < 1) {
		printUsage(argv[0]);
		return 1;
	}
	if(bnlspecified) r = chdir(configfile_origdir);
	if(strcmp(argv[optind], "print") == 0) {
		if(argc - optind != 1) {
			printUsage(argv[0]);
			return 1;
		}
		return doPrintBNL();
	}
	if(strcmp(argv[optind], "new") == 0) {
		if(argc - optind != 1) {
			printUsage(argv[0]);
			return 1;
		}
		return doNew(newtimestamp);
	}
	if(strcmp(argv[optind], "add") == 0) {
		return doAdd(argc - optind - 1, &argv[optind + 1], newtimestamp);
	}
	if(strcmp(argv[optind], "modify") == 0) {
		return doModify(argc - optind - 1, &argv[optind + 1], newtimestamp);
	}
	if(strcmp(argv[optind], "remove") == 0) {
		if(argc - optind != 2) {
			printUsage(argv[0]);
			return 1;
		}
		return doRemove(argv[optind + 1], newtimestamp);
	}
	if(strcmp(argv[optind], "addsubnet") == 0) {
		if(argc - optind != 3) {
			printUsage(argv[0]);
			return 1;
		}
		return doAddSubnet(argv[optind + 1], argv[optind + 2], newtimestamp);
	}
	if(strcmp(argv[optind], "delsubnet") == 0) {
		if(argc - optind != 3) {
			printUsage(argv[0]);
			return 1;
		}
		return doDelSubnet(argv[optind + 1], argv[optind + 2], newtimestamp);
	}
	printUsage(argv[0]);
	return 1;
}