コード例 #1
0
ファイル: server.cpp プロジェクト: iToto/OPIM
opimServer::opimServer( void ) : _online( false )
{
	_db = new Database( _dbMutex, "opim.db", &_dbLog );
	_dt = new delegateThread( this );

	setupDB();
}
コード例 #2
0
void SeedSearcherMain::CmdLineParameters::setup (const Str& seq, const Str& wgt)
{
   this->_seqFilename = seq;
   this->_wgtFilename = wgt;

   //
   //
   _prepType = _parser.__prep;
   _useSpecialization = _parser.__proj_spec;
   _useReverse = _parser.__count_reverse;


   //
   //
   setupParameters ();

   //
   //
   setupLangauge ();

   //
   // create random projections
   setupProjections ();

   //
   // setup the db
   setupDB ();

   //
   // create the weight function
   setupWeightFunction ();

   //
   // create the preprocessor
   setupPreprocessor ();

   //
   // create the hyper-geometric scoring scheme
   setupScoreFunc ();

   //
   // keep only the best features
   // TODO: what should we do when _parser.__seed_r
   // is too large for the length of seed?
   setupFeatureContainer ();

   //
   // TODO: HACK HERE!!!
   (boost::polymorphic_downcast<ACGTLangauge*> (_langauge.get ()))->includeN (false);
}
コード例 #3
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    pDetectorProgress = NULL;
    mLogAllXmlRpcOutput = false;
    mDbUpdated = false;
    // mSyncRequests tracks how many sync requests have been made
    // in order to know when to re-enable the widgets
    mSyncRequests = 0;
    // mSyncPosition is used to iterate through the backend list,
    // so we only sync one repository at a time, rather than flinging
    // requests at all of them at once.
    mSyncPosition = 0;
    mUploading = false;
    QSettings settings("Entomologist");

    pManager = new QNetworkAccessManager();
    connect(pManager, SIGNAL(sslErrors(QNetworkReply *, const QList<QSslError> &)),
            this, SLOT(handleSslErrors(QNetworkReply *, const QList<QSslError> &)));

    ui->setupUi(this);

    QToolBar *toolBar = new QToolBar("Main Toolbar");
    toolBar->setObjectName("Main ToolBar");
    toolBar->setIconSize(QSize(32,32));
    refreshButton = toolBar->addAction(style()->standardIcon(QStyle::SP_BrowserReload), "");
    refreshButton->setToolTip("Resync all trackers");
    uploadButton = toolBar->addAction(style()->standardIcon(QStyle::SP_ArrowUp), "");
    uploadButton->setToolTip("Upload changes");
    changelogButton = toolBar->addAction(style()->standardIcon(QStyle::SP_FileDialogInfoView), "");
    changelogButton->setToolTip("Show changelog");
    toolBar->setMovable(false);
    addToolBar(Qt::TopToolBarArea, toolBar);


    setupTrayIcon();
    // Setup the "Show" menu and "Work Offline"
    ui->actionMy_Bugs->setChecked(settings.value("show-my-bugs", true).toBool());
    ui->actionMy_Reports->setChecked(settings.value("show-my-reports", true).toBool());
    ui->actionMy_CCs->setChecked(settings.value("show-my-ccs", true).toBool());
    ui->actionMonitored_Components->setChecked(settings.value("show-my-monitored", true).toBool());
    ui->action_Work_Offline->setChecked(settings.value("work-offline", false).toBool());

    // Set the default network status
    pStatusIcon = new QLabel();
    pStatusIcon->setPixmap(QPixmap(":/online"));
    pStatusMessage = new QLabel("");
    ui->statusBar->addPermanentWidget(pStatusMessage);
    ui->statusBar->addPermanentWidget(pStatusIcon);

    // We use a spinner animation to show that we're doing things
    pSpinnerMovie = new QMovie(this);
    pSpinnerMovie->setFileName(":/spinner");
    pSpinnerMovie->setScaledSize(QSize(48,48));
    ui->spinnerLabel->setMovie(pSpinnerMovie);
    ui->spinnerLabel->hide();
    ui->syncingLabel->hide();

    // Set up the resync timer
    pUpdateTimer = new QTimer(this);
    connect(pUpdateTimer, SIGNAL(timeout()),
            this, SLOT(resync()));
    setTimer();

    // Keyboard shortcuts for search bar focus / upload changes.
    QShortcut* searchFocus;
    QShortcut* uploadChange;
    QShortcut *logXmlRpc;

    searchFocus = new QShortcut(QKeySequence(Qt::META + Qt::Key_Space),this);
    searchFocus->setContext(Qt::ApplicationShortcut);
    connect(searchFocus,SIGNAL(activated()),this,SLOT(searchFocusTriggered()));

    uploadChange = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_S),this);
    uploadChange->setContext(Qt::ApplicationShortcut);
    connect(uploadChange,SIGNAL(activated()),this,SLOT(upload()));

    logXmlRpc = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_0), this);
    logXmlRpc->setContext(Qt::ApplicationShortcut);
    connect(logXmlRpc, SIGNAL(activated()), this, SLOT(toggleXmlRpcLogging()));

    // Menu actions
    connect(ui->action_Add_Tracker, SIGNAL(triggered()),
            this, SLOT(addTrackerTriggered()));
    connect(ui->action_Refresh_Tracker,SIGNAL(triggered()),
            this, SLOT(resync()));
    connect(ui->actionShow_ToDo_List, SIGNAL(triggered()),
            this, SLOT(showTodoList()));
    connect(ui->action_About, SIGNAL(triggered()),
            this, SLOT(aboutTriggered()));
    connect(ui->action_Web_Site, SIGNAL(triggered()),
            this, SLOT(websiteTriggered()));
    connect(ui->action_Preferences, SIGNAL(triggered()),
            this, SLOT(prefsTriggered()));
    connect(ui->action_Quit, SIGNAL(triggered()),
            this, SLOT(quitEvent()));
    connect(ui->actionMy_Bugs, SIGNAL(triggered()),
            this, SLOT(showActionTriggered()));
    connect(ui->actionMy_CCs, SIGNAL(triggered()),
            this, SLOT(showActionTriggered()));
    connect(ui->actionMy_Reports, SIGNAL(triggered()),
            this, SLOT(showActionTriggered()));
    connect(ui->actionMonitored_Components, SIGNAL(triggered()),
            this, SLOT(showActionTriggered()));
    connect(ui->actionEdit_Monitored_Components, SIGNAL(triggered()),
            this, SLOT(showEditMonitoredComponents()));
    connect(ui->action_Work_Offline, SIGNAL(triggered()),
            this, SLOT(workOfflineTriggered()));

    // Set up the search button
    connect(changelogButton, SIGNAL(triggered()),
            this, SLOT(changelogTriggered()));

    connect(ui->trackerTab, SIGNAL(showMenu(int)),
            this, SLOT(showMenu(int)));
    ui->trackerTab->removeTab(0);
    ui->trackerTab->removeTab(0);

    // And finally set up the various other widgets
    connect(refreshButton, SIGNAL(triggered()),
            this, SLOT(resync()));
    connect(uploadButton, SIGNAL(triggered()),
            this, SLOT(upload()));
    restoreGeometry(settings.value("window-geometry").toByteArray());
    // Set the network status bar and check for updates if possible
    if (isOnline())
        if (settings.value("update-check", true).toBool() == true)
            checkForUpdates();

    setupDB();
    toggleButtons();

    // Now we need the todo list widget
    pToDoDock = new QDockWidget(tr("ToDo List"), this);
    pToDoDock->setObjectName("ToDoDock");
    pToDoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    pToDoListWidget = new ToDoListWidget(pToDoDock);
    pToDoDock->setWidget(pToDoListWidget);
    addDockWidget(Qt::LeftDockWidgetArea, pToDoDock);
    pToDoDock->hide();
    restoreState(settings.value("entomologist-state").toByteArray());
    connect(pToDoDock, SIGNAL(visibilityChanged(bool)),
            this, SLOT(dockVisibilityChanged(bool)));
    if (pToDoDock->isVisible())
        ui->actionShow_ToDo_List->setText("Hide ToDo List");
    else
        ui->actionShow_ToDo_List->setText("Show ToDo List");

    pSearchTab = new SearchTab(this);
    connect(pSearchTab, SIGNAL(openSearchedBug(QString,QString)),
            this, SLOT(openSearchedBug(QString,QString)));

    loadTrackers();
    ui->trackerTab->addTab(pSearchTab, QIcon(":/search"), "Search");

    if ((settings.value("startup-sync", false).toBool() == true)
       || (mDbUpdated))
        syncNextTracker();
}
コード例 #4
0
int main(int argc, char *argv[])
{
    //It cannot properly fall back to Qt Widgets versions of the dialogs if
    // we use a QGuiApplication, which only supports QML stuff.
    //QGuiApplication app(argc, argv);
    QApplication app(argc, argv);

    //This is for the QSettings defaults from things like the qt file dialog and stuff...
    app.setApplicationName("Filmulator");
    app.setOrganizationName("Filmulator");

    QFont sansFont("Sans Serif",9);
    app.setFont(sansFont);
    QQmlApplicationEngine engine;

    QTranslator translator;
    translator.load("filmulatortr_la");
    app.installTranslator(&translator);

    //Prepare database connection.
    //This should create a new db file if there was none.
    QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
    setupDB(&db);

    //Create the object for communicating between SQL classes.
    SignalSwitchboard *switchboard = new SignalSwitchboard;

    //Create a settings object for persistent settings.
    Settings *settingsObj = new Settings;
    engine.rootContext()->setContextProperty("settings", settingsObj);

    //Prepare an object for managing the processing parameters.
    ParameterManager *paramManager = new ParameterManager;
    engine.rootContext()->setContextProperty("paramManager",paramManager);
    QObject::connect(paramManager, SIGNAL(updateTableOut(QString, int)),
                     switchboard, SLOT(updateTableIn(QString, int)));

    //Prepare an image provider object.
    FilmImageProvider *filmProvider = new FilmImageProvider(paramManager);
    //Connect it as an image provider so that qml can get the photos
    engine.addImageProvider(QLatin1String("filmy"), filmProvider);
    //Connect it as a Q_OBJECT so that qml can run methods
    engine.rootContext()->setContextProperty("filmProvider",filmProvider);

    qRegisterMetaType<QFileInfo>();

    //Prepare a model for importing.
    ImportModel *importModel = new ImportModel;
    engine.rootContext()->setContextProperty("importModel", importModel);

    //Prepare a model for the organize view.
    OrganizeModel *organizeModel = new OrganizeModel;
    engine.rootContext()->setContextProperty("organizeModel", organizeModel);
    engine.rootContext()->setContextProperty("dateHistoModel", organizeModel->dateHistogram);
    QObject::connect(switchboard, SIGNAL(updateTableOut(QString,int)),
                     organizeModel, SLOT(updateTable(QString,int)));
    QObject::connect(organizeModel, SIGNAL(updateTableOut(QString,int)),
                     switchboard, SLOT(updateTableIn(QString,int)));

    //Prepare a model for the queue view.
    QueueModel *queueModel = new QueueModel;
    queueModel->setQueueQuery();
    QObject::connect(switchboard, SIGNAL(updateTableOut(QString, int)),
                     queueModel, SLOT(updateTable(QString, int)));
    QObject::connect(importModel, SIGNAL(enqueueThis(QString)),
                     queueModel, SLOT(enQueue(QString)));
    engine.rootContext()->setContextProperty("queueModel", queueModel);

    if (QFile("qml/filmulator-gui/main.qml").exists())
    {
        cout << "loading UI from copy in directory" << endl;
        engine.load(QUrl::fromLocalFile("qml/filmulator-gui/main.qml"));
    }
    else if (QFile("/usr/lib/filmulator-gui/qml/filmulator-gui/main.qml").exists())
    {
        cout << "loading UI from /usr/lib/" << endl;
        engine.load(QUrl::fromLocalFile("/usr/lib/filmulator-gui/qml/filmulator-gui/main.qml"));
    }
    else
    {
        qWarning("QML UI file missing");
        return -1;
    }

    QObject *topLevel = engine.rootObjects().value(0);
    QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
    if (!window) {
        qWarning("Error: your root item has to be a Window");
        return -1;
    }
    window->setIcon(QIcon(":/icons/filmulator64icon.svg"));
    window->show();

    return app.exec();
}