コード例 #1
0
ファイル: mainwindow.cpp プロジェクト: qtneko/qt-cat
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    QWidget *main = new QWidget;
    setCentralWidget(main);

    QVBoxLayout *main_layout = new QVBoxLayout;
    main->setLayout(main_layout);

    QHBoxLayout *btn_layout = new QHBoxLayout;
    main_layout->addLayout(btn_layout);

    QPushButton *load = new QPushButton;
    load->setText("&Load");
    connect(load, SIGNAL(clicked()), this, SLOT(on_load()));
    btn_layout->addWidget(load);

    QPushButton *save = new QPushButton;
    save->setText("&Save");
    connect(save, SIGNAL(clicked()), this, SLOT(on_save()));
    btn_layout->addWidget(save);

    text = new QTextEdit;
    text->setText("Type some text here");
    main_layout->addWidget(text);


}
コード例 #2
0
ファイル: ApplicationBase.cpp プロジェクト: fast01/winner
	/** self **/
	void ApplicationBase::run(const int argc, const char** argv){
		OPH();
		// on load
		if(!on_load(argc, argv)){
			ERROR("Core load failed");
			return;
		}

		// run
		ProcessLocal* process =ProcessLocal::Instance();
		while(process->update());

		// on unload
		on_unload();
	}
コード例 #3
0
pkg_plugin_set *_pkg_plugin_load_library(const char *pkg_type,
					 const char *library_path)
{
	void *library_handle = NULL;
	int i = 0;

	/* _pkg_plugin_on_load onload = NULL; */
	bool(*on_load) (pkg_plugin_set *plugin);

	if (library_path == NULL) {
		_LOGE("pkg library path = [%s] \n", library_path);
		return NULL;
	}

	if ((library_handle = dlopen(library_path, RTLD_LAZY)) == NULL) {
		_LOGE("dlopen is failed library_path[%s]\n", library_path);
		return NULL;
	}

	if ((on_load = dlsym(library_handle, "pkg_plugin_on_load")) == NULL || 
	    dlerror() != NULL) {
		_LOGE("can not find symbol \n");
		dlclose(library_handle);
		return NULL;
	}

	for (i = 0; plugin_set_list[i]; i++) {
		if (strcmp(plugin_set_list[i]->pkg_type, pkg_type) == 0) {
			_LOGD("already loaded [%s] is done well \n",
			      library_path);
			goto END;
		}
	}

	plugin_set_list[i] = (pkg_plugin_set *) malloc(sizeof(pkg_plugin_set));
	if (plugin_set_list[i] == NULL) {
		_LOGE("malloc of the plugin_set_list element is failed \n");
		dlclose(library_handle);
		return NULL;
	}

	memset(plugin_set_list[i], 0x0, sizeof(pkg_plugin_set));

	if (on_load(plugin_set_list[i]) != 0) {
		_LOGE("on_load is failed \n");

		dlclose(library_handle);

		free(plugin_set_list[i]);
		plugin_set_list[i] = NULL;

		return NULL;
	}

	plugin_set_list[i]->plugin_handle = library_handle;
	strncpy(plugin_set_list[i]->pkg_type, pkg_type,
		PKG_TYPE_STRING_LEN_MAX - 1);

	_LOGD("load library [%s] is done well \n", library_path);

 END:
	return plugin_set_list[i];

}