예제 #1
0
파일: core.cpp 프로젝트: Zereal/leechcraft
	BrowserWidget* Core::NewURL (const QUrl& url, bool raise)
	{
		if (!Initialized_)
			return 0;

		BrowserWidget *widget = new BrowserWidget ();
		widget->InitShortcuts ();
		widget->SetUnclosers (Unclosers_);
		Widgets_.push_back (widget);

		QString tabTitle = "Poshuku";
		if (url.host ().size ())
			tabTitle = url.host ();
		emit addNewTab (tabTitle, widget);

		ConnectSignals (widget);

		if (!url.isEmpty ())
			widget->SetURL (url);

		if (raise)
			emit raiseTab (widget);
		
		emit hookTabAdded (Util::DefaultHookProxy_ptr (new Util::DefaultHookProxy),
				widget,
				widget->getWebView (),
				url);

		return widget;
	}
예제 #2
0
cDockFractal::cDockFractal(QWidget *parent) : QWidget(parent), ui(new Ui::cDockFractal)
{
	ui->setupUi(this);

	fractalTabs = new cTabFractal *[NUMBER_OF_FRACTALS];
	for (int i = 0; i < NUMBER_OF_FRACTALS; i++)
	{
		fractalTabs[i] =
			ui->tabWidget_fractals->findChild<cTabFractal *>(QString("widgetTabFractal_%1").arg(i + 1));
	}

	automatedWidgets = new cAutomatedWidgets(this);
	automatedWidgets->ConnectSignalsForSlidersInWindow(this);

	ui->label_repeat_from->setEnabled(false);
	ui->spinboxInt_repeat_from->setEnabled(false);
	ui->label_fractals_remark_julia->setVisible(false);

	ui->previewwidget_julia->SetSize(256, 256, 2);

	ui->tabWidget_fractals->setUsesScrollButtons(true);
	ui->tabWidget_fractals->setDocumentMode(true);
	ui->tabWidget_fractals->setElideMode(Qt::ElideNone);

	ConnectSignals();
}
예제 #3
0
//------------------------------------------------------------------------------
// Initialize - Initialize and execute the internal state machine of this class.
//------------------------------------------------------------------------------
void DeclarationPhase::Initialize(void)
{
    // Initialize the state machine.
    stateMachine = new QStateMachine();

    // Initialize the states within the state machine.
    elderDeclarations   = new QState(stateMachine);
    elderTrick          = new QState(stateMachine);
    youngerDeclarations = new QState(stateMachine);
    youngerTrick        = new QState(stateMachine);
    finalState          = new QFinalState(stateMachine);

    // Set the initial state for the state machine.
    stateMachine->setInitialState(elderDeclarations);

    // Setup the transitions from the elderDeclarations state.
    elderDeclarations->addTransition(this,
                                     SIGNAL(DeclarationsComplete()),
                                     elderTrick);

    // Setup the transitions from the elderTrick state.
    elderTrick->addTransition(this,
                              SIGNAL(TrickComplete()), youngerDeclarations);

    // Setup the transitions from the elderTrick state.
    youngerDeclarations->addTransition(this,
                                       SIGNAL(DeclarationsComplete()),
                                       youngerTrick);

    // Setup the transitions from the elderTrick state.
    youngerTrick->addTransition(this, SIGNAL(TrickComplete()), finalState);

    // Setup the work done in each state.
    ConnectSignals();
}
예제 #4
0
void InitWidgetProperty(const ConfigFile *configfile)
{
	FuncInfo *funclist = g_load_func;
	WidgetInformation *lib = NULL;
	SpecialInfo *special = NULL;
	if(configfile != NULL){
		special = configfile->special_list;
	}else{
		return;
	}

	while(funclist != NULL){
		ConnectSignals(funclist);
		funclist = funclist->next;
	}
	if(special != NULL){
		lib = widget_table;
		while(lib->widget_name != NULL){
			if(0 == strcmp(lib->widget_name, "dialog")){
				break;
			}
			lib++;
		}
		if(lib->widget_name != NULL){
			while(special != NULL){
				if(special->type == 1){
					lib->ConnectSignal(g_cngplp_xml, g_cngplp_data, (gpointer *)special);
				}
				special = special->next;
			}
		}
	}
}
예제 #5
0
void
PeerConnectionMedia::RollbackIceRestart_s()
{
  ASSERT_ON_THREAD(mSTSThread);

  // hold the restart context so we can disconnect signals
  RefPtr<NrIceCtx> restartCtx = mIceCtxHdlr->ctx();

  // restore old streams since we're rolling back
  for (auto& transportFlow : mTransportFlows) {
    RefPtr<TransportFlow> aFlow = transportFlow.second;
    if (!aFlow) continue;
    TransportLayerIce* ice =
      static_cast<TransportLayerIce*>(aFlow->GetLayer(TransportLayerIce::ID()));
    ice->RestoreOldStream();
  }

  mIceCtxHdlr->RollbackIceRestart();
  ConnectSignals(mIceCtxHdlr->ctx().get(), restartCtx.get());

  // Fixup the telemetry by transferring abandoned ctx stats to current ctx.
  NrIceStats stats = restartCtx->Destroy();
  restartCtx = nullptr;
  mIceCtxHdlr->ctx()->AccumulateStats(stats);
}
예제 #6
0
void CheckBoxObject::Init(const CheckBoxObject &other)
{
    position = other.position;
    fontName = other.fontName;
    obj = sfg::CheckButton::Create(other.obj->GetLabel());
    backgroundColor = new ColorScheme(*(other.backgroundColor));
    borderColor = new ColorScheme(*(other.borderColor));
    textColor = new ColorScheme(*(other.textColor));
    checkColor = new ColorScheme(*(other.checkColor));
    SetChecked(other.IsChecked());
    width = other.width;
    height = other.height;
    fontSize = other.fontSize;
    borderWidth = other.borderWidth;
    padding = other.padding;
    boxSize = other.boxSize;
    checkSignSize = other.checkSignSize;

    obj->SetId(ToString<void*>(this));

    ConnectSignals();
    ResetEventInformations();

    UpdateSize();
    UpdateProperties();
}
예제 #7
0
BrowserWidget* Core::NewURL (const QUrl& url, bool raise,
                             const QList<QPair<QByteArray, QVariant>>& props)
{
    if (!Initialized_)
        return 0;

    BrowserWidget *widget = new BrowserWidget ();
    widget->InitShortcuts ();
    Widgets_.push_back (widget);

    Q_FOREACH (const auto& pair, props)
        widget->setProperty (pair.first, pair.second);

    QString tabTitle = "Poshuku";
    if (url.host ().size ())
        tabTitle = url.host ();
    emit addNewTab (tabTitle, widget);

    ConnectSignals (widget);

    if (!url.isEmpty ())
        widget->SetURL (url);

    if (raise)
        emit raiseTab (widget);

    emit hookTabAdded (Util::DefaultHookProxy_ptr (new Util::DefaultHookProxy),
                       widget,
                       widget->getWebView (),
                       url);

    return widget;
}
예제 #8
0
nsresult PeerConnectionMedia::Init(const std::vector<NrIceStunServer>& stun_servers,
                                   const std::vector<NrIceTurnServer>& turn_servers,
                                   NrIceCtx::Policy policy)
{
  nsresult rv = InitProxy();
  NS_ENSURE_SUCCESS(rv, rv);

#if !defined(MOZILLA_EXTERNAL_LINKAGE)
  bool ice_tcp = Preferences::GetBool("media.peerconnection.ice.tcp", false);
#else
  bool ice_tcp = false;
#endif
  bool default_address_only = GetPrefDefaultAddressOnly();

  // TODO([email protected]): need some way to set not offerer later
  // Looks like a bug in the NrIceCtx API.
  mIceCtxHdlr = NrIceCtxHandler::Create("PC:" + mParentName,
                                        true, // Offerer
                                        mParent->GetAllowIceLoopback(),
                                        ice_tcp,
                                        mParent->GetAllowIceLinkLocal(),
                                        default_address_only,
                                        policy);
  if(!mIceCtxHdlr) {
    CSFLogError(logTag, "%s: Failed to create Ice Context", __FUNCTION__);
    return NS_ERROR_FAILURE;
  }

  if (NS_FAILED(rv = mIceCtxHdlr->ctx()->SetStunServers(stun_servers))) {
    CSFLogError(logTag, "%s: Failed to set stun servers", __FUNCTION__);
    return rv;
  }
  // Give us a way to globally turn off TURN support
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
  bool disabled = Preferences::GetBool("media.peerconnection.turn.disable", false);
#else
  bool disabled = false;
#endif
  if (!disabled) {
    if (NS_FAILED(rv = mIceCtxHdlr->ctx()->SetTurnServers(turn_servers))) {
      CSFLogError(logTag, "%s: Failed to set turn servers", __FUNCTION__);
      return rv;
    }
  } else if (turn_servers.size() != 0) {
    CSFLogError(logTag, "%s: Setting turn servers disabled", __FUNCTION__);
  }
  if (NS_FAILED(rv = mDNSResolver->Init())) {
    CSFLogError(logTag, "%s: Failed to initialize dns resolver", __FUNCTION__);
    return rv;
  }
  if (NS_FAILED(rv =
      mIceCtxHdlr->ctx()->SetResolver(mDNSResolver->AllocateResolver()))) {
    CSFLogError(logTag, "%s: Failed to get dns resolver", __FUNCTION__);
    return rv;
  }
  ConnectSignals(mIceCtxHdlr->ctx().get());

  return NS_OK;
}
예제 #9
0
cDockNavigation::cDockNavigation(QWidget *parent) : QWidget(parent), ui(new Ui::cDockNavigation)
{
	ui->setupUi(this);
	automatedWidgets = new cAutomatedWidgets(this);
	automatedWidgets->ConnectSignalsForSlidersInWindow(this);
	ConnectSignals();
	SetIconSizes();
}
cDockRenderingEngine::cDockRenderingEngine(QWidget *parent)
		: QWidget(parent), ui(new Ui::cDockRenderingEngine)
{
	ui->setupUi(this);
	automatedWidgets = new cAutomatedWidgets(this);
	automatedWidgets->ConnectSignalsForSlidersInWindow(this);
	ConnectSignals();

	ui->groupBox_netrender_client_config->setVisible(false);
}
예제 #11
0
MainWindow::MainWindow() :
    QMainWindow(),
    ui_helper_(new UiHelper(this)),
    template_reader_(new TemplateReader(this))
{
    setupUi(this);
    InitUi();
    ConnectSignals();

    template_reader_->ReadAllTemplates();
}
예제 #12
0
void
PeerConnectionMedia::BeginIceRestart_s(RefPtr<NrIceCtx> new_ctx)
{
  ASSERT_ON_THREAD(mSTSThread);

  // hold the original context so we can disconnect signals if needed
  RefPtr<NrIceCtx> originalCtx = mIceCtxHdlr->ctx();

  if (mIceCtxHdlr->BeginIceRestart(new_ctx)) {
    ConnectSignals(mIceCtxHdlr->ctx().get(), originalCtx.get());
  }
}
예제 #13
0
파일: mainwindow.cpp 프로젝트: IzumiSy/Jed
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    TabIcon = new QIcon(":/new/prefix1/document.gif");

    ConnectSignals();
    ConnectToolbar();

    ui->statusBar->showMessage(tr("Ready."), 5000);
}
예제 #14
0
void ThreadController::startScheduler(QSchedulerConfig *config) {
    if (scheduler_running_)
        return;

    ui_scheduler_ = new UIScheduler;
    scheduler_thread_ = new QThread;
    ConnectSignals();
    scheduler_thread_->start();
    ui_scheduler_->moveToThread(scheduler_thread_);

    emit schedulerProcess(parseConfig(config));
}
예제 #15
0
cDockGamepad::cDockGamepad(QWidget *parent) : QWidget(parent), ui(new Ui::cDockGamepad)
{
	ui->setupUi(this);
	automatedWidgets = new cAutomatedWidgets(this);
	automatedWidgets->ConnectSignalsForSlidersInWindow(this);
	ConnectSignals();

#ifdef USE_GAMEPAD
	QList<int> deviceIds = QGamepadManager::instance()->connectedGamepads();
	if (deviceIds.size() > 0) gamepad.setDeviceId(deviceIds[0]);
	populateGamepadList();
#endif
}
예제 #16
0
nsresult PeerConnectionMedia::Init(const std::vector<NrIceStunServer>& stun_servers,
                                   const std::vector<NrIceTurnServer>& turn_servers,
                                   NrIceCtx::Policy policy)
{
  nsresult rv = InitProxy();
  NS_ENSURE_SUCCESS(rv, rv);

  bool ice_tcp = Preferences::GetBool("media.peerconnection.ice.tcp", false);

  // setup the stun local addresses IPC async call
  InitLocalAddrs();

  // TODO([email protected]): need some way to set not offerer later
  // Looks like a bug in the NrIceCtx API.
  mIceCtxHdlr = NrIceCtxHandler::Create("PC:" + mParentName,
                                        mParent->GetAllowIceLoopback(),
                                        ice_tcp,
                                        mParent->GetAllowIceLinkLocal(),
                                        policy);
  if(!mIceCtxHdlr) {
    CSFLogError(LOGTAG, "%s: Failed to create Ice Context", __FUNCTION__);
    return NS_ERROR_FAILURE;
  }

  if (NS_FAILED(rv = mIceCtxHdlr->ctx()->SetStunServers(stun_servers))) {
    CSFLogError(LOGTAG, "%s: Failed to set stun servers", __FUNCTION__);
    return rv;
  }
  // Give us a way to globally turn off TURN support
  bool disabled = Preferences::GetBool("media.peerconnection.turn.disable", false);
  if (!disabled) {
    if (NS_FAILED(rv = mIceCtxHdlr->ctx()->SetTurnServers(turn_servers))) {
      CSFLogError(LOGTAG, "%s: Failed to set turn servers", __FUNCTION__);
      return rv;
    }
  } else if (!turn_servers.empty()) {
    CSFLogError(LOGTAG, "%s: Setting turn servers disabled", __FUNCTION__);
  }
  if (NS_FAILED(rv = mDNSResolver->Init())) {
    CSFLogError(LOGTAG, "%s: Failed to initialize dns resolver", __FUNCTION__);
    return rv;
  }
  if (NS_FAILED(rv =
      mIceCtxHdlr->ctx()->SetResolver(mDNSResolver->AllocateResolver()))) {
    CSFLogError(LOGTAG, "%s: Failed to get dns resolver", __FUNCTION__);
    return rv;
  }
  ConnectSignals(mIceCtxHdlr->ctx().get());

  return NS_OK;
}
예제 #17
0
PGTATrackView::PGTATrackView(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::PGTATrackView),
    m_treeView(nullptr),
    m_dataWidgetMapper(nullptr),
    m_propertiesView(nullptr)
{
    ui->setupUi(this);
    m_treeView = new PGTATreeView(this);
    m_treeView->header()->hide();
    ui->mainLayout->addWidget(m_treeView);
    SetupAddButtonMenu();
    ConnectSignals();
}
예제 #18
0
	MetaEntry* Core::CreateMetaEntry ()
	{
		const QString& id = QUuid::createUuid ().toString ();
		MetaEntry *result = new MetaEntry (id, Account_);
		ConnectSignals (result);

		if (Entries_.isEmpty ())
			emit accountAdded (Account_);

		Entries_ << result;

		emit gotCLItems ({ result });

		return result;
	}
