示例#1
0
void IQmolApplication::maybeQuit()
{
   disconnect(this, SIGNAL(lastWindowClosed()), this, SLOT(maybeQuit()));

   QPixmap pixmap;
   pixmap.load(":/imageInformation");
   QMessageBox messageBox(QMessageBox::NoIcon, "IQmol", "No viewer windows remain");
   QPushButton* quitButton = messageBox.addButton("Quit", QMessageBox::AcceptRole);
   QPushButton* newButton  = messageBox.addButton("New", QMessageBox::RejectRole);
   QPushButton* openButton = messageBox.addButton("Open", QMessageBox::RejectRole);
   messageBox.setIconPixmap(pixmap);
   messageBox.exec();

   if (messageBox.clickedButton() == quitButton) {
      QApplication::quit();
   }else if (messageBox.clickedButton() == newButton) {
      MainWindow* mw(new MainWindow());
      mw->show();
   }else if (messageBox.clickedButton() == openButton) {
      MainWindow* mw(new MainWindow());
      mw->show();
      mw->openFile();
   }

   connect(this, SIGNAL(lastWindowClosed()), this, SLOT(maybeQuit()));
}
示例#2
0
TilesetItemBox::TilesetItemBox(QWidget *parent) :
    QDockWidget(parent),
    MWDock_Base(parent),
    ui(new Ui::TilesetItemBox)
{
    setVisible(false);
    setAttribute(Qt::WA_ShowWithoutActivating);
    ui->setupUi(this);
    connect(ui->customTilesetSearchEdit, SIGNAL(textChanged(QString)), this, SLOT(makeCurrentTileset()));
    ui->TileSetsCategories->setTabPosition(GlobalSettings::TSTToolboxPos);

    this->setFocusPolicy(Qt::ClickFocus);

    lockTilesetBox = false;

    QRect dg = qApp->desktop()->availableGeometry(qApp->desktop()->primaryScreen());
    int GOffset = 240;

    mw()->addDockWidget(Qt::BottomDockWidgetArea, this);
    connect(mw(), SIGNAL(languageSwitched()), this, SLOT(re_translate()));
    setFloating(true);
    setGeometry(
        dg.x() + GOffset,
        dg.bottom() - height() - 5,
        800,
        250
    );

    m_lastVisibilityState = isVisible();
    mw()->docks_level_and_world.
    addState(this, &m_lastVisibilityState);
}
示例#3
0
WorldSettingsBox::WorldSettingsBox(QWidget *parent) :
    QDockWidget(parent),
    MWDock_Base(parent),
    ui(new Ui::WorldSettingsBox)
{
    setVisible(false);
    setAttribute(Qt::WA_ShowWithoutActivating);
    ui->setupUi(this);

    world_settings_lock_fields=false;

    QRect mwg = mw()->geometry();
    int GOffset=240;
    mw()->addDockWidget(Qt::RightDockWidgetArea, this);
    connect(mw(), SIGNAL(languageSwitched()), this, SLOT(re_translate()));
    #ifdef Q_OS_WIN
    setFloating(true);
    #endif
    setGeometry(
                mwg.x()+mwg.width()-width()-GOffset,
                mwg.y()+120,
                width(),
                height()
                );

    mw()->docks_world.
          addState(this, &GlobalSettings::WorldSettingsToolboxVis);
}
示例#4
0
//ITemProps
void WLD_ItemProps::on_WLD_PROPS_PathBG_clicked(bool checked)
{
    if(wld_tools_lock) return;

    if(wlvlPtr<0)
    {
        WldPlacingItems::LevelSet.pathbg = checked;
    }
    else
    if(mw()->activeChildWindow()==3)
    {
        WorldData selData;
        WorldEdit * edit = mw()->activeWldEditWin();
        if(!edit) return;
        QList<QGraphicsItem *> items = edit->scene->selectedItems();
        foreach(QGraphicsItem * item, items)
        {
            if(item->data(ITEM_TYPE).toString()=="LEVEL")
            {
                selData.levels.push_back(((ItemLevel *) item)->m_data);
                ((ItemLevel*)item)->setShowSmallPathBG(checked);
            }
        }
        edit->scene->addChangeSettingsHistory(selData, HistorySettings::SETTING_PATHBACKGROUND, QVariant(checked));
    }
void WorldItemBox::LevelList_itemClicked(const QModelIndex &item)
{
    if(!item.isValid())
        return;//Ignore invalid
    //placeLevel
    if ((mw()->activeChildWindow() == MainWindow::WND_World) && (ui->WLD_LevelList->hasFocus()))
    {
        if(!m_levelsModel->data(item, ItemBoxListModel::ItemBox_ItemIsValid).toBool())
            return;
        int id = m_levelsModel->data(item, ItemBoxListModel::ItemBox_ItemId).toInt();
        mw()->SwitchPlacingItem(ItemTypes::WLD_Level, id);
    }
}
示例#6
0
void WorldSettingsBox::setCurrentWorldSettings()
{
    world_settings_lock_fields=true;
    int WinType = mw()->activeChildWindow();
    if(WinType==3)
    {
        WorldEdit * edit = mw()->activeWldEditWin();
        if(!edit) return;
        LogDebug("-> Set Worldmap settings");

        LogDebug("-> setTitle");
        ui->WLD_Title->setText( edit->WldData.EpisodeTitle );

        LogDebug("-> setText");
        ui->WLD_AutostartLvl->setText( edit->WldData.IntroLevel_file );

        ui->WLD_Stars->setValue( edit->WldData.stars );

        ui->WLD_NoWorldMap->setChecked( edit->WldData.HubStyledWorld );
        mw()->ui->actionWLDDisableMap->setChecked( edit->WldData.HubStyledWorld );
        ui->WLD_RestartLevel->setChecked( edit->WldData.restartlevel );
        mw()->ui->actionWLDFailRestart->setChecked( edit->WldData.restartlevel );

        ui->WLD_Credirs->setText( edit->WldData.authors );

        LogDebug("-> Character List");
        //clear character list
        while(!WLD_CharacterCheckBoxes.isEmpty())
        {
            QMap<QCheckBox *, int>::iterator it = WLD_CharacterCheckBoxes.begin();
            delete it.key();
            WLD_CharacterCheckBoxes.erase(it);
        }

        LogDebug("-> Clear Menu");
        //ui->WLD_DisableCharacters

        //Create absence data
        if(edit->WldData.nocharacter.size() < mw()->configs.characters.size())
        {
            for(int i=0; i<=mw()->configs.characters.size()-edit->WldData.nocharacter.size(); i++ )
                edit->WldData.nocharacter.push_back(false);
        }

        for(int i = 0; i < mw()->configs.characters.size(); ++i){
            QCheckBox* cur = new QCheckBox(mw()->configs.characters[i].name);
            if(i < edit->WldData.nocharacter.size()){
                cur->setChecked(edit->WldData.nocharacter[i]);
            }
            WLD_CharacterCheckBoxes[cur] = mw()->configs.characters[i].id;
            connect(cur, SIGNAL(clicked(bool)), this, SLOT(characterActivated(bool)));
            ui->WLD_DisableCharacters->layout()->addWidget(cur);
        }

        LogDebug("-> Done");
    }
示例#7
0
void BookmarkWidget::createBookmark()
{
    if(!mw()->VTKA() ) return;

    QString path = getBookmarkFilepath();
    QFile bf(path);
    if(!bf.open(QFile::ReadWrite | QFile::Text)) {
        showFileOpenError();
        bf.close();
        return;
    }

    QDomDocument doc;
    QDomElement root;
    QDomNodeList list;

    if(bf.size() == 0) {
        buildDOMDocument(doc, root);
    } else {
        doc.setContent(&bf);
        list = doc.elementsByTagName(BOOKMARK_XML_ROOT);
        if(list.isEmpty()) {
            showInvalidFileError();
            return;
        }
        root = list.at(0).toElement();
    }

    QInputDialog* captionBox = new QInputDialog(this);
    QString caption;
    bool ok = true;
    do
    {
        caption = captionBox->getText(this, tr("Bookmark View"),
                                      tr("Enter a caption for this viewpoint:"), QLineEdit::Normal, "", &ok);
    } while(caption.isEmpty() && ok);

    if(!ok) return;

    QUuid uuid = QUuid::createUuid();
    createBookmarkSubclass(caption, doc, root, uuid);

    root.setAttribute(DATE_MODIFIED, QDateTime::currentDateTimeUtc().toString());
    saveDOMToFile(doc);
    if(mw()->VTKA()->mQVTKWidget) mw()->VTKA()->mQVTKWidget->update();
    refreshBookmarkList();
    QString bookmarkFolder = mw()->VTKA()->mProjectPath;
    bookmarkFolder.append(QDir::separator() + QString("BookMark"));
    emit addNavigationItem(bookmarkFolder, caption, uuid.toString());
}
示例#8
0
static void do_command(char *c)
{
	char *token;

	token = get_token(&c);

	if(strcmp(token, "flush") == 0) flush_bridge_cache();

	else if(strcmp(token, "mr") == 0) mr(get_token(&c), get_token(&c));
	else if(strcmp(token, "mw") == 0) mw(get_token(&c), get_token(&c), get_token(&c));
	else if(strcmp(token, "mc") == 0) mc(get_token(&c), get_token(&c), get_token(&c));
	else if(strcmp(token, "crc") == 0) crc(get_token(&c), get_token(&c));
	
	else if(strcmp(token, "ls") == 0) ls();
	else if(strcmp(token, "load") == 0) load(get_token(&c), get_token(&c));
	
	else if(strcmp(token, "serialboot") == 0) serialboot();
	else if(strcmp(token, "netboot") == 0) netboot();
	else if(strcmp(token, "cardboot") == 0) cardboot(0);

	else if(strcmp(token, "mdior") == 0) mdior(get_token(&c));
	else if(strcmp(token, "mdiow") == 0) mdiow(get_token(&c), get_token(&c));

	else if(strcmp(token, "reboot") == 0) reboot();
	
	else if(strcmp(token, "help") == 0) help();
	
	else if(strcmp(token, "") != 0)
		printf("Command not found\n");
}
示例#9
0
int main( int argc, char * argv[] )
{
	int rc = 0;
	try {

        QApplication app( argc, argv );

        cOHpi ohpi;
        cDomainSelector dsel( ohpi );
        dsel.Update();
        dsel.show();
        dsel.exec();

        cHpi hpi( ohpi.GetSelectedDid() );
        cMainWindow mw( hpi );
        mw.Update();
        mw.show();

        rc = app.exec();

	} catch ( const std::exception& ex ) {
		fprintf( stderr, "Error: %s\n", ex.what() );
	} catch ( ... ) {
		fprintf(stderr, "Error: unknown exception\n");
	}
	return rc;
}
示例#10
0
文件: main.cpp 项目: c6parmak/NotAra
int main(int argc, char * argv[])
{
    QApplication app(argc, argv);

    qmlRegisterType<PDFView>("MyTypes", 1, 0, "PDFView");
    //qmlRegisterType<Clip>("MyTypes", 1, 0, "Clip");
    //qmlRegisterType<PDFView>("MyTypes", 1, 0, "PDFPage");
    //qmlRegisterType<PDFView>("MyTypes", 1, 0, "QRectF");

//    QCommandLineParser commandLineParser;
//    commandLineParser.addPositionalArgument(QStringLiteral("url"),
//        QStringLiteral("The url to be loaded in the browser window."));
//    commandLineParser.process(app);
//    QStringList positionalArguments = commandLineParser.positionalArguments();
//
//    QUrl url;
//    if (positionalArguments.size() > 1) {
//        return -1;
//    } else if (positionalArguments.size() == 1)
//        url = QUrl::fromUserInput(positionalArguments.at(0));
//    else
//        url = QUrl("");

    //if (!url.isValid()) {
    //    return -1;
    //}

    MainWindow mw(0);
    mw.show();
    return app.exec();
}
示例#11
0
/*
 * Returns the filename where the bookmarks for the current object are stored.
 */
QString BookmarkWidget::getBookmarkFilepath()
{
    refreshCurrentFileInfo();

    if(bfn.isEmpty()) return QString();

    QFileInfo finfo(bfn);
    /*********** Modified by Weiqi Shi 1/15/2016*************/
    //QString path = mw()->getDataLocation();
    QString path = mw()->VTKA()->mProjectPath;
    // DT: ensures that the directory for the current file exists or will exist.
    /*********** Modified by Weiqi Shi 1/15/2016*************/
    // the comment parts are the previous version
    //mw()->createDataLocation(path);
    path.append(QDir::separator() + QString("BookMark"));

    QDir* dir = new QDir();
    //QString fn = QDir::toNativeSeparators(dir->relativeFilePath(finfo.absoluteFilePath()));

    //path.append(QDir::separator() + finfo.fileName().simplified().replace(" ", WORD_SEPARATOR) + WORD_SEPARATOR
    //            + QString::number(qHash(fn)));
    /*********** Modified by Weiqi Shi 1/15/2016*************/
    if(!QDir(path).exists()) QDir().mkdir(path);

    path = path + QDir::separator() + BOOKMARK_FN;
    return QDir::toNativeSeparators(path);
}
示例#12
0
/*
 * Saves the folder state to file when it is expanded/collapsed.
 */
void BookmarkWidget::saveFolderState(QTreeWidgetItem* item)
{
    if(!item || !mw()->VTKA() ) return;

    QString path = getBookmarkFilepath();
    QFile f(path);
    if(!f.open(QIODevice::ReadWrite | QIODevice::Text)) {
        showFileOpenError();
        return;
    }

    QDomDocument doc;
    doc.setContent(&f);
    QDomNodeList list = doc.elementsByTagName(BOOKMARK_XML_ROOT);
    if(list.isEmpty()) {
        showInvalidFileError();
        return;
    }

    QDomElement root = list.at(0).toElement();
    QString dt = QDateTime::currentDateTimeUtc().toString();
    root.setAttribute(DATE_ACCESSED, dt);

    QDomNodeList folders = root.elementsByTagName(FOLDER_NAME);
    for(int i = 0; i < folders.length(); i++) {
        QDomElement elt = folders.at(i).toElement();
        QString value = elt.attribute(TITLE);
        if(value == item->text(0)) {
            elt.setAttribute(FOLDED, item->isExpanded() ? "no" : "yes");
            elt.setAttribute(DATE_ACCESSED, dt);
        }
    }

    saveDOMToFile(doc);
}
示例#13
0
void run_command(int argc, char * argv[])
{
	if (strcmp(argv[0], "help") == 0)
	{
		help(argc, argv);
		return;
	}
	
	if (strcmp(argv[0], "md") == 0)
	{
		md(argc, argv);
		return;
	}
	
	if (strcmp(argv[0], "mw") == 0)
	{
		mw(argc, argv);
		return;
	}

	if (strcmp(argv[0], "nand") == 0)
		nand(argc, argv);

	if(argc >= 1)
		wy_printf("Unknown command '%s' - try 'help' \n",argv[0]);
	return;
}
示例#14
0
void BookmarkWidget::deleteItem(QTreeWidgetItem* item)
{
    if(!item)
    {
        QList<QTreeWidgetItem*> list = bTreeWidget->selectedItems();
        if(list.isEmpty()) return;
        item = list.at(0);
        if(!item) return;
    }
    int type = item->data(TITLE_COLUMN, Qt::UserRole).toInt();
    QString caption = item->text(TITLE_COLUMN);
    QString uuid = item->text(UUID_COLUMN);
    //if(verifyDelete(caption, type) == QMessageBox::Cancel) return;

    item->setHidden(true);
    QDomDocument doc;
    QDomElement elt = findElementbyUUID(doc, uuid, type);
    if(elt.isNull()) return;
    elt.setAttribute("isHidden", QString("True"));
    saveDOMToFile(doc);

    QString bookmarkFolder = mw()->VTKA()->mProjectPath;
    bookmarkFolder.append(QDir::separator() + QString("BookMark"));
    emit removeNavigationItem(bookmarkFolder, caption, uuid);
}
///Basic test for ReferenceFilterTask class. Tests the whole pipeline.
TEST ( HifstReferenceFilter, basic_test ) {
  //Create test fst file expecto.fst.
  typedef fst::LexicographicArc< fst::StdArc::Weight, fst::StdArc::Weight> Arc;
  typedef fst::LexicographicWeight<fst::StdArc::Weight, fst::StdArc::Weight>
  Weight;
  fst::VectorFst<Arc> aux;
  fst::MakeWeight<Arc> mw;
  aux.AddState();
  aux.AddState();
  aux.AddState();
  aux.SetStart ( 0 );
  aux.SetFinal ( 2, Arc::Weight::One() );
  aux.AddArc ( 0, Arc ( 10, 10, mw ( 0 ), 1 ) );
  aux.AddArc ( 1, Arc ( 100, 100, mw ( 0 ), 2 ) );
  fst::FstWrite ( aux, "expecto.fst" );
  //Prepare RegistryPO object.
  unordered_map<std::string, boost::any> v;
  v[HifstConstants::kReferencefilterLoad] = std::string ( "expecto.fst" );
  v[HifstConstants::kReferencefilterWrite] = std::string ( "" );
  v[HifstConstants::kReferencefilterSubstring] = std::string ("yes");
  v[HifstConstants::kReferencefilterPrunereferenceweight] = float (
        std::numeric_limits<float>::max() );
  v[HifstConstants::kReferencefilterPrunereferenceshortestpath] = unsigned (
        std::numeric_limits<unsigned>::max() );
  DataForReferenceFilter d;
  d.sidx = 0;
  const uu::RegistryPO rg ( v );
  uh::ReferenceFilterTask<DataForReferenceFilter>  rft ( rg );
  EXPECT_EQ ( rft.getBuilt(), false );
  EXPECT_EQ ( rft.getDisableSubString(), false );
  EXPECT_EQ ( rft.getWeight(), std::numeric_limits<float>::max() );
  EXPECT_EQ ( rft.getShortestPath(), std::numeric_limits<unsigned>::max() );
  EXPECT_EQ ( rft.getVocabulary().size(), 0 );
  EXPECT_EQ ( rft.getTranslationLatticeFile(), "expecto.fst" );
  rft.run ( d );
  EXPECT_EQ ( rft.getBuilt(), true );
  ASSERT_EQ ( d.tvcb.size(), 2 );
  EXPECT_TRUE ( d.tvcb.find ( "10" ) != d.tvcb.end() );
  EXPECT_TRUE ( d.tvcb.find ( "100" ) != d.tvcb.end() );
  ASSERT_EQ ( d.filters.size(), 1 );
  EXPECT_EQ ( d.filters[0]->NumStates(), 3 );
  std::stringstream ss;
  fst::PrintFst ( *d.filters[0], &ss );
  EXPECT_EQ ( ss.str(),
              "0\t1\t10\t10\n0\t2\t100\t100\n0\n1\t2\t100\t100\n1\n2\n" );
  bfs::remove ( bfs::path ( "expecto.fst" ) );
};
示例#16
0
void TilesetItemBox::editSelectedTileset()
{
    TilesetConfigureDialog *tilesetConfDia;

    if(mw()->activeChildWindow() == 1)
        tilesetConfDia = new TilesetConfigureDialog(&mw()->configs, mw()->activeLvlEditWin()->scene, mw());
    else if(mw()->activeChildWindow() == 3)
        tilesetConfDia = new TilesetConfigureDialog(&mw()->configs, mw()->activeWldEditWin()->scene, mw());
    else
        tilesetConfDia = new TilesetConfigureDialog(&mw()->configs, NULL, mw());

    util::DialogToCenter(tilesetConfDia);

    QPushButton *b = qobject_cast<QPushButton *>(sender());
    if(!b)
    {
        delete tilesetConfDia;
        return;
    }

    QWidget *parent = b->parentWidget();
    if(!parent)
    {
        delete tilesetConfDia;
        return;
    }

    QGroupBox *box = qobject_cast<QGroupBox *>(parent);
    if(!box)
    {
        delete tilesetConfDia;
        return;
    }

    QString fileName = b->property("tileset-file-name").toString();//box->title();
    QVector<SimpleTileset> ctilesets = loadCustomTilesets();
    for(int i = 0; i < ctilesets.size(); ++i)
    {
        SimpleTileset &aTileset = ctilesets[i];
        if(aTileset.fileName == fileName)
        {
            tilesetConfDia->loadSimpleTileset(aTileset, aTileset.customDir);
            tilesetConfDia->exec();
            break;
        }
    }

    delete tilesetConfDia;

    mw()->configs.loadTilesets();
    setTileSetBox();
}
示例#17
0
文件: gist.cpp 项目: akiernan/gecode
 int
 explore(Space* root, bool bab, const Options& opt) {
   char argv0='\0'; char* argv1=&argv0;
   int argc=0;
   QApplication app(argc, &argv1);
   GistMainWindow mw(root, bab, opt);
   return app.exec();
 }
WorldItemBox::WorldItemBox(QWidget *parent) :
    QDockWidget(parent),
    MWDock_Base(parent),
    ui(new Ui::WorldItemBox)
{
    setVisible(false);
    setAttribute(Qt::WA_ShowWithoutActivating);
    ui->setupUi(this);
    this->setAttribute(Qt::WA_X11DoNotAcceptFocus, true);

    m_terrainModel = new ItemBoxListModel(this);
    ui->WLD_TilesList->setModel(m_terrainModel);
    connect(ui->WLD_TilesList, &QTableView::clicked, this, &WorldItemBox::TerrainTilesTable_itemClicked);
    ui->WLD_TilesList->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
    ui->WLD_TilesList->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);

    m_sceneryModel = new ItemBoxListModel(this);
    ui->WLD_SceneList->setModel(m_sceneryModel);
    connect(ui->WLD_SceneList, &QListView::clicked, this, &WorldItemBox::SceneList_itemClicked);
    m_sceneryModel->setSort(ItemBoxListModel::Sort_ById, false);

    m_pathsModel = new ItemBoxListModel(this);
    ui->WLD_PathsList->setModel(m_pathsModel);
    connect(ui->WLD_PathsList, &QTableView::clicked, this, &WorldItemBox::PathsTable_itemClicked);
    ui->WLD_PathsList->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
    ui->WLD_PathsList->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);

    m_levelsModel = new ItemBoxListModel(this);
    ui->WLD_LevelList->setModel(m_levelsModel);
    connect(ui->WLD_LevelList, &QListView::clicked, this, &WorldItemBox::LevelList_itemClicked);
    m_levelsModel->setSort(ItemBoxListModel::Sort_ById, false);

    m_musicboxModel = new ItemBoxListModel(this);
    ui->WLD_MusicList->setModel(m_musicboxModel);
    connect(ui->WLD_MusicList, &QListView::clicked, this, &WorldItemBox::MusicList_itemClicked);
    m_musicboxModel->setSort(ItemBoxListModel::Sort_ById, false);

    mw()->addDockWidget(Qt::LeftDockWidgetArea, this);
    connect(mw(), SIGNAL(languageSwitched()), this, SLOT(re_translate()));
    connect(this, SIGNAL(visibilityChanged(bool)), mw()->ui->actionWLDToolBox, SLOT(setChecked(bool)));

    m_lastVisibilityState = isVisible();
    mw()->docks_world.
          addState(this, &m_lastVisibilityState);
}
示例#19
0
void TilesetItemBox::setTileSetBox(bool force)
{
    if(!mw()) return;
    if(lockTilesetBox) return;
    if((!this->isVisible()) && (!force)) return; //!< Don't update invisible

    pge_tilesetbox::current = ui->TileSetsCategories->currentIndex();

    clearTilesetGroups();

    //QStringList filters("*.tsgrp.ini");
    //QDir grpDir = configs.config_dir + "group_tilesets/";
    //QStringList entries;
    //entries = grpDir.entryList(filters, QDir::Files);
    foreach(SimpleTilesetGroup grp, mw()->configs.main_tilesets_grp)
        prepareTilesetGroup(grp);

    makeAllTilesets();
}
示例#20
0
void TilesetItemBox::on_tilesetGroup_currentIndexChanged(int index)
{
    if(!mw()) return;
    Q_UNUSED(index);
    #ifdef _DEBUG_
    WriteToLog(QtDebugMsg, "TilesetBox -> change combobox's index");
    #endif
    if(lockTilesetBox) return;
    makeCurrentTileset();
}
void WorldItemBox::MusicList_itemClicked(const QModelIndex &item)
{
    if(!item.isValid())
        return;//Ignore invalid
    //placeLevel
    if ((mw()->activeChildWindow() == MainWindow::WND_World) && (ui->WLD_MusicList->hasFocus()))
    {
        WorldEdit * edit = mw()->activeWldEditWin();
        if(!edit)
            return;
        if(!m_musicboxModel->data(item, ItemBoxListModel::ItemBox_ItemIsValid).toBool())
            return;
        int id = m_musicboxModel->data(item, ItemBoxListModel::ItemBox_ItemId).toInt();

        QString customMusicFile;
        if((uint64_t)id == mw()->configs.music_w_custom_id)
        {
            if(edit->isUntitled())
            {
                QMessageBox::information(this, tr("Please, save file"), tr("Please, save file first, if you want to select custom music file."), QMessageBox::Ok);
                return;
            }

            QString dirPath = edit->WldData.meta.path;
            MusicFileList musicList(dirPath, "");
            if(musicList.exec() == QDialog::Accepted)
                customMusicFile = musicList.SelectedFile;
            else
                return;
        }

        WldPlacingItems::musicSet.music_file = customMusicFile;
        mw()->SwitchPlacingItem(ItemTypes::WLD_MusicBox, id);

        //Play selected music
        edit->currentMusic = id;
        edit->currentCustomMusic = customMusicFile;
        LvlMusPlay::setMusic(LvlMusPlay::WorldMusic,
                             edit->currentMusic,
                             edit->currentCustomMusic);
        mw()->setMusic();
    }
}
示例#22
0
文件: main.c 项目: cyrozap/misoc
static void do_command(char *c)
{
	char *token;

	token = get_token(&c);

	if(strcmp(token, "mr") == 0) mr(get_token(&c), get_token(&c));
	else if(strcmp(token, "mw") == 0) mw(get_token(&c), get_token(&c), get_token(&c));
	else if(strcmp(token, "mc") == 0) mc(get_token(&c), get_token(&c), get_token(&c));
	else if(strcmp(token, "crc") == 0) crc(get_token(&c), get_token(&c));
	else if(strcmp(token, "ident") == 0) ident();

#ifdef CONFIG_L2_SIZE
	else if(strcmp(token, "flushl2") == 0) flush_l2_cache();
#endif

#ifdef FLASH_BOOT_ADDRESS
	else if(strcmp(token, "flashboot") == 0) flashboot();
#endif
#ifdef ROM_BOOT_ADDRESS
	else if(strcmp(token, "romboot") == 0) romboot();
#endif
	else if(strcmp(token, "serialboot") == 0) serialboot();
#ifdef CSR_ETHMAC_BASE
	else if(strcmp(token, "netboot") == 0) netboot();
#endif

	else if(strcmp(token, "help") == 0) help();

#ifdef __lm32__
	else if(strcmp(token, "rcsr") == 0) rcsr(get_token(&c));
	else if(strcmp(token, "wcsr") == 0) wcsr(get_token(&c), get_token(&c));
#endif

#ifdef CSR_DFII_BASE
	else if(strcmp(token, "sdrrow") == 0) sdrrow(get_token(&c));
	else if(strcmp(token, "sdrsw") == 0) sdrsw();
	else if(strcmp(token, "sdrhw") == 0) sdrhw();
	else if(strcmp(token, "sdrrdbuf") == 0) sdrrdbuf(-1);
	else if(strcmp(token, "sdrrd") == 0) sdrrd(get_token(&c), get_token(&c));
	else if(strcmp(token, "sdrrderr") == 0) sdrrderr(get_token(&c));
	else if(strcmp(token, "sdrwr") == 0) sdrwr(get_token(&c));
#ifdef CSR_DDRPHY_BASE
	else if(strcmp(token, "sdrwlon") == 0) sdrwlon();
	else if(strcmp(token, "sdrwloff") == 0) sdrwloff();
	else if(strcmp(token, "sdrlevel") == 0) sdrlevel();
#endif
	else if(strcmp(token, "memtest") == 0) memtest();
	else if(strcmp(token, "sdrinit") == 0) sdrinit();
#endif

	else if(strcmp(token, "") != 0)
		printf("Command not found\n");
}
示例#23
0
MenuItem::MenuItem(MenuProxyPtr p_menuproxy, CamcopsApp& app)
    // m_title: below
{
    setDefaults();
    m_p_menuproxy = p_menuproxy;

    QScopedPointer<MenuWindow> mw(m_p_menuproxy->create(app));
    m_title = mw->title();
    m_subtitle = mw->subtitle();
    m_icon = mw->icon();
}
示例#24
0
int main(int argc, char *argv[]) {
	QApplication app(argc, argv);
	QCoreApplication::setOrganizationName("gambatte");
	QCoreApplication::setApplicationName("gambatte_qt");

	GambatteSource source;
	MainWindow mw(source);
	GambatteMenuHandler mh(mw, source, argc, argv);
	mw.show();
	return app.exec();
}
示例#25
0
void RoomServer::addUser(UserServer* u) {
	{
		Locker l(&mtxRoom);
		a_users.push_back(u);
	}

	std::vector<std::string> tokens;
	tokens.push_back(std::to_string(a_roomNo));
	MsgWriter mw(tokens, JOIN_THE_ROOM);
	u->sendMsg(mw.getMsg(), mw.getSz());
}
示例#26
0
void MainWindow::newViewer()
{
// this is to test the exception capturing
//int *foo = (int*)-1;
//qDebug() << "printing crap";
//qDebug() << *foo;

   MainWindow* mw(new MainWindow());
   mw->move(x()+30,y()+30);
   mw->show();
}
示例#27
0
文件: main.cpp 项目: Astade/Astade
int main(int argc, char** argv) {
	QApplication app(argc,argv);
    
#ifdef DEBUG_CONSOLE_    
    UiDebugConsole *udc = new UiDebugConsole;
    Q_UNUSED( udc );
#endif
    
	MainWindow mw( NULL );
	mw.show();
	return app.exec();
}
示例#28
0
int main(int argc, char *argv[])
{
	// loading data from embedded ressource file system
	ElementDatabase db;
	db.addFromDirectory(":/data");

	// create, show and execute the main window
	QApplication app(argc, argv);
	MainWindow mw(app, db);
	mw.show();
	return app.exec();
}
示例#29
0
void BookmarkWidget::createFolder()
{
    if(!mw()->VTKA() ) return;
    bool ok = true;

    QString path = getBookmarkFilepath();
    QFile bf(path);
    if(!bf.open(QFile::ReadWrite | QFile::Text)) {
        showFileOpenError();
        bf.close();
        return;
    }

    QDomDocument doc;
    QDomElement root;
    QDomNodeList list;
    if(bf.size() == 0) {
        buildDOMDocument(doc, root);
    } else {
        qDebug() << bf.size();
        doc.setContent(&bf);
        list = doc.elementsByTagName(BOOKMARK_XML_ROOT);
        if(list.isEmpty()) {
            showInvalidFileError();
            return;
        }
        root = list.at(0).toElement();
    }

    QInputDialog* titleBox = new QInputDialog(this);
    QString title;
    do
    {
        title = titleBox->getText(this, tr("New Folder"),
                                  tr("Enter the title for your new folder:"), QLineEdit::Normal, "", &ok);
    } while(title.isEmpty() && ok);

    if(!ok) return;

    QDomElement fldr = doc.createElement(FOLDER_NAME);
    fldr.setAttribute(TITLE, title);
    QString dt = QDateTime::currentDateTimeUtc().toString();
    fldr.setAttribute(DATE_CREATED, dt);
    fldr.setAttribute(DATE_MODIFIED, dt);
    fldr.setAttribute(DATE_ACCESSED, dt);
    fldr.setAttribute(UUID_NAME, QUuid::createUuid());
    fldr.setAttribute(FOLDED, "yes");
    root.appendChild(fldr);

    saveDOMToFile(doc);
    refreshBookmarkList();
}
示例#30
0
/*
 * Expands/collapses the currently selected folder, or displays the currently
 * selected bookmark.
 */
void BookmarkWidget::handleDoubleClick(QTreeWidgetItem* item, int x)
{
    if(!item || !mw()->VTKA() ) return;

    int type = item->data(TITLE_COLUMN, Qt::UserRole).toInt();

    if(type == BOOKMARK) viewBookmark(item);
    else if(type == FOLDER) {
        // DT: not !item->isExpanded() -- when double clicking itemExpanded/Collapsed is also emitted
        // so there seems to be some lag in updating.
        item->setExpanded(item->isExpanded());
    }
}