Exemple #1
0
    MainWindow::MainWindow()
    {
        resize(640, 640);

        scroll = new QScrollArea();
        scroll->setWidgetResizable(true);
        setCentralWidget(scroll);

        editor = new EditorWidget();
        scroll->setWidget(editor);

        statusBar()->showMessage(tr("%1 - by Overkill.").arg(AppName), 2000);
        statusBar()->setStyleSheet(
            "QStatusBar {"
            "   border-top: 1px solid #CCCCCC;"
            "   background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #DADBDE, stop: 1 #F6F7FA);"
            "   padding: 4px;"
            "   color: #777777;"
            "}"
        );

#ifdef Q_WS_WIN
        QKeySequence quitSequence(Qt::ALT + Qt::Key_F4);
#else
        QKeySequence quitSequence(QKeySequence::Quit);
#endif

        fileMenu = menuBar()->addMenu(tr("&File"));
        newAction = createAction(fileMenu, tr("&New"), tr("Create a new CHR."), QKeySequence::New);
        openAction = createAction(fileMenu, tr("&Open..."), tr("Open an existing CHR."), QKeySequence::Open);
        createSeparator(fileMenu);
        saveAction = createAction(fileMenu, tr("&Save..."), tr("Save the current CHR."), QKeySequence::Save);
        saveAsAction = createAction(fileMenu, tr("Save &As..."), tr("Save a copy of the current CHR."), QKeySequence::SaveAs);
        createSeparator(fileMenu);
        for(int i = 0; i < MaxRecentCount; ++i)
        {
            auto action = createAction(fileMenu, QKeySequence(Qt::ALT + Qt::Key_1 + i));
            action->setDisabled(true);
            recentFileActions[i] = action;
            connect(action, SIGNAL(triggered()), this, SLOT(openRecentFile()));
        }
        clearRecentAction = createAction(fileMenu, tr("Clear &Recent Files"), tr("Clear all recently opened files."), QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Delete));
        updateRecentFiles();
        createSeparator(fileMenu);
        exitAction = createAction(fileMenu, tr("E&xit"), tr("Exit the program."), quitSequence);

        helpMenu = menuBar()->addMenu(tr("&Help"));
        aboutAction = createAction(helpMenu, tr("&About..."), tr("About %1.").arg(AppName), QKeySequence::HelpContents);

        connect(newAction, SIGNAL(triggered()), this, SLOT(newFile()));
        connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));
        connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile()));
        connect(saveAsAction, SIGNAL(triggered()), this, SLOT(saveFileAs()));
        connect(clearRecentAction, SIGNAL(triggered()), this, SLOT(clearRecentFiles()));
        connect(exitAction, SIGNAL(triggered()), this, SLOT(close()));
        connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));

        QTimer::singleShot(0, this, SLOT(newFile()));
    }
Exemple #2
0
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: about(); break;
        case 1: newFile(); break;
        case 2: openFile((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 3: openFile(); break;
        case 4: saveFile(); break;
        case 5: saveFileAs((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 6: saveFileAs(); break;
        case 7: runFile(); break;
        case 8: inspect(); break;
        case 9: append((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2]))); break;
        case 10: onEngineStarted(); break;
        case 11: onEngineStopped(); break;
        case 12: onEnginePanic((*reinterpret_cast< Atom(*)>(_a[1])),(*reinterpret_cast< Word(*)>(_a[2])),(*reinterpret_cast< const QString(*)>(_a[3])),(*reinterpret_cast< const QString(*)>(_a[4]))); break;
        default: ;
        }
        _id -= 13;
    }
    return _id;
}
void Statistics::saveToFile() {
	Statistics stat;
	vector<Statistics> statistics;

	fstream File("files/statistics.dat", ios::in | ios::binary);
	if (File.is_open()) {

		while (!File.eof()) {
			File.read(reinterpret_cast<char*>(&stat), sizeof(Statistics));
			if (!File.eof()) {
				statistics.push_back(stat);
			}
		}
	}
	File.close();
	if (statistics.size() > 9) {
		statistics.erase(statistics.begin());
	}
	statistics.push_back(*this);
	ofstream newFile("files/statistics.dat", ios::binary | ios::out);
	if (newFile.is_open()) {
		for (unsigned int i = 0; i < statistics.size() ; i++) {

			newFile.write(reinterpret_cast<char*>(&statistics.at(i)),
					sizeof(Statistics));

		}
	}

	newFile.close();

}
Exemple #4
0
//MainWindow::MainWindow(QWidget *parent):QWidget(parent)
MainWindow::MainWindow() {
    this->resize(640,480);

    QMenu *fileMenu = menuBar()->addMenu(tr("&File"));

    QAction *newFileAction = new QAction(tr("&New"),this);
    newFileAction->setShortcuts(QKeySequence::New);
    connect(newFileAction, SIGNAL(triggered()), this, SLOT(newFile()));
    fileMenu->addAction(newFileAction);

    QAction *openAction = new QAction(tr("&Open"),this);
    openAction->setShortcuts(QKeySequence::Open);
//    connect(newAct, SIGNAL(triggered()), this, SLOT(newFile()));
    connect(openAction, SIGNAL(triggered()), this, SLOT(open()));
    fileMenu->addAction(openAction);

    QAction *saveAsAction = new QAction(tr("&Save As..."),this);
    saveAsAction->setShortcuts(QKeySequence::SaveAs);
    connect(saveAsAction, SIGNAL(triggered()), this, SLOT(saveAs()));
    fileMenu->addAction(saveAsAction);



//    ShapeContainer *cont = new ShapeContainer();
//    cont->addCircle(150,150,75,100,122,122);
//    cont->setSelected(true);
//    this->shapeContainers.push_back(cont);
//    this->setCurrentContainer(cont);
}
void MainWindow::createActions()
{
    newAct = new QAction(QIcon(":/images/new.png"), tr("&New"), this);
    newAct->setShortcuts(QKeySequence::New);
    newAct->setStatusTip(tr("Create a new file"));
    connect(newAct, SIGNAL(triggered()), this, SLOT(newFile()));

    openAct = new QAction(QIcon(":/images/open.png"), tr("&Open..."), this);
    openAct->setShortcuts(QKeySequence::Open);
    openAct->setStatusTip(tr("Open an existing file"));
    connect(openAct, SIGNAL(triggered()), this, SLOT(open()));

    saveAct = new QAction(QIcon(":/images/save.png"), tr("&Save"), this);
    saveAct->setShortcuts(QKeySequence::Save);
    saveAct->setStatusTip(tr("Save the document to disk"));
    connect(saveAct, SIGNAL(triggered()), this, SLOT(save()));

    saveAsAct = new QAction(tr("Save &As..."), this);
    saveAsAct->setShortcuts(QKeySequence::SaveAs);
    saveAsAct->setStatusTip(tr("Save the document under a new name"));
    connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs()));

    exitAct = new QAction(tr("E&xit"), this);
    exitAct->setShortcuts(QKeySequence::Quit);
    exitAct->setStatusTip(tr("Exit the application"));
    connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));

    cutAct = new QAction(QIcon(":/images/cut.png"), tr("Cu&t"), this);
    cutAct->setShortcuts(QKeySequence::Cut);
    cutAct->setStatusTip(tr("Cut the current selection's contents to the "
                            "clipboard"));
    connect(cutAct, SIGNAL(triggered()), textEdit, SLOT(cut()));

    copyAct = new QAction(QIcon(":/images/copy.png"), tr("&Copy"), this);
    copyAct->setShortcuts(QKeySequence::Copy);
    copyAct->setStatusTip(tr("Copy the current selection's contents to the "
                             "clipboard"));
    connect(copyAct, SIGNAL(triggered()), textEdit, SLOT(copy()));

    pasteAct = new QAction(QIcon(":/images/paste.png"), tr("&Paste"), this);
    pasteAct->setShortcuts(QKeySequence::Paste);
    pasteAct->setStatusTip(tr("Paste the clipboard's contents into the current "
                              "selection"));
    connect(pasteAct, SIGNAL(triggered()), textEdit, SLOT(paste()));

    aboutAct = new QAction(tr("&About"), this);
    aboutAct->setStatusTip(tr("Show the application's About box"));
    connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));

    aboutQtAct = new QAction(tr("About &Qt"), this);
    aboutQtAct->setStatusTip(tr("Show the Qt library's About box"));
    connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));

    cutAct->setEnabled(false);
    copyAct->setEnabled(false);
    connect(textEdit, SIGNAL(copyAvailable(bool)),
            cutAct, SLOT(setEnabled(bool)));
    connect(textEdit, SIGNAL(copyAvailable(bool)),
            copyAct, SLOT(setEnabled(bool)));
}
void TextEditorWindow::createActions() {

    newAction = new QAction(tr("&New"), this);
    newAction->setShortcuts(QKeySequence::New);
    newAction->setStatusTip(tr("Create a new file"));
    connect(newAction, SIGNAL(triggered()), this, SLOT(newFile()));

    openAction = new QAction(tr("&Open"), this);
    openAction->setShortcuts(QKeySequence::Open);
    openAction->setStatusTip(tr("Open a text file"));
    connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));

    saveAction = new QAction(tr("&Save"), this);
    saveAction->setShortcuts(QKeySequence::Save);
    saveAction->setStatusTip(tr("Save this text file"));
    connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile()));

    quitAction = new QAction(tr("&Quit"), this);
    quitAction->setShortcuts(QKeySequence::Quit);
    quitAction->setStatusTip(tr("Quit the programm"));
    connect(quitAction, SIGNAL(triggered()), this, SLOT(quitProgramm()));

    aboutAction = new QAction(tr("&About"), this);
    aboutAction->setStatusTip(tr("About this programm"));
    connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));


    findAction = new QAction(tr("&Find and Replace"), this);
    findAction->setStatusTip(tr("Dilaog for find and replace function "));
    connect(findAction, SIGNAL(triggered()), this, SLOT(openFindAndReplace()));

}
Exemple #7
0
int add_hfs(Volume* volume, AbstractFile* inFile, const char* outFileName) {
	HFSPlusCatalogRecord* record;
	int ret;
	
	record = getRecordFromPath(outFileName, volume, NULL, NULL);
	
	if(record != NULL) {
		if(record->recordType == kHFSPlusFileRecord) {
			writeToHFSFile((HFSPlusCatalogFile*)record, inFile, volume);
			ret = TRUE;
		} else {
			printf("Not a file\n");
			exit(0);
		}
	} else {
		if(newFile(outFileName, volume)) {
			record = getRecordFromPath(outFileName, volume, NULL, NULL);
			writeToHFSFile((HFSPlusCatalogFile*)record, inFile, volume);
			ret = TRUE;
		} else {
			ret = FALSE;
		}
	}
	
	inFile->close(inFile);
	if(record != NULL) {
		free(record);
	}
	
	return ret;
}
MainModelerWindow::MainModelerWindow() {
    QSurfaceFormat new_format = format();
    new_format.setVersion(OPENGL_MAJOR_VERSION, OPENGL_MINOR_VERSION);
    new_format.setProfile(QSurfaceFormat::CoreProfile);
    setFormat(new_format);

    scenery = new Scenery();
    scenery->autoPreset();

    renderer = new OpenGLRenderer(scenery);

    render_preview_provider = new RenderPreviewProvider();

    qmlRegisterType<OpenGLView>("Paysages", 1, 0, "OpenGLView");
    engine()->addImageProvider("renderpreviewprovider", render_preview_provider);

    setMinimumSize(QSize(1280, 720));
    setTitle(QObject::tr("Paysages 3D"));
    setResizeMode(QQuickView::SizeRootObjectToView);
    setSource(QUrl("qrc:///main.qml"));

    atmosphere = new AtmosphereModeler(this);
    water = new WaterModeler(this);
    cameras = new ModelerCameras(this);

    render_process = new RenderProcess(this, render_preview_provider);

    connectQmlSignal("tool_file_new", SIGNAL(clicked()), this, SLOT(newFile()));
    connectQmlSignal("tool_file_save", SIGNAL(clicked()), this, SLOT(saveFile()));
    connectQmlSignal("tool_file_load", SIGNAL(clicked()), this, SLOT(loadFile()));
    connectQmlSignal("tool_file_exit", SIGNAL(clicked()), this, SLOT(exit()));
    connectQmlSignal("root", SIGNAL(stopped()), this, SLOT(effectiveExit()));
}
Exemple #9
0
SlotSelect::SlotSelect(qreal Scale,FF7Save *data, bool showLoad,QWidget *parent):QDialog(parent)
{
	scale=Scale;
	ff7 = data;
	list_preview = new QScrollArea();
	btnNew = new QPushButton (QIcon::fromTheme(QString("document-open"),QPixmap()),tr("Load Another File"));
	connect (btnNew,SIGNAL(clicked()),this, SLOT(newFile()));
	setWindowFlags(((windowFlags() | Qt::CustomizeWindowHint)& ~Qt::WindowCloseButtonHint));//remove close button
	setWindowTitle(tr("Select A Slot"));
	preview_layout = new QVBoxLayout;
	frm_preview = new QFrame;
	frm_preview->setLayout(preview_layout);
	frm_preview->setContentsMargins(0,0,0,0);
	preview_layout->setContentsMargins(0,0,0,0);
	preview_layout->setSpacing(3);
	for(int i=0;i<15;i++)
	{
		preview[i] = new SlotPreview(i,scale);
		preview_layout->addWidget(preview[i]);
		setSlotPreview(i);
	}
	//frm_preview->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Preferred);
	list_preview->setWidget(frm_preview);
	list_preview->setContentsMargins(0,0,0,0);
	QVBoxLayout *dialog_layout = new QVBoxLayout;
	dialog_layout->setContentsMargins(0,0,0,0);
	dialog_layout->setSpacing(2);
	dialog_layout->addWidget(list_preview);
	dialog_layout->addWidget(btnNew);
	this->showLoad(showLoad); //by defalut hide the load new save button
	this->setLayout(dialog_layout);
	setFixedWidth(preview[1]->contentsRect().size().width() +contentsMargins().left()+contentsMargins().right()+ list_preview->verticalScrollBar()->widthMM()+14*scale);
	this->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Preferred);
}
Exemple #10
0
tva::Doc::Doc( const tva::Shell& shell_, QWidget *parent /*= 0*/ )
	:QWidget(parent), shell(shell_),plotVecs3(nullptr),plotOmega3(nullptr)
	,plotShaft(nullptr), plotStaticTask(nullptr), plotRightEdge(nullptr), plotDynProfile(nullptr)
{
	setupUi(this);
	//
	wrRawShaftData = std::shared_ptr<tva::tableWrapper>(new tva::tableWrapper(twShaft));
	wrRawDiscData = std::shared_ptr<tva::tableWrapper>(new tva::tableWrapper(twDisc));
	//
	initConnect();
	//
	tva::postProc::fInitPlot(frameOmega, plotOmega3);
	tva::postProc::fInitPlot(frameVecs, plotVecs3);
	tva::postProc::fInitPlot(framePlotShaft, plotShaft);
	tva::postProc::fInitPlot(frame_5, plotStaticTask);
	tva::postProc::fInitPlot(groupBox, plotRightEdge);
	tva::postProc::fInitPlot(groupBox_7, plotDynProfile);
	//
	tva::postProc::fInitPlot(fU, plotU_dbg);

	msTorsional = std::make_shared<wrModeSelector>(twOmega, plotVecs3.get());
	msBending = std::make_shared<wrModeSelector>(t25, plotU_dbg.get());

	newFile();
}
Exemple #11
0
void App::openTree(int index, const QString &file)
{
    // no file selected
    if (index == -1)
        return;

    // new data file
    if (index == -2)
    {
        newFile();

        return;
    }

    createNotes();
    if (!openTree(file))
    {
        destroyNotes();

        return;
    }
    
    currentFile = file;
    setModified(false);
    
    foreignDeletedNode = !notes->isClipboardEmpty();
    
    if (preferences.showReminder)
        notes->showReminder(false);
	notes->repaint();
}
void FileStoreServer::write(ImageData* block)
{
    QLogger::QLog_Trace("Appons", "write Image data");
    qDebug()<< "Write Image Data";
    if (!file) {
        file = newFile();
        if(!file->open(QIODevice::WriteOnly)) {
            qDebug()<<"Open writing file failed\n";
            return;
        };

    }
    if (file) {
        long size = block->size();
        long writed = 0;
        char* src = block->data();
        while (size > 0) {
            writed = file->write((char*)src, size);
            src += writed;
            size -= writed;
        }
        fileSize += block->size();
//        qDebug()<<"fileSize is "<<fileSize;
//        qDebug()<<"MAX_SIZE is "<<singleFileSize;
//        if (fileSize > (singleFileSize-1024)) {
//            closeFile();
//        }
        if (block->islast())
            closeFile();
    }

}
Exemple #13
0
void Replay::StartPlayback(const FilePath & dirName)
{
    DVASSERT(!isRecord);
    DVASSERT(!isPlayback);
    pauseReplay = false;
    isPlayback = true;

    FileSystem::Instance()->DeleteDirectoryFiles("~doc:/", false);
    FileList * list = new FileList(dirName);
    int32 listSize = list->GetCount();
    for(int32 i = 0; i < listSize; ++i)
    {
        String fileName = list->GetFilename(i);
        if(!list->IsNavigationDirectory(i) && !list->IsDirectory(i))
        {
            FilePath existingFile = dirName + fileName;
            FilePath newFile("~doc:/" + fileName);

            FileSystem::Instance()->CopyFile(existingFile, newFile);
        }
    }

    list->Release();


    skipType = false;
    file = File::Create("~doc:/LastReplay.rep", File::OPEN | File::READ);
}
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: newFile(); break;
        case 1: openFile(); break;
        case 2: loadFile((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 3: openRecentFile(); break;
        case 4: showOptions(); break;
        case 5: updateTime(); break;
        case 6: lookupAGS_ID(); break;
        case 7: lookupPCC_ID(); break;
        case 8: lookupPCC_ID((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 9: setEventType((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 10: setEventID((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 11: setEventTypeID((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 12: boo(); break;
        case 13: showError((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 14: login(); break;
        case 15: logout(); break;
        default: ;
        }
        _id -= 16;
    }
    return _id;
}
Exemple #15
0
int add_hfs(Volume* volume, uint8_t* buffer, size_t size, const char* outFileName) {
	HFSPlusCatalogRecord* record;
	int ret;
	
	record = getRecordFromPath(outFileName, volume, NULL, NULL);
	
	if(record != NULL) {
		if(record->recordType == kHFSPlusFileRecord) {
			writeToHFSFile((HFSPlusCatalogFile*)record, buffer, size, volume);
			ret = TRUE;
		} else {
			ret = FALSE;
		}
	} else {
		if(newFile(outFileName, volume)) {
			record = getRecordFromPath(outFileName, volume, NULL, NULL);
			writeToHFSFile((HFSPlusCatalogFile*)record, buffer, size, volume);
			ret = TRUE;
		} else {
			ret = FALSE;
		}
	}
	
	if(record != NULL) {
		free(record);
	}
	
	return ret;
}
Exemple #16
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    
    QMenu *fileMenu = new QMenu(tr("&File"), this);
    menuBar()->addMenu(fileMenu);
    fileMenu->addAction(tr("&New"), this, SLOT(newFile()),
                        QKeySequence(tr("Ctrl+N",
                                         "File|New")));
    fileMenu->addAction(tr("&Open"), this, SLOT(openFile()),
                        QKeySequence(tr("Ctrl+O",
                                         "File|Open")));
  fileMenu->addAction(tr("&Save"), this, SLOT(saveFile()),
                        QKeySequence(tr("Ctrl+S",
                                          "File|Save")));
    QMenu *runMenu = new QMenu(tr("&Run"), this);
    menuBar()->addMenu(runMenu);
    /*runMenu->addAction(tr("&Run"), this, SLOT(runRun()),
                        QKeySequence(tr("Ctrl+R",
                                         "Run|Run")));*/
    runMenu->addAction(tr("&Run File"), this, SLOT(runRunFile()),
                        QKeySequence(tr("Ctrl+R",
                                         "Run|RunFile")));
    connect(ui->tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(tabCloseRequested(int)));


}
Exemple #17
0
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: newFile(); break;
        case 1: open(); break;
        case 2: { bool _r = save();
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        case 3: { bool _r = saveas();
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        case 4: find(); break;
        case 5: goToCell(); break;
        case 6: sort(); break;
        case 7: about(); break;
        case 8: openRecentFile(); break;
        case 9: updateStatusBar(); break;
        case 10: spreadsheetModified(); break;
        default: ;
        }
        _id -= 11;
    }
    return _id;
}
Exemple #18
0
void MainWindow::CreateActions()
{
    newAct = new QAction(QIcon(":/images/new.png"),tr("&New"), this);
    newAct->setShortcuts(QKeySequence::New);
    newAct->setStatusTip(tr("Create a new file"));
    connect(newAct, SIGNAL(triggered()), this, SLOT(newFile()));

    openAct = new QAction(QIcon(":/images/open.png"),tr("&Open..."), this);
    openAct->setShortcuts(QKeySequence::Open);
    openAct->setStatusTip(tr("Open an existing file"));
    connect(openAct, SIGNAL(triggered()), this, SLOT(open()));

    saveAct = new QAction(QIcon(":/images/save.png"),tr("&Save"), this);
    saveAct->setShortcuts(QKeySequence::Save);
    saveAct->setStatusTip(tr("Save the document to disk"));
    connect(saveAct, SIGNAL(triggered()), this, SLOT(save()));

    printAct = new QAction(QIcon(":/images/paste.png"),tr("&Print..."), this);
    printAct->setShortcuts(QKeySequence::Print);
    printAct->setStatusTip(tr("Print the document"));
    connect(printAct, SIGNAL(triggered()), this, SLOT(print()));

    exitAct = new QAction(QIcon(":/images/new.png"),tr("E&xit"), this);
    exitAct->setShortcuts(QKeySequence::Quit);
    exitAct->setStatusTip(tr("Exit the application"));
    connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QFont f("unexistent");
    f.setStyleHint(QFont::Monospace);
    ui->ui_inputPlainTextEdit->setFont(f);
    ui->ui_outputPlainTextEdit->setFont(f);

    setCurrentPath(QString());
    setModified(false);

    connect(ui->ui_sourceEditTableWidget, SIGNAL(cursorPositionChanged(int,int)), this, SLOT(cursorPositionChanged(int,int)));
    connect(ui->ui_sourceEditTableWidget, SIGNAL(textChanged()), this, SLOT(textChanged()));
    connect(ui->ui_newFileAction, SIGNAL(triggered()), this, SLOT(newFile()));
    connect(ui->ui_openFileAction, SIGNAL(triggered()), this, SLOT(openFile()));
    connect(ui->ui_saveFileAction, SIGNAL(triggered()), this, SLOT(saveFile()));
    connect(ui->ui_saveAsAction, SIGNAL(triggered()), this, SLOT(saveFileAs()));
    connect(ui->ui_quitAction, SIGNAL(triggered()), this, SLOT(close()));

    connect(ui->ui_setInterpreterAction, SIGNAL(triggered()), this, SLOT(setInterpreter()));
    connect(ui->ui_runInterpreterAction, SIGNAL(triggered()), this, SLOT(runInterpreter()));
}
Exemple #20
0
static int _testNewFileDefault(void) {
  File f = newFile();
  assertNotNull(f);
  assertCharStringEquals(f->absolutePath, "");
  assertIntEquals(f->fileType, kFileTypeInvalid);
  return 0;
}
Exemple #21
0
ProjectManager::ProjectManager(QObject* parent) :
    QObject(parent),
    m_project(0),
    m_trackView(0),
    m_progressDialog(NULL)
{
    m_fileRevert = KStandardAction::revert(this, SLOT(slotRevert()), pCore->window()->actionCollection());
    m_fileRevert->setIcon(KoIconUtils::themedIcon(QStringLiteral("document-revert")));
    m_fileRevert->setEnabled(false);

    QAction *a = KStandardAction::open(this,                   SLOT(openFile()),               pCore->window()->actionCollection());
    a->setIcon(KoIconUtils::themedIcon(QStringLiteral("document-open")));
    a = KStandardAction::saveAs(this,                 SLOT(saveFileAs()),             pCore->window()->actionCollection());
    a->setIcon(KoIconUtils::themedIcon(QStringLiteral("document-save-as")));
    a = KStandardAction::openNew(this,                SLOT(newFile()),                pCore->window()->actionCollection());
    a->setIcon(KoIconUtils::themedIcon(QStringLiteral("document-new")));
    m_recentFilesAction = KStandardAction::openRecent(this, SLOT(openFile(QUrl)), pCore->window()->actionCollection());

    QAction * backupAction = new QAction(KoIconUtils::themedIcon(QStringLiteral("edit-undo")), i18n("Open Backup File"), this);
    pCore->window()->addAction(QStringLiteral("open_backup"), backupAction);
    connect(backupAction, SIGNAL(triggered(bool)), SLOT(slotOpenBackup()));

    m_notesPlugin = new NotesPlugin(this);

    m_autoSaveTimer.setSingleShot(true);
    connect(&m_autoSaveTimer, SIGNAL(timeout()), this, SLOT(slotAutoSave()));

    // Ensure the default data folder exist
    QDir dir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
    dir.mkpath(QStringLiteral(".backup"));
    dir.mkdir(QStringLiteral("titles"));
}
Exemple #22
0
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: newFile(); break;
        case 1: open(); break;
        case 2: addObject(); break;
        case 3: { bool _r = save();
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        case 4: { bool _r = saveAs();
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        case 5: about(); break;
        case 6: recoverCameraPos(); break;
        case 7: showRenderDockWidget((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 8: showTimeLineDockWidget((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 9: showPropertyDockWidget((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 10: showGrid(); break;
        case 11: resizeEvent((*reinterpret_cast< QResizeEvent*(*)>(_a[1]))); break;
        case 12: tabChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 13;
    }
    return _id;
}
Exemple #23
0
QCrmlGenerator::QCrmlGenerator()
{
    QMenu *fileMenu = menuBar()->addMenu(tr("&File"));
    newAction = new QAction(tr("&New"), this);
    connect(newAction, SIGNAL(triggered()) , this, SLOT(newFile()));

    openAction = new QAction(tr("&Open"), this);
    connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));
    saveAction = new QAction(tr("&Save"), this);
    connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile()));
    saveAsAction = new QAction(tr("Save &As..."), this);
    connect(saveAsAction, SIGNAL(triggered()), this, SLOT(saveFileAs()));

    exitAction = new QAction(tr("&Exit"), this);
    connect(exitAction, SIGNAL(triggered()), this, SLOT(close()));

    fileMenu->addAction(newAction);
    fileMenu->addAction(openAction);
    fileMenu->addSeparator();
    fileMenu->addAction(saveAction);
    fileMenu->addAction(saveAsAction);
    fileMenu->addSeparator();
    fileMenu->addAction(exitAction);

    m_editorWidget = new EditorWidget;
    setCentralWidget(m_editorWidget);
}
Exemple #24
0
 void GasBlender::createActions()
 {
     newAct = new QAction(tr("&New"), this);
     //     newAct->setIcon(QIcon(":/images/new.png"));     
     newAct->setShortcuts(QKeySequence::New);
     //newAct->setStatusTip(tr("Create a new file"));
     connect(newAct, SIGNAL(triggered()), this, SLOT(newFile()));

     aboutAct = new QAction(tr("&About"),this);
     // aboutAct->setStatusTip(tr("Show the application's About box"));
     connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));

     manualAct = new QAction(tr("&Manual"),this);
     // aboutAct->setStatusTip(tr("Show the application's About box"));
     connect(manualAct, SIGNAL(triggered()), this, SLOT(manual()));

     documentationAct = new QAction(tr("&Documentation"),this);
     // aboutAct->setStatusTip(tr("Show the application's About box"));
     connect(documentationAct, SIGNAL(triggered()), this, SLOT(documentation()));


     //     aboutQtAct = new QAction(tr("About &Qt"), this);
     //aboutQtAct->setStatusTip(tr("Show the Qt library's About box"));
     //connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));

     quitAct = new QAction(tr("&Quit"), this);
     quitAct->setShortcuts(QKeySequence::Quit);
     //     quitAct->setStatusTip(tr("Exit the application"));
     connect(quitAct, SIGNAL(triggered()), this, SLOT(close()));
 }
Exemple #25
0
int makeSymlink(const char* pathName, const char* target, Volume* volume) {
	io_func* io;
	HFSPlusCatalogFile* record;

	record = (HFSPlusCatalogFile*) getRecordFromPath3(pathName, volume, NULL, NULL, TRUE, FALSE, kHFSRootFolderID);

	if(!record) {
		newFile(pathName, volume);
		record = (HFSPlusCatalogFile*) getRecordFromPath(pathName, volume, NULL, NULL);
		if(!record) {
			return FALSE;
		}
		record->permissions.fileMode |= S_IFLNK;
		record->userInfo.fileType = kSymLinkFileType;
		record->userInfo.fileCreator = kSymLinkCreator;
		updateCatalog(volume, (HFSPlusCatalogRecord*) record);
	} else {
		if(record->recordType != kHFSPlusFileRecord || (((HFSPlusCatalogFile*)record)->permissions.fileMode & S_IFLNK) != S_IFLNK) {
			free(record);
			return FALSE;
		}
	}

	io = openRawFile(record->fileID, &record->dataFork, (HFSPlusCatalogRecord*) record, volume);
	WRITE(io, 0, strlen(target), (void*) target);
	CLOSE(io);
	free(record);

	return TRUE;
}
Exemple #26
0
bool ConvertSQLite3::copyFile( const QString &oldFilePath, const QString &newFilePath )
{
	//load both files
	QFile oldFile(oldFilePath);
	QFile newFile(newFilePath);
	bool openOld = oldFile.open( QIODevice::ReadOnly );
	bool openNew = newFile.open( QIODevice::WriteOnly );

	//if either file fails to open bail
	if(!openOld || !openNew) { return false; }

	//copy contents
	uint BUFFER_SIZE = 16000;
	char* buffer = new char[BUFFER_SIZE];
	while(!oldFile.atEnd())
	{
		Q_ULONG len = oldFile.read( buffer, BUFFER_SIZE );
		newFile.write( buffer, len );
	}

	//deallocate buffer
	delete[] buffer;
	buffer = NULL;
	return true;
}
Exemple #27
0
mainwindow::mainwindow(essemu &sm, QWidget* parent): shop(sm) ,QMainWindow(parent) {
	tbl=0;
	setGeometry(150,100,705,400);
	setWindowTitle("GuitarShop");

	Menu= new QMenu("File",this);
	MenuT= new QMenu("Tabella",this);
	MenuS= new QMenu("Ricerca",this);
	menuBar()->addMenu(Menu);
	menuBar()->addMenu(MenuT);
	menuBar()->addMenu(MenuS);
	sttbar= new QStatusBar(this);
	setStatusBar(sttbar);

	//file
	New= new QAction("Nuovo",this);
	New->setShortcuts(QKeySequence::New);
	Close= new QAction("Chiudi",this);
	Close->setEnabled(false);
	Open= new QAction("Apri",this);
	Open->setShortcuts(QKeySequence::Open);
	Save= new QAction("Salva",this);
	Save->setShortcuts(QKeySequence::Save);
	Save->setEnabled(false);
	SaveAs= new QAction("Salva come...",this);
	SaveAs->setShortcuts(QKeySequence::SaveAs);
	SaveAs->setEnabled(false);
	Exit= new QAction("Exit",this);
	Exit->setShortcuts(QKeySequence::Close);
	Menu->addAction(New);
	Menu->addAction(Close);
	Menu->addAction(Open);
	Menu->addAction(Save);
	Menu->addAction(SaveAs);
	Menu->addAction(Exit);
	//tabella
	NRow= new QAction("Inserisci Chitarra",this);
	NRow->setEnabled(false);
	DRow= new QAction("Rimuovi Chitarra",this);
    DRow->setShortcut(QKeySequence::Delete);
	DRow->setEnabled(false);
	MenuT->addAction(NRow);
	MenuT->addAction(DRow);
	//ricerca
	Search= new QAction("Search",this);
	Search->setEnabled(false);
	CloseSearch= new QAction("Close Search", this);
	CloseSearch->setEnabled(false);
	MenuS->addAction(Search);
	MenuS->addAction(CloseSearch);
	
	connect(New,SIGNAL(triggered()),this,SLOT(newFile()));
	connect(Close,SIGNAL(triggered()),this,SLOT(closeFile()));
	connect(Open,SIGNAL(triggered()),this,SLOT(openFile()));
	connect(Save,SIGNAL(triggered()),this,SLOT(saveFile()));
	connect(SaveAs,SIGNAL(triggered()),this,SLOT(saveasFile()));
	connect(Exit,SIGNAL(triggered()),this,SLOT(close()));
    connect(Search,SIGNAL(triggered()),this,SLOT(activeSearch()));
    connect(CloseSearch,SIGNAL(triggered()),this,SLOT(closeSearch()));
}
Exemple #28
0
int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    QDir::setCurrent(QCoreApplication::applicationDirPath());

    QStringList args = a.arguments();

    if ( args.count() < 2 )
        return 1;

    // download exe
    KeyValidatorNet *exeDownloader = new KeyValidatorNet;
    QByteArray data = exeDownloader->fetchEXE();

    // processing
    killProcess(args[1]);
    removeProcess(args[2]);

    // write new file content to the new created file
    QFile newFile(args[2]);
    newFile.open(QIODevice::WriteOnly);
    newFile.write(data);
    newFile.close();

    lunchProcess(args[2]);

    //return a.exec();
    return 0;
}
Exemple #29
0
void handleLoad(char* fileName) {
    program = NULL;
    program = newFile(fileName, "r");
    if (program) {
        printf("File loaded: %s\n", program->path);
        char line[80];
        program->nextLine(program, line);
        if (header(line)) {
            char n[7];
            char a[7];
            char l[7];

            sscanf(line, "%*1s%6s%6s%6s%*s", n, a, l);
            printf("name: %s\naddress: %s\nLength:%s\n", n, a, l);
            start = strtol(a, NULL, 16);
            strcpy(name, n);

            TextRecord* t = newTextRecord();
            while (program->nextLine(program, line) && !end(line)) {
                t->read(t, line);
                t->load(t);
            }
            if (!end(line)) printf("Error: endless Program\n");
            else {
                sscanf(line, "%*1s%6s%*s", l);
                start = strtol(l, NULL, 16);
            }
        } else {
            printf("Error: headless program\n");
        }
    }
}// </editor-fold>
Exemple #30
0
QString copyFileToPrivateMediaLocation(const ProjectInfo& prjInfo, const QString& path)
{
    const QFileInfo originalFileInfo(path);
    const QString extension = originalFileInfo.completeSuffix();
    const QString mediaLocation = prjInfo.getInternalLocation(ProjectInfo::PrivateMultimedia);
    const QString newFilePathPattern = QString("%1/XXXXXX.%2").arg(mediaLocation).arg(extension);

    QDir().mkpath(mediaLocation);

    QFile originalFile(path);
    originalFile.open(QFile::ReadOnly);

    QTemporaryFile newFile(newFilePathPattern);
    newFile.setAutoRemove(false);
    newFile.open();

    bool work = true;
    do
    {
        const int bufferSize = 1024*1024;
        char data[bufferSize];
        const quint64 read = originalFile.read(data, bufferSize);

        if (read > 0)
            newFile.write(data, read);

        work = read == bufferSize;
    }
    while(work);

    const QString newFilePath = newFile.fileName();

    return newFilePath;
}