예제 #19
0
CheckBoxObject::CheckBoxObject(std::string name_) :
Object(name_),
borderWidth(1),
padding(5)
{
    //Create the SFGUI CheckBox object
    obj = sfg::CheckButton::Create("Texte");

    SetString("Case à cocher");

    //Default size of the object
    SetWidth(180);
    SetHeight(24);

    fontSize = 12;

    //Colors "Schemes"
    borderColor = new ColorScheme(sf::Color(146, 147, 151, 255),
                                  sf::Color(146, 147, 151, 255),
                                  sf::Color(146, 147, 151, 255),
                                  sf::Color(173, 173, 173, 255));

    backgroundColor = new ColorScheme(sf::Color(255, 255, 255, 255),
                                      sf::Color(201, 201, 201, 255),
                                      sf::Color(230, 230, 230, 255),
                                      sf::Color(140, 140, 140, 255));

    textColor = new ColorScheme(sf::Color(0, 0, 0, 255),
                                sf::Color(0, 0, 0, 255),
                                sf::Color(0, 0, 0, 255),
                                sf::Color(100, 100, 100, 255));

    checkColor = new ColorScheme(sf::Color(122, 122, 122, 255));

    SetBoxSize(14);
    SetCheckSignSize(6);

    obj->SetPosition( sf::Vector2f( GetX(), GetY() ) );

    obj->SetId(ToString<void*>(this));

    ConnectSignals();
    ResetEventInformations();

    UpdateProperties();
}
예제 #20
0
//------------------------------------------------------------------------------
// Initialize - Initialize and execute the internal state machine of this class.
//------------------------------------------------------------------------------
void ExchangePhase::Initialize(void)
{
    // Initialize the state machine.
    stateMachine = new QStateMachine();

    // Initialize the states within the state machine.
    awaitingSignal  = new QState(stateMachine);
    finalState      = new QFinalState(stateMachine);

    // Set the initial state for the state machine.
    stateMachine->setInitialState(awaitingSignal);

    // Setup the transitions from the awaitingSignal state.
    awaitingSignal->addTransition(this, SIGNAL(ExchangeComplete()), finalState);

    // Setup the work done in each state.
    ConnectSignals();
}
예제 #21
0
CubeMapTextureBrowser::CubeMapTextureBrowser(SceneEditor2* currentScene, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::CubeMapTextureBrowser),
	cubeListItemDelegate(QSize(FACE_IMAGE_SIZE, FACE_IMAGE_SIZE))
{
	scene = currentScene;
	
    ui->setupUi(this);
	ui->loadingWidget->setVisible(false);
	ui->listTextures->setItemDelegate(&cubeListItemDelegate);
	
	ConnectSignals();
	
	FilePath projectPath = CubemapUtils::GetDialogSavedPath("Internal/CubemapLastProjDir",
															ProjectManager::Instance()->CurProjectDataSourcePath().GetAbsolutePathname());
		
	ui->textRootPath->setText(projectPath.GetAbsolutePathname().c_str());
	ReloadTextures(projectPath.GetAbsolutePathname());
	
	UpdateCheckedState();
}
CubeMapTextureBrowser::CubeMapTextureBrowser(SceneEditor2* currentScene, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::CubeMapTextureBrowser),
	cubeListItemDelegate(QSize(FACE_IMAGE_SIZE, FACE_IMAGE_SIZE))
{
	scene = currentScene;
	
    ui->setupUi(this);
	ui->loadingWidget->setVisible(false);
	ui->listTextures->setItemDelegate(&cubeListItemDelegate);
	
	ConnectSignals();
	
	FilePath projectPath = CubemapUtils::GetDialogSavedPath(ResourceEditor::CUBEMAP_LAST_PROJECT_DIR_KEY,
															EditorSettings::Instance()->GetDataSourcePath().GetAbsolutePathname(),
															EditorSettings::Instance()->GetDataSourcePath().GetAbsolutePathname());
		
	ui->textRootPath->setText(projectPath.GetAbsolutePathname().c_str());
	ReloadTextures(projectPath.GetAbsolutePathname());
	
	UpdateCheckedState();
}
예제 #23
0
void
PeerConnectionMedia::RollbackIceRestart_s()
{
  ASSERT_ON_THREAD(mSTSThread);

  // hold the restart context so we can disconnect signals
  RefPtr<NrIceCtx> restartCtx = mIceCtxHdlr->ctx();

  // restore old streams since we're rolling back
  for (auto i = mTransportFlows.begin();
       i != mTransportFlows.end();
       ++i) {
    RefPtr<TransportFlow> aFlow = i->second;
    if (!aFlow) continue;
    TransportLayerIce* ice =
      static_cast<TransportLayerIce*>(aFlow->GetLayer(TransportLayerIce::ID()));
    ice->RestoreOldStream();
  }

  mIceCtxHdlr->RollbackIceRestart();
  ConnectSignals(mIceCtxHdlr->ctx().get(), restartCtx.get());
}
MainWindow::MainWindow(QWidget *parent) :
	QMainWindow(parent),
	ui(new Ui::MainWindow),
	mSizeDialog(new SizeDialogue),
	mSize(1),
	mOperation(nullptr)
{
	ui->setupUi(this);
	setWindowTitle("Image Processing");

	ui->ColorPickerFront->setColor(Qt::black);
	ui->ColorPickerBack->setColor(Qt::white);
	ui->ColorPickerFront->foreground();
	ui->ColorPickerBack->background();

	// Mouse Tracking standardmäßig deaktivieren
	setMouseTracking(false);

	// Erzeuge alle Operationen
	CreateOperations();

	ConnectSignals();
}
예제 #25
0
//------------------------------------------------------------------------------
// Initialize - Initialize this class.
//------------------------------------------------------------------------------
void Player::Initialize(PlayerNum num)
{
    playerNumber = num;

    ConnectSignals();
}
예제 #26
0
int main(void) {
	
	gBlock.set_height(0);
	gClientName = sysinfo::GetClientName();
	gClientID = sysinfo::GetClientID();
	gInstanceID = gClientID * (unsigned)time(0);
	srand(gInstanceID);
	
	std::string frontHost;
	unsigned frontPort;
	
	Configuration* cfg = Configuration::create();
	try{
		cfg->parse("config.txt");
		frontHost = cfg->lookupString("", "server", "localhost");
		frontPort = cfg->lookupInt("", "port", 6666);
		gAddr = cfg->lookupString("", "address", "");
		gClientName = cfg->lookupString("", "name", gClientName.c_str());
	}catch(const ConfigurationException& ex){
		printf("ERROR: %s\n", ex.c_str());
		printf("hit return to exit...\n");
		std::string line;
		std::getline(std::cin, line);
		exit(EXIT_FAILURE);
	}
	
	if(!gClientName.size())
		gClientName = sysinfo::GetClientName();
	
	printf("madPrimeMiner-v%d.%d\n", gClientVersion/10, gClientVersion%10);
	printf("ClientName = '%s'  ClientID = %u  InstanceID = %u\n", gClientName.c_str(), gClientID, gInstanceID);
	printf("Address = '%s'\n", gAddr.c_str());
	
	if(!gAddr.size()){
		printf("ERROR: address not specified in config.txt\n");
		printf("hit return to exit...\n");
		std::string line;
		std::getline(std::cin, line);
		exit(EXIT_FAILURE);
	}
	
	gCtx = zctx_new();
	
	gWorkers = zsocket_new(gCtx, ZMQ_PULL);
	zsocket_bind(gWorkers, "inproc://shares");
	
	gClient = new XPMClient(gCtx);
	gExit = !gClient->Initialize(cfg);
	
	while(!gExit){
		
		printf("Connecting to frontend: %s:%d ...\n", frontHost.c_str(), frontPort);
		
		gBlock.Clear();
		proto::Reply rep;
		gExit = true;
		
		while(gExit){
			
			zsocket_destroy(gCtx, gFrontend);
			gFrontend = zsocket_new(gCtx, ZMQ_DEALER);
			
			int err = zsocket_connect(gFrontend, "tcp://%s:%d", frontHost.c_str(), frontPort);
			if(err){
				printf("ERROR: invalid hostname and/or port.\n");
				exit(EXIT_FAILURE);
			}
			
			proto::Request req;
			req.set_type(proto::Request::CONNECT);
			req.set_reqid(++gNextReqID);
			req.set_version(gClientVersion);
			req.set_height(0);
			
			GetNewReqNonce(req);
			Send(req, gFrontend);
			
			bool ready = zsocket_poll(gFrontend, 3*1000);
			
			if(zctx_interrupted)
				break;
			
			if(!ready)
				continue;
			
			Receive(rep, gFrontend);
			
			if(rep.error() != proto::Reply::NONE){
				printf("ERROR: %s\n", proto::Reply::ErrType_Name(rep.error()).c_str());
				if(rep.has_errstr())
					printf("Message from server: %s\n", rep.errstr().c_str());
			}
			
			if(!rep.has_sinfo())
				break;
			
			gServerInfo = rep.sinfo();
			
			bool ret = false;
			ret |= !ConnectBitcoin();
			ret |= !ConnectSignals();
			if(ret)
				break;
			
			gExit = false;
			
		}
		
		zsocket_disconnect(gFrontend, "tcp://%s:%d", frontHost.c_str(), frontPort);
		
		if(gExit)
			break;
		
		zloop_t* wloop = zloop_new();
		
		zmq_pollitem_t item_server = {gServer, 0, ZMQ_POLLIN, 0};
		int err = zloop_poller(wloop, &item_server, &HandleReply, 0);
		assert(!err);
		
		zmq_pollitem_t item_signals = {gSignals, 0, ZMQ_POLLIN, 0};
		err = zloop_poller(wloop, &item_signals, &HandleSignal, 0);
		assert(!err);
		
		zmq_pollitem_t item_workers = {gWorkers, 0, ZMQ_POLLIN, 0};
		err = zloop_poller(wloop, &item_workers, &HandleWorkers, 0);
		assert(!err);
		
		err = zloop_timer(wloop, 60*1000, 0, &HandleTimer, 0);
		assert(err >= 0);
		
		gHeartBeat = true;
		gExit = true;
		
		if(rep.has_block())
			HandleNewBlock(rep.block());
		else
			RequestWork();
		
		gClient->Toggle();
		zloop_start(wloop);
		
		gClient->Toggle();
		zloop_destroy(&wloop);
		
		zsocket_destroy(gCtx, gServer);
		zsocket_destroy(gCtx, gSignals);
		
		gServer = 0;
		gSignals = 0;
		
	}
	
	delete gClient;
	
	zsocket_destroy(gCtx, gWorkers);
	zsocket_destroy(gCtx, gFrontend);
	zctx_destroy(&gCtx);
	
	return EXIT_SUCCESS;
	
}