Esempio n. 1
0
void ConfigurationWindow::init()
{
	QVBoxLayout *main_layout = new QVBoxLayout(this);

	configurationWidget = m_injectedFactory->makeInjected<ConfigurationWidget>(dataManager(), this);

	QDialogButtonBox *buttons_layout = new QDialogButtonBox(Qt::Horizontal, this);

	QPushButton *okButton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogOkButton), tr("Ok"), this);
	buttons_layout->addButton(okButton, QDialogButtonBox::AcceptRole);
	QPushButton *applyButton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogApplyButton), tr("Apply"), this);
	buttons_layout->addButton(applyButton, QDialogButtonBox::ApplyRole);
	QPushButton *cancelButton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogCancelButton), tr("Cancel"), this);
	buttons_layout->addButton(cancelButton, QDialogButtonBox::RejectRole);

	connect(okButton, SIGNAL(clicked(bool)), this, SLOT(updateAndCloseConfig()));
	connect(applyButton, SIGNAL(clicked(bool)), this, SLOT(updateConfig()));
	connect(cancelButton, SIGNAL(clicked(bool)), this, SLOT(reject()));
	connect(cancelButton, SIGNAL(clicked(bool)), this, SLOT(close()));

	main_layout->addWidget(configurationWidget);
	main_layout->addSpacing(16);
	main_layout->addWidget(buttons_layout);

	new WindowGeometryManager(new ConfigFileVariantWrapper(m_configuration, section(), name() + "_Geometry"), QRect(0, 50, 790, 580), this);
}
Esempio n. 2
0
bool SetShowQuery::doQuery()
{
	int setlistId = 0;

	// Insert a new entry in SetList
	if( d->type == DataQueryInsert )
	{
		Log::self()->message("Creating a new setlist");

		dataManager()->executeQuery( "INSERT INTO SetList(dummy) VALUES('dummy')" );

		// Get new setlist id
		QSqlQuery setlistIdQuery = dataManager()->executeQuery("SELECT MAX(id) FROM SetList");
		if( setlistIdQuery.next() )
		{
			int setlistId = setlistIdQuery.value(0).toInt();
			SetList *tempSetList = new SetList;
			tempSetList->setId( setlistId );
			d->show->setSetList( tempSetList );
		}
	}

	QSqlQuery setShowQuery;

	if( d->type == DataQueryInsert )
	{
		Log::self()->message( QString("Insert new Show %1").arg( d->show->venue() ) );
		setShowQuery.prepare("INSERT INTO Show(date, venue, city_id, setlist_id) VALUES(:date, :venue, :city_id, :setlist_id)");
	}
	else if( d->type == DataQueryUpdate )
	{
		Log::self()->message( QString("Updating Show %1").arg( d->show->venue() ) );
		setShowQuery.prepare("UPDATE Show SET date = :date, venue = :venue, city_id = :city_id WHERE id = :id");
	}
	else
	{
		return false;
	}
	
	RelationalDatabaseDataSerializer::serializeShow( setShowQuery, d->show );
	dataManager()->executeQuery( setShowQuery );

	return true;
}
Esempio n. 3
0
bool DeleteShowQuery::doQuery()
{
    Log::self()->message( QString("Removing Show %1 from data source.").arg( d->show->venue() ) );

    QSqlQuery deleteAlbumQuery;
    deleteAlbumQuery.prepare( "DELETE FROM Show WHERE id = :id" );
    deleteAlbumQuery.bindValue( ":id", d->show->id() );
    dataManager()->executeQuery( deleteAlbumQuery );

    QSqlQuery deleteSetListEntryQuery;
    deleteSetListEntryQuery.prepare( "DELETE FROM SetList WHERE id = :id" );
    deleteSetListEntryQuery.bindValue( ":id", d->show->setList()->id() );
    dataManager()->executeQuery( deleteSetListEntryQuery );

    QSqlQuery deleteSetListQuery;
    deleteSetListQuery.prepare( "DELETE FROM Setlist_has_Song WHERE setlist_id = :setlist_id" );
    deleteSetListQuery.bindValue( ":setlist_id", d->show->setList()->id() );
    dataManager()->executeQuery( deleteSetListQuery );

    return true;
}
Esempio n. 4
0
void MainConfigurationWindow::showLookChatAdvanced()
{
    if (!lookChatAdvanced)
    {
        lookChatAdvanced = injectedFactory()->makeInjected<ConfigurationWindow>(
            "LookChatAdvanced", tr("Advanced chat's look configuration"), "General", dataManager());
        lookChatAdvanced.data()->widget()->appendUiFile(
            m_pathsProvider->dataPath() + QStringLiteral("configuration/dialog-look-chat-advanced.ui"));
    }

    lookChatAdvanced.data()->show();
}
Esempio n. 5
0
bool GetSongsQuery::doQuery()
{
	Log::self()->message( "Fetching all songs from data source" );

	// Get all songs from that album
	QSqlQuery songQuery = dataManager()->executeQuery("SELECT id, title, duration, popularity FROM Song");

	while( songQuery.next() )
	{
		Song *newSong = RelationalDatabaseDataSerializer::deserializeSong( songQuery );
		d->songs.append( newSong );
	}

	return true;
}
Esempio n. 6
0
bool GetCityQuery::doQuery()
{
    Log::self()->message( "Fetching all cities" );

    QSqlQuery cityQuery = dataManager()->executeQuery(
                              "SELECT id, name, state, country "
                              "FROM City"
                          );

    while( cityQuery.next() )
    {
        City *newCity = RelationalDatabaseDataSerializer::deserializeCity( cityQuery );
        d->cities.append( newCity );
    }

    return true;
}
Esempio n. 7
0
bool GetShowsQuery::doQuery()
{
	Log::self()->message("Fetching all shows from data source");

	QSqlQuery showQuery = dataManager()->executeQuery(
"SELECT Show.id, Show.date, Show.venue, Show.setlist_id, City.id, City.name, City.state, City.country "
"FROM Show "
"INNER JOIN City ON City.id = Show.city_id"
);

	while( showQuery.next() )
	{
		Show *newShow = RelationalDatabaseDataSerializer::deserializeShow(showQuery);

		d->shows.append( newShow );
	}

	return true;
}
Esempio n. 8
0
/*
If you execute skp_parser with one argument, it spits out a json representation
of the skp, but that's incomplete since it's missing many binary blobs (these
could represent images or typefaces or just anything that doesn't currently
have a json representation).  Each unique blob is labeled with a string in the
form "data/%d".  So for example:

    tools/git-sync-deps
    bin/gn gen out/debug
    ninja -C out/debug dm skp_parser
    out/debug/dm -m grayscale -w /tmp/dm --config skp
    out/debug/skp_parser /tmp/dm/skp/gm/grayscalejpg.skp | less
    out/debug/skp_parser /tmp/dm/skp/gm/grayscalejpg.skp | grep data
    out/debug/skp_parser /tmp/dm/skp/gm/grayscalejpg.skp data/0 | file -
    out/debug/skp_parser /tmp/dm/skp/gm/grayscalejpg.skp data/0 > /tmp/data0.png

"data/0" is an image that the SKP serializer has encoded as PNG.
*/
int main(int argc, char** argv) {
    if (argc < 2) {
        SkDebugf("Usage:\n  %s SKP_FILE [DATA_URL]\n", argv[0]);
        return 1;
    }
    SkFILEStream input(argv[1]);
    if (!input.isValid()) {
        SkDebugf("Bad file: '%s'\n", argv[1]);
        return 2;
    }
    sk_sp<SkPicture> pic = SkPicture::MakeFromStream(&input);
    if (!pic) {
        SkDebugf("Bad skp: '%s'\n", argv[1]);
        return 3;
    }
    SkISize size = pic->cullRect().roundOut().size();
    SkDebugCanvas debugCanvas(size.width(), size.height());
    pic->playback(&debugCanvas);
    std::unique_ptr<SkCanvas> nullCanvas = SkMakeNullCanvas();
    UrlDataManager dataManager(SkString("data"));
    Json::Value json = debugCanvas.toJSON(
            dataManager, debugCanvas.getSize(), nullCanvas.get());
    if (argc > 2) {
        if (UrlDataManager::UrlData* data =
            dataManager.getDataFromUrl(SkString(argv[2]))) {
            SkData* skdata = data->fData.get();
            SkASSERT(skdata);
            #ifdef SK_BUILD_FOR_WIN
            fflush(stdout);
            (void)_setmode(_fileno(stdout), _O_BINARY);
            #endif
            fwrite(skdata->data(), skdata->size(), 1, stdout);
        } else {
            SkDebugf("Bad data url.\n");
            return 4;
        }
    } else {
        Json::StyledStreamWriter("  ").write(std::cout, json);
    }
    return 0;
}
bool GetSongsFromAlbumQuery::doQuery()
{
	Log::self()->message( QString("Fetching songs from album with id %1").arg(d->albumId) );

	// Get all songs from that album
	QSqlQuery songQuery = dataManager()->executeQuery(
QString(
"SELECT id, title, duration, popularity "
"FROM Song "
"INNER JOIN Album_has_Song ON Album_has_Song.song_id = Song.id "
"WHERE Album_has_Song.album_id = %1").arg( d->albumId )
);

	while( songQuery.next() )
	{
		Song *newSong = RelationalDatabaseDataSerializer::deserializeSong( songQuery );
		d->songs.append( newSong );
	}

	return true;
}
Esempio n. 10
0
//-----------------------------------------------------------------------------
StatusCode
RootHistCnv::RDirectoryCnv::fillObjRefs(IOpaqueAddress* pAddr,DataObject* pObj)  {
  MsgStream log(msgSvc(), "RDirectoryCnv");
  IRegistry* pReg = pObj->registry();
  std::string full  = pReg->identifier();
  const std::string& fname = pAddr->par()[0];

  TFile *tf;
  findTFile(full,tf).ignore();

  // cd to TFile:
  setDirectory(full);
  TIter nextkey(gDirectory->GetListOfKeys());
  while (TKey *key = (TKey*)nextkey()) {
    IOpaqueAddress* pA = 0;
    TObject *obj = key->ReadObj();
    std::string title = obj->GetTitle();
    std::string sid = obj->GetName();
    std::string f2 = full + "/" + sid;
    int idh = ::strtol(sid.c_str(),NULL,10);
    // introduced by Grigori Rybkine
    std::string clname = key->GetClassName();
    std::string clnm = clname.substr(0,3);
    TClass* isa = obj->IsA();
    if (isa->InheritsFrom("TTree")) {
      createAddress(full, CLID_ColumnWiseTuple, idh, obj, pA).ignore();
      TTree* tree = (TTree*) obj;
      tree->Print();
      log << MSG::DEBUG << "Reg CWNT \"" << obj->GetTitle()
       	  << "\" as " << f2 << endmsg;
      title = "/" + sid;
    } else if (isa->InheritsFrom("TDirectory")) {
      createAddress(full,CLID_NTupleDirectory, title, obj, pA).ignore();
    } else if ( isa == TProfile::Class() ) {
      createAddress(full,CLID_ProfileH,idh,obj,pA).ignore();
      title = sid;
    } else if ( isa == TProfile2D::Class() ) {
      createAddress(full,CLID_ProfileH2,idh,obj,pA).ignore();
      title = sid;
    } else if ( isa == TH1C::Class() ) {
      createAddress(full,CLID_H1D,idh,obj,pA).ignore();
      title = sid;
    } else if ( isa == TH1S::Class() ) {
      createAddress(full,CLID_H1D,idh,obj,pA).ignore();
      title = sid;
    } else if ( isa == TH1I::Class() ) {
      createAddress(full,CLID_H1D,idh,obj,pA).ignore();
      title = sid;
    } else if ( isa == TH1F::Class() ) {
      createAddress(full,CLID_H1D,idh,obj,pA).ignore();
      title = sid;
    } else if ( isa == TH1D::Class() ) {
      createAddress(full,CLID_H1D,idh,obj,pA).ignore();
      title = sid;
    } else if ( isa == TH2C::Class() ) {
      createAddress(full,CLID_H2D,idh,obj,pA).ignore();
      title = sid;
    } else if ( isa == TH2S::Class() ) {
      createAddress(full,CLID_H2D,idh,obj,pA).ignore();
      title = sid;
    } else if ( isa == TH2I::Class() ) {
      createAddress(full,CLID_H2D,idh,obj,pA).ignore();
      title = sid;
    } else if ( isa == TH2F::Class() ) {
      createAddress(full,CLID_H2D,idh,obj,pA).ignore();
      title = sid;
    } else if ( isa == TH2D::Class() ) {
      createAddress(full,CLID_H2D,idh,obj,pA).ignore();
      title = sid;
    } else if ( isa == TH3C::Class() ) {
      createAddress(full,CLID_H3D,idh,obj,pA).ignore();
      title = sid;
    } else if ( isa == TH3S::Class() ) {
      createAddress(full,CLID_H3D,idh,obj,pA).ignore();
      title = sid;
    } else if ( isa == TH3I::Class() ) {
      createAddress(full,CLID_H3D,idh,obj,pA).ignore();
      title = sid;
    } else if ( isa == TH3F::Class() ) {
      createAddress(full,CLID_H3D,idh,obj,pA).ignore();
      title = sid;
    } else if ( isa == TH3D::Class() ) {
      createAddress(full,CLID_H3D,idh,obj,pA).ignore();
      title = sid;
    } else {
      log << MSG::ERROR << "Encountered an unknown object with key: "
      	  << obj->GetName() << " in ROOT file " << fname << endmsg;
      return StatusCode::FAILURE;
    }
    if ( 0 != pA )    {
      StatusCode sc = dataManager()->registerAddress(pReg, title, pA);
      if ( !sc.isSuccess() )  {
        log << MSG::ERROR << "Failed to register address for " << full  << endmsg;
        return sc;
      }
      log << MSG::VERBOSE << "Created address for " << clnm
          << "'" << title << "' in " << full << endmsg;
    }
  }
  return StatusCode::SUCCESS;
}