Ejemplo n.º 1
0
SnakeLoginDialog::SnakeLoginDialog(QWidget* parent)
 : LoginDialog(parent)
{
    QPixmap ico("/usr/share/app-install/icons/snakenet.png");
    if( !ico.isNull() )
        setIcon(ico);
}
Ejemplo n.º 2
0
ObjectHost::ObjectHost(ObjectHostContext* ctx, Network::IOService *ioServ, const String&options)
 : mContext(ctx)
{
    mScriptPlugins=new PluginManager;
    OptionValue *protocolOptions;
    OptionValue *scriptManagers;
    InitializeClassOptions ico("objecthost",this,
                           protocolOptions=new OptionValue("protocols","",OptionValueType<std::map<std::string,std::string> >(),"passes options into protocol specific libraries like \"tcpsst:{--send-buffer-size=1440 --parallel-sockets=1},udp:{--send-buffer-size=1500}\""),
                           scriptManagers=new OptionValue("scriptManagers","simplecamera:{},js:{}",OptionValueType<std::map<std::string,std::string> >(),"Instantiates script managers with specified options like \"simplecamera:{},js:{--import-paths=/path/to/scripts}\""),
                           NULL);

    OptionSet* oh_options = OptionSet::getOptions("objecthost",this);
    oh_options->parse(options);

    {
        std::map<std::string,std::string> *options=&protocolOptions->as<std::map<std::string,std::string> > ();
        for (std::map<std::string,std::string>::iterator i=options->begin(),ie=options->end();i!=ie;++i) {
            mSpaceConnectionProtocolOptions[i->first]=Network::StreamFactory::getSingleton().getOptionParser(i->first)(i->second);
        }
    }

    {
        std::map<std::string,std::string> *options=&scriptManagers->as<std::map<std::string,std::string> > ();
        for (std::map<std::string,std::string>::iterator i=options->begin(),ie=options->end();i!=ie;++i) {
            if (!ObjectScriptManagerFactory::getSingleton().hasConstructor(i->first)) continue;
            ObjectScriptManager* newmgr = ObjectScriptManagerFactory::getSingleton().getConstructor(i->first)(i->second);
            if (newmgr)
                mScriptManagers[i->first] = newmgr;
        }
    }
}
Ejemplo n.º 3
0
void SlideShowEditor::on_pushButtonAddImages_clicked()
{
    QStringList imageFilePaths = QFileDialog::getOpenFileNames(this,tr("Select Images to Open"),".",
                                                               tr("Images(%1)").arg(getSupportedImageFormats()));
    if(imageFilePaths.count()>0)
    {
        this->setCursor(Qt::WaitCursor);
        int i(0);
        QProgressDialog progress(tr("Adding files..."), tr("Cancel"), 0, imageFilePaths.count(), this);
        ui->listWidgetSlides->setIconSize(QSize(100,100));
        foreach(const QString &file, imageFilePaths)
        {
            ++i;
            progress.setValue(i);

            QPixmap img;
            SlideShowItem sd;
            img.load(file);
            // set display image. If to resize, resize them
            if(mySettings.resize)
            {
                if(img.width()>mySettings.boundWidth || img.height()>mySettings.boundWidth )
                    sd.image = img.scaled(mySettings.boundWidth ,mySettings.boundWidth , Qt::KeepAspectRatio);
                else
                    sd.image = img;
            }
            else
                sd.image = img;

            // set preview image
            if(img.width()>400 || img.height()>400)
                sd.imagePreview = img.scaled(400,400, Qt::KeepAspectRatio);
            else
                sd.imagePreview = img;

            // set list image
            if(img.width()>100 || img.height()>100)
                sd.imageSmall = img.scaled(100,100, Qt::KeepAspectRatio);
            else
                sd.imageSmall = img;

            // set file name
            QFileInfo f(file);
            sd.name = f.fileName();
            sd.path = f.filePath();

            // add to slideshow
            editSS.slides.append(sd);

            // add to slide show list
            QListWidgetItem *itm = new QListWidgetItem;
            QIcon ico(sd.imageSmall);

            itm->setIcon(ico);
            ui->listWidgetSlides->addItem(itm);
        }
Ejemplo n.º 4
0
void SlideShowEditor::reloadSlides()
{
    ui->listWidgetSlides->clear();
    foreach(const SlideShowItem &ssi, editSS.slides)
    {
        QListWidgetItem *itm = new QListWidgetItem;
        QIcon ico(ssi.imageSmall);
        itm->setIcon(ico);
        ui->listWidgetSlides->addItem(itm);
    }
}
Ejemplo n.º 5
0
SaveFilter::SaveFilter(const String& args) {
    Sirikata::InitializeClassOptions ico("save_filter", NULL,
        new OptionValue("filename","",Sirikata::OptionValueType<String>(),"Name of file to save to."),
        new OptionValue("format","colladamodels",Sirikata::OptionValueType<String>(),"Format to save to."),
        NULL);

    OptionSet* optionSet = OptionSet::getOptions("save_filter",NULL);
    optionSet->parse(args);

    mFilename = optionSet->referenceOption("filename")->as<String>();
    mFormat = optionSet->referenceOption("format")->as<String>();
}
Ejemplo n.º 6
0
void DPSInitOptions(OSegScenario *thus) {

    Sirikata::InitializeClassOptions ico("OSegScenario",thus,
        new OptionValue("num-pings-per-second","1000",Sirikata::OptionValueType<double>(),"Number of pings launched per simulation second"),
        new OptionValue("prob-messages-uniform","1",Sirikata::OptionValueType<double>(),"Number of pings launched per simulation second"),
        new OptionValue("num-objects-per-server","1000",Sirikata::OptionValueType<uint32>(),"The number of objects that should be connected before the pinging begins"),
        new OptionValue("ping-size","1024",Sirikata::OptionValueType<uint32>(),"Size of ping payloads.  Doesn't include any other fields in the ping or the object message headers."),
        new OptionValue("flood-server","1",Sirikata::OptionValueType<uint32>(),"The index of the server to flood.  Defaults to 1 so it will work with all layouts. To flood all servers, specify 0."),
        new OptionValue("source-flood-server","false",Sirikata::OptionValueType<bool>(),"This makes the flood server the source of all the packets rather than the destination, so that we can validate that egress routing gets proper fairness."),
        new OptionValue("local","false",Sirikata::OptionValueType<bool>(),"If true, generated traffic will all be local, i.e. will all originate at the flood-server.  Otherwise, it will always originate from other servers."),
        NULL);
}
Ejemplo n.º 7
0
bool ViewWidget::setImg(QImage img)
{
    if (img.width() > 50 && img.height() > 50)
    {
        QSize size(79,110);
        QPixmap pm;
        pm = QPixmap::fromImage(img);
        QIcon ico(pm);
        ui->label_view->setIcon(ico);
        ui->label_view->setIconSize(size);
        return true;
    }
    return false;
}
Ejemplo n.º 8
0
Prox::QueryHandler<SimulationTraits>* QueryHandlerFactory(const String& type, const String& args) {
    static OptionValue* branching = NULL;
    static OptionValue* rebuild_batch_size = NULL;
    if (branching == NULL) {
        branching = new OptionValue("branching", "10", Sirikata::OptionValueType<uint32>(), "Number of children each node should have.");
        rebuild_batch_size = new OptionValue("rebuild-batch-size", "10", Sirikata::OptionValueType<uint32>(), "Number of queries to transition on each iteration when rebuilding. Keep this small to avoid long latencies between updates.");
        Sirikata::InitializeClassOptions ico("query_handler", NULL,
            branching,
            rebuild_batch_size,
            NULL);
    }

    assert(branching != NULL);

    // Since these options end up being shared if you instantiate multiple
    // QueryHandlers, reset them each time.
    branching->unsafeAs<uint32>() = 10;

    OptionSet* optionsSet = OptionSet::getOptions("query_handler", NULL);
    optionsSet->parse(args);

    if (type == "brute") {
        return new Prox::RebuildingQueryHandler<SimulationTraits>(
            Prox::BruteForceQueryHandler<SimulationTraits>::Constructor(), rebuild_batch_size->unsafeAs<uint32>()
        );
    }
    else if (type == "rtree") {
        return new Prox::RebuildingQueryHandler<SimulationTraits>(
            Prox::RTreeAngleQueryHandler<SimulationTraits>::Constructor(branching->unsafeAs<uint32>()), rebuild_batch_size->unsafeAs<uint32>()
        );
    }
    else if (type == "rtreedist" || type == "dist") {
        return new Prox::RebuildingQueryHandler<SimulationTraits>(
            Prox::RTreeDistanceQueryHandler<SimulationTraits>::Constructor(branching->unsafeAs<uint32>()), rebuild_batch_size->unsafeAs<uint32>()
        );
    }
    else if (type == "rtreecut") {
        return new Prox::RebuildingQueryHandler<SimulationTraits>(
            Prox::RTreeCutQueryHandler<SimulationTraits>::Constructor(branching->unsafeAs<uint32>(), false), rebuild_batch_size->unsafeAs<uint32>()
        );
    }
    else if (type == "rtreecutagg") {
        return new Prox::RebuildingQueryHandler<SimulationTraits>(
            Prox::RTreeCutQueryHandler<SimulationTraits>::Constructor(branching->unsafeAs<uint32>(), true), rebuild_batch_size->unsafeAs<uint32>()
        );
    }
    else {
        return NULL;
    }
}
Ejemplo n.º 9
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    setFixedSize(ui->graphicsView->width()+10,ui->graphicsView->height()+25);
    m_file = menuBar()->addMenu("Game");
    m_help = menuBar()->addMenu("Help");
    m_newGame = new QAction(tr("&New Game"),this);
    //m_settings = new QAction(tr("&Settings"),this);
    m_exit = new QAction(tr("E&xit"),this);
    m_about = new QAction(tr("About arkanoid"),this);
    m_newGame->setShortcut(QKeySequence::New);
    m_newGame->setShortcut(QKeySequence::Close);

    QPixmap bgPix(":/img/hexagon_pattern.png");
    bgPix = bgPix.scaled(800,600, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
    m_scene = new QGraphicsScene(0,0,ui->graphicsView->width(),ui->graphicsView->height());
    ui->graphicsView->setScene(m_scene);

    QPixmap blft(":/img/border_left.png");
    QPixmap btop(":/img/border_top.png");
    QPixmap brght(":/img/border_right.png");
    blft = blft.scaled(800,25, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
    btop = btop.scaled(25,600, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
    brght = brght.scaled(800,25, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);

    ui->graphicsView->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
    ui->graphicsView->setBackgroundBrush(bgPix);
    ui->graphicsView->setCacheMode(QGraphicsView::CacheBackground);
    ui->graphicsView->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);

    QIcon ico(tr(":/icon.ico"));
    setWindowIcon(ico);

    connect(m_newGame,SIGNAL(triggered()),this,SLOT(startNewGame()));
    //connect(m_settings,SIGNAL(triggered()),this,SLOT(openSettings()));
    connect(m_exit,SIGNAL(triggered()),this,SLOT(close()));
    connect(m_about,SIGNAL(triggered()),this,SLOT(openAbout()));

    m_file->addAction(m_newGame);
    m_file->addSeparator();
    //m_file->addAction(m_settings);
    //m_file->addSeparator();
    m_file->addAction(m_exit);
    m_help->addAction(m_about);

    setCentralWidget(ui->graphicsView);
}
Ejemplo n.º 10
0
// Create and setup tray icon
void MainWindow::createTrayIcon()
{
    trayIcon = new QSystemTrayIcon;
    QIcon ico("ico/tray.svg");
    trayIcon->setIcon(ico);
    trayIcon->connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(on_tryIconActivated(QSystemTrayIcon::ActivationReason)));

    trayContextMenu = new QMenu(this);
    trayContextMenu->addAction(ui->actionMinimalize);
    trayContextMenu->addAction(ui->actionRestore);
    trayContextMenu->addAction(ui->actionQuit);

    trayIcon->setContextMenu(trayContextMenu);
    trayIcon->show();
}
Ejemplo n.º 11
0
static void InitPluginOptions() {
    Sirikata::InitializeClassOptions ico("cassandrastorage",NULL,
        new Sirikata::OptionValue("host", "localhost", Sirikata::OptionValueType<String>(), "Host name of Cassandra server"),
        new Sirikata::OptionValue("port", "9160", Sirikata::OptionValueType<int32>(), "Port number"),
        NULL);

    Sirikata::InitializeClassOptions icop("cassandrapersistedset",NULL,
        new Sirikata::OptionValue("host", "localhost", Sirikata::OptionValueType<String>(), "Host name of Cassandra server"),
        new Sirikata::OptionValue("port", "9160", Sirikata::OptionValueType<int32>(), "Port number"),
        new Sirikata::OptionValue("ohid", "0", Sirikata::OptionValueType<String>(), "Object Host ID"),
        NULL);

    Sirikata::InitializeClassOptions icof("cassandrafactory",NULL,
        new Sirikata::OptionValue("host", "localhost", Sirikata::OptionValueType<String>(), "Host name of Cassandra server"),
        new Sirikata::OptionValue("port", "9160", Sirikata::OptionValueType<int32>(), "Port number"),
        new Sirikata::OptionValue("ohid", "default", Sirikata::OptionValueType<String>(), "Object Host ID"),
        NULL);
}
Ejemplo n.º 12
0
STDMETHODIMP ShellExt::GetOverlayInfo(LPWSTR pwszIconFile, int cchMax, int* pIndex, DWORD* pdwFlags)
{
    // seaf_ext_log ("GetOverlayInfo called for icon type %d!", (int)status_);

    std::string dll = utils::getThisDllPath();

    std::unique_ptr<wchar_t> ico(utils::stdStringtoWString(dll));
    int wlen = wcslen(ico.get());
    if (wlen + 1 > cchMax)
        return S_FALSE;

    wmemcpy(pwszIconFile, ico.get(), wlen + 1);

    *pdwFlags = ISIOI_ICONFILE | ISIOI_ICONINDEX;

    *pIndex = (int)status_ - 1;

    return S_OK;
}
Ejemplo n.º 13
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    this->setWindowTitle("LIG");
    QIcon ico(":images/LIG.png");
    this->setWindowIcon(ico);
    d = new Daemon();
    item = new mut_GraphicsItem;
    spec_line = new QLineF;
    f = false;
    zoom_a = false;
    z=0;
    QObject::connect(d->to_pileup, SIGNAL(finished(int)), d, SLOT(mut_st()));
    QObject::connect(d->to_anno,SIGNAL(finished(int)), this, SLOT(push_paint()));
    QObject::connect(d->to_pileup, SIGNAL(readyReadStandardOutput()), this, SLOT(newData_received()));
    QObject::connect(d->to_qua, SIGNAL(finished(int)), d, SLOT(anno_st()));
    QObject::connect(ui->graphicsView->horizontalScrollBar(),SIGNAL(valueChanged(int)),this, SLOT(show_place(int)));
}
Ejemplo n.º 14
0
//------------------------------------------------------------------------------
HemiOfNorm::HemiOfNorm(nat32 subdivs)
:norms(0),norm(null<bs::Normal*>()),spacing(Icosphere::SubToAng(subdivs))
{
 Icosphere ico(subdivs);
 for (nat32 i=0;i<ico.Verts();i++)
 {
  if (ico.Vert(i)[2]>=0.0) ++norms;
 }
 
 norm = new bs::Normal[norms];
 norms = 0;
 for (nat32 i=0;i<ico.Verts();i++)
 {
  if (ico.Vert(i)[2]>=0.0)
  {
   norm[norms] = bs::Normal(ico.Vert(i)[0],ico.Vert(i)[1],ico.Vert(i)[2]);
   ++norms;
  }
 }
}
Ejemplo n.º 15
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    
    QString path(QStandardPaths::writableLocation(
                     QStandardPaths::DataLocation));
    qDebug() << path;
    QDir data(path);

    MainWindow w;
    w.addPath(data);
    if (data.exists()) w.loadData();
    else data.mkpath(path);
    
    QIcon ico("://Images/Hesed.ico");
    w.setWindowIcon(ico);
    w.setWindowTitle("Associació Hesed");
    w.showMaximized();
    
    return a.exec();
}
Ejemplo n.º 16
0
void MainWindow::langListSync()
{
    // format systems language
    ui->menuLanguage->clear();

    QDir dir(m_langPath);
    QStringList fileNames = dir.entryList(QStringList("editor_*.qm"));
    for (int i = 0; i < fileNames.size(); ++i)
        {
            // get locale extracted by filename
            QString locale;
            locale = fileNames[i];                  // "TranslationExample_de.qm"
            locale.truncate(locale.lastIndexOf('.'));   // "TranslationExample_de"
            locale.remove(0, locale.indexOf('_') + 1);   // "de"

            QString lang = QLocale::languageToString(QLocale(locale).language());
            QIcon ico(QString("%1/%2.png").arg(m_langPath).arg(locale));

            QAction *action = new QAction(ico, lang, this);
            action->setCheckable(true);
            action->setData(locale);

            WriteToLog(QtDebugMsg, QString("Locale: %1 %2").arg(m_langPath).arg(locale));

            ui->menuLanguage->addAction(action);

            if (GlobalSettings::locale == locale)
            {
                action->setChecked(true);
            }
        }

    if(fileNames.size()==0)
    {
        QAction *action = ui->menuLanguage->addAction("[translations not found]");
        action->setCheckable(false);
        action->setDisabled(true);
    }

}
Ejemplo n.º 17
0
QLoginDlg::QLoginDlg(QWidget *parent)
	:QDialog(parent)
{
	/*对象实例化*/
	
	lblUser=new QLabel(tr("<img src='../p1.png' width=80  height=30/>"),this);
	

	edtUser=new QLineEdit(tr("输入用户名"),this); 	
	btnLogin=new QPushButton(tr("登录"),this);
	/*对象初始化:大小,位置*/
	lblUser->resize(80,30);
	edtUser->resize(150,30);
	btnLogin->resize(100,30);
	
	lblUser->move(20,20);
	edtUser->move(100,20);
	btnLogin->move(30,120);
	
	this->resize(270,180);
	this->move((1024-270)/2,(768-180)/2);
	QCursor cur(Qt::CrossCursor);
	this->setCursor(cur);
	
	QCursor cur2(Qt::UpArrowCursor);
	btnLogin->setCursor(cur2);
	
	this->setToolTip(tr("<s>我是提示</s>"));
	btnLogin->setToolTip(tr("我是登录"));
	
	QIcon ico("../p1.png");
	this->setWindowIcon(ico);
	/*
	QFont font(tr("文鼎PL中楷Uni"),20,100,true);
	lblUser->setFont(font);
	*/
	this->setWindowTitle(tr("BOSS-登录界面"));
	this->setVisible(true);
	
}
Ejemplo n.º 18
0
void EventPlugin::onInstalled()
{
	qff::MainWindow *fwk = qff::MainWindow::frameWork();

	m_actConnectDb = new qfw::Action(tr("&Connect to database"));
	//a->setShortcut("ctrl+L");
	connect(m_actConnectDb, SIGNAL(triggered()), this, SLOT(connectToSqlServer()));

	m_actOpenEvent = new qfw::Action(tr("&Open event"));
	//m_actOpenEvent->setShortcut("Ctrl+O");
	m_actOpenEvent->setEnabled(false);
	connect(m_actOpenEvent, SIGNAL(triggered()), this, SLOT(openEvent()));

	m_actCreateEvent = new qfw::Action(tr("Create eve&nt"));
	//m_actCreateEvent->setShortcut("Ctrl+N");
	m_actCreateEvent->setEnabled(false);
	connect(m_actCreateEvent, SIGNAL(triggered()), this, SLOT(createEvent()));

	m_actEditEvent = new qfw::Action(tr("E&dit event"));
	m_actEditEvent->setEnabled(false);
	connect(m_actEditEvent, SIGNAL(triggered()), this, SLOT(editEvent()));
	connect(this, &EventPlugin::eventNameChanged, [this](const QString &event_name) {
		this->m_actEditEvent->setEnabled(!event_name.isEmpty());
	});

	m_actExportEvent = new qfw::Action(tr("E&xport event"));
	m_actExportEvent->setEnabled(false);
	connect(m_actExportEvent, &QAction::triggered, this, &EventPlugin::exportEvent);

	m_actImportEvent = new qfw::Action(tr("I&mport event"));
	m_actImportEvent->setEnabled(false);
	connect(m_actImportEvent, &QAction::triggered, this, &EventPlugin::importEvent_qbe);

	connect(this, SIGNAL(eventNameChanged(QString)), fwk->statusBar(), SLOT(setEventName(QString)));
	connect(this, SIGNAL(currentStageIdChanged(int)), fwk->statusBar(), SLOT(setStageNo(int)));
	connect(fwk, &qff::MainWindow::pluginsLoaded, this, &EventPlugin::connectToSqlServer);
	connect(this, &EventPlugin::eventOpened, this, &EventPlugin::onEventOpened);

	qfw::Action *a_quit = fwk->menuBar()->actionForPath("file/import", false);
	a_quit->addActionBefore(m_actConnectDb);
	a_quit->addSeparatorBefore();

	m_actEvent = m_actConnectDb->addMenuAfter("file.event", tr("&Event"));

	m_actEvent->addActionInto(m_actCreateEvent);
	m_actEvent->addActionInto(m_actOpenEvent);
	m_actEvent->addActionInto(m_actEditEvent);
	m_actEvent->addActionInto(m_actExportEvent);
	m_actEvent->addActionInto(m_actImportEvent);

	qfw::ToolBar *tb = fwk->toolBar("Event", true);
	tb->setObjectName("EventToolbar");
	{
		QToolButton *bt_stage = new QToolButton();
		//bt_stage->setFlat(true);
		bt_stage->setAutoRaise(true);
		bt_stage->setCheckable(true);
		tb->addWidget(bt_stage);
		m_cbxStage = new QComboBox();
		connect(m_cbxStage, SIGNAL(activated(int)), this, SLOT(onCbxStageActivated(int)));
		connect(this, &EventPlugin::currentStageIdChanged, [bt_stage](int stage_id) {
			bt_stage->setText(tr("Current stage E%1").arg(stage_id));
		});
		QAction *act_stage = tb->addWidget(m_cbxStage);
		act_stage->setVisible(false);


		auto *style = qf::qmlwidgets::Style::instance();
		QIcon ico(style->icon("settings"));
		m_actEditStage = new qfw::Action(ico, "Stage settings");
		m_actEditStage->setVisible(false);
		connect(m_actEditStage, SIGNAL(triggered()), this, SLOT(editStage()));
		tb->addAction(m_actEditStage);

		connect(bt_stage, &QPushButton::clicked, [this, act_stage](bool checked) {
			act_stage->setVisible(checked);
			m_actEditStage->setVisible(checked);
		});
	}
}
Ejemplo n.º 19
0
static void InitPluginOptions() {
    Sirikata::InitializeClassOptions ico("space_local", NULL,
        NULL);
}
Ejemplo n.º 20
0
BaseWindow::BaseWindow(QWidget *parent)
    : QWidget(parent), ui(new Ui::BaseWindow)
{
    this->setAttribute(Qt::WA_QuitOnClose, false);
    serverCounter = 1;
    ui->setupUi(this);

    QApplication *app = (QApplication*)QApplication::instance();
    this->setWindowTitle(QString("%1 %2 (v%3)").arg(app->organizationName(), app->applicationName(), app->applicationVersion()));

    // Icon
    QIcon ico(":resources/RKnock.ico");
    this->setWindowIcon(ico);

    // Find the config file, does it exist?
#ifdef Q_WS_WIN
    QString fSection;
    QString mSection;
    QString lSection = "Settings.xml";

    if (QSysInfo::windowsVersion() < QSysInfo::WV_2000)
    {
        // All Versions before win2000
        fSection = QDir::currentPath(); // Where we are :)
        mSection = "";
    }
    else if (QSysInfo::windowsVersion() < QSysInfo::WV_VISTA)
    {
        fSection = QDir::homePath();
        mSection = QString("Application Data/%1/%2").arg(app->organizationName(), app->applicationName());
    }
    else
    {
        fSection = QDir::homePath();
        mSection = QString("AppData/Roaming/%1/%2").arg(app->organizationName(), app->applicationName());
    }

    if (mSection.size() == 0)
        this->cfgFileLocation = QString("%1/%2").arg(fSection, lSection);
    else
        this->cfgFileLocation = QString("%1/%2/%3").arg(fSection, mSection, lSection);

    //this->cfgFileLocation = QtDir::homePath().append("\\").append("
#else
    QString path = QString("%1/.%2/%3").arg(QDir::homePath(), app->organizationName(), app->applicationName());
    QString file = QString("%1/Settings.xml").arg(path);

    this->cfgFileLocation = file;
#endif

    if (QFile(this->cfgFileLocation).exists())
        this->loadSettings();

    this->tray = new QSystemTrayIcon(this);
    this->trayMenu = new QMenu(this);
    this->trayServersMenu = new QMenu("Servers", this->trayMenu);

    this->tray->setContextMenu(this->trayMenu);
    this->tray->setIcon(ico);
    this->tray->setVisible(true);

    QAction *subaction = 0;
    QMenu *submenu = 0;

    // Open Dialog
    subaction = this->trayMenu->addAction("Open Configuration Dialog...");
    connect(subaction, SIGNAL(triggered()), this, SLOT(show()));

    subaction = this->trayMenu->addAction("About RKnock...");
    connect(subaction, SIGNAL(triggered()), this, SLOT(showAbout()));

    this->trayMenu->addMenu(trayServersMenu);

    this->trayMenu->addSeparator();
    subaction = this->trayMenu->addAction("Exit...");
    connect(subaction, SIGNAL(triggered()), app, SLOT(quit()));

    connect(tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(activateMenu(QSystemTrayIcon::ActivationReason)));

    this->rebuildActions();
}
void InitAlwaysLocationUpdatePolicyOptions() {
    Sirikata::InitializeClassOptions ico(ALWAYS_POLICY_OPTIONS, NULL,
                                         new OptionValue(LOC_MAX_PER_RESULT, "5", Sirikata::OptionValueType<uint32>(), "Maximum number of loc updates to report in each result message."),
                                         NULL);
}
Ejemplo n.º 22
0
ObjectHost::ObjectHost(ObjectHostContext* ctx, Network::IOService *ioServ, const String&options)
 : mContext(ctx),
   mStorage(NULL),
   mPersistentSet(NULL),
   mQueryProcessor(NULL),
   mActiveHostedObjects(0)
{
    mContext->objectHost = this;
    OptionValue *protocolOptions;
    OptionValue *scriptManagers;
    OptionValue *simOptions;
    InitializeClassOptions ico("objecthost",this,
                           protocolOptions=new OptionValue("protocols","",OptionValueType<std::map<std::string,std::string> >(),"passes options into protocol specific libraries like \"tcpsst:{--send-buffer-size=1440 --parallel-sockets=1},udp:{--send-buffer-size=1500}\""),
                           scriptManagers=new OptionValue("scriptManagers","simplecamera:{},js:{}",OptionValueType<std::map<std::string,std::string> >(),"Instantiates script managers with specified options like \"simplecamera:{},js:{--import-paths=/path/to/scripts}\""),
                           simOptions=new OptionValue("simOptions","ogregraphics:{}",OptionValueType<std::map<std::string,std::string> >(),"Passes initialization strings to simulations, by name"),

                           NULL);

    OptionSet* oh_options = OptionSet::getOptions("objecthost",this);
    oh_options->parse(options);
    mSimOptions=simOptions->as<std::map<std::string,std::string> > ();
    {
        std::map<std::string,std::string> *options=&protocolOptions->as<std::map<std::string,std::string> > ();
        for (std::map<std::string,std::string>::iterator i=options->begin(),ie=options->end();i!=ie;++i) {
            mSpaceConnectionProtocolOptions[i->first]=Network::StreamFactory::getSingleton().getOptionParser(i->first)(i->second);
        }
    }

    {
        std::map<std::string,std::string> *options=&scriptManagers->as<std::map<std::string,std::string> > ();
        for (std::map<std::string,std::string>::iterator i=options->begin(),ie=options->end();i!=ie;++i) {
            if (!ObjectScriptManagerFactory::getSingleton().hasConstructor(i->first)) continue;
            ObjectScriptManager* newmgr = ObjectScriptManagerFactory::getSingleton().getConstructor(i->first)(mContext, i->second);
            if (newmgr)
                mScriptManagers[i->first] = newmgr;
        }
    }

    if (mContext->commander() != NULL) {
        mContext->commander()->registerCommand(
            "oh.objects.list",
            mContext->mainStrand->wrap(std::tr1::bind(&ObjectHost::commandListObjects, this, _1, _2, _3))
        );
        mContext->commander()->registerCommand(
            "oh.objects.create",
            mContext->mainStrand->wrap(std::tr1::bind(&ObjectHost::commandCreateObject, this, _1, _2, _3))
        );
        mContext->commander()->registerCommand(
            "oh.objects.destroy",
            mContext->mainStrand->wrap(std::tr1::bind(&ObjectHost::commandDestroyObject, this, _1, _2, _3))
        );

        // To register only one copy of the command, we register HO commands
        // here and dispatch them to the appropriate HO.
        mContext->commander()->registerCommand(
            "oh.objects.presences",
            mContext->mainStrand->wrap(std::tr1::bind(&ObjectHost::commandObjectPresences, this, _1, _2, _3))
        );

    }

    mTransferMediator = &(Transfer::TransferMediator::getSingleton());
    mTransferPool = mTransferMediator->registerClient<Transfer::AggregatedTransferPool>("ObjectHost");
}
Ejemplo n.º 23
0
static void InitPluginOptions() {
    Sirikata::InitializeClassOptions ico("space_environment", NULL,
        NULL);
}
Ejemplo n.º 24
0
int main()
{
  //load ensemble list path and data path
  FILE *an_input_file=open_file("analysis_pars","r");
  int mode;
  char ens_list_path[1024],base_MZ_path[1024],obs_name[1024],meson_name[1024];
  read_formatted_from_file_expecting(ens_list_path,an_input_file,"%s","ens_list_path");
  read_formatted_from_file_expecting(base_MZ_path,an_input_file,"%s","base_MZ_path");
  read_formatted_from_file_expecting((char*)&mode,an_input_file,"%d","mode");
  read_formatted_from_file_expecting(obs_name,an_input_file,"%s","obs_name");
  read_formatted_from_file_expecting(meson_name,an_input_file,"%s","meson_name");
  fclose(an_input_file);
  
  //load ensembles list and parameters
  char **base_corrs_path,**ens_name;
  int nens,*T,*ibeta,*iml_un,*nlights,*nmass;
  double **mass;
  load_ensembles_list(base_corrs_path,ens_name,nens,T,ibeta,nmass,mass,iml_un,nlights,ens_list_path);
  
  //load all ensembles data
  bvec *aM,*Z;
  load_all_ensembles_MZ(aM,Z,nens,T,ibeta,nlights,nmass,base_MZ_path,obs_name,ens_name,base_corrs_path,mode);
  init_latpars();
  
  //prepare the list of mass
  int nh=nmass[2]-nlights[2];
  bvec mh(nh,nboot,njack);
  for(int ih=0;ih<nh;ih++)
    {
      mh[ih]=mass[1][ih+nlights[1]]/lat[1]/Zp[1];
      //cout<<ih<<" "<<mh[ih]<<endl;
    }
  
  bvec M[nens],f[nens],ratio(nens,nboot,njack);

  cout<<mass[2][0]<<endl;
  cout<<mass[2][2]<<endl;
  cout<<mass[2][nlights[2]+1]<<endl;
  
  for(int iens=0;iens<nens;iens++)
    {
      int b=ibeta[iens];
      M[iens]=aM[iens]/lat[b];
      f[iens]=sqrt(Z[iens])/(aM[iens]*sinh(aM[iens]))/lat[b];
      for(int il=0;il<nlights[iens];il++)
	for(int ih=0;ih<nmass[iens];ih++)
	  {
	    int ic=il*nmass[iens]+ih;
	    f[iens].data[ic]*=mass[iens][il]+mass[iens][ih];
	  }
      boot fPi=f[iens].data[ico(0,0,nmass[iens])];
      boot fK=f[iens].data[ico(2,0,nmass[iens])];
      f[iens]*=sqrt(M[iens]);
      
      boot fD=f[iens].data[ico(0,nlights[iens]+1,nmass[iens])]; 
      boot fDs=f[iens].data[ico(2,nlights[iens]+1,nmass[iens])]; 
      
      boot ratio_D=fDs/fD/sqrt(19685.0/18696);
      boot ratio_L=fK/fPi;
      
      //ratio[iens]=ratio_D/ratio_L;
      ratio[iens]=ratio_L;
      
      cout<<iens<<" "<<ratio[iens]<<endl;
    } 
  
  ratio.write_to_binfile("ratio");
  
  return 0;
}