コード例 #1
0
ファイル: mainwindow2.cpp プロジェクト: Verlet/pencil
MainWindow2::MainWindow2( QWidget *parent ) :
QMainWindow( parent ),
ui( new Ui::MainWindow2 )
{
    ui->setupUi( this );
    
    m_object = new Object();
    m_object->defaultInitialisation();

    editor = new Editor( this );
    m_pScribbleArea = editor->getScribbleArea();
    m_pTimeLine = new TimeLine( this, editor );
    makeTimeLineConnections();

    arrangePalettes();
    createMenus();
    loadAllShortcuts();

    // must run after 'arragePalettes'
    editor->setObject( m_object );
    editor->resetUI();

    readSettings();

    makeColorPaletteConnections();
	makeColorWheelConnections();

    connect(editor, SIGNAL(needSave()), this, SLOT(saveDocument()));
    connect(m_pToolSet, SIGNAL(clearButtonClicked()), editor, SLOT(clearCurrentFrame()));
    connect(editor, SIGNAL(changeTool(ToolType)), m_pToolSet, SLOT(setCurrentTool(ToolType)));

    editor->setCurrentLayer( this->editor->m_pObject->getLayerCount() - 1 );
}
コード例 #2
0
ファイル: mainwindow.cpp プロジェクト: kushdua/ece1724-pencil
MainWindow::MainWindow() {

    
	editor = new Editor(this);
	//Object* object = new Object();
	//object->defaultInitialisation();
	//editor->setObject( object );
	editor->newObject();

	arrangePalettes();
	
	//editor->getTimeLine()->close();
	
	createMenus();
	loadPlugins();
	readSettings();

    /*
     *Check if the snapshot directory exists or not
     *if yes-> continue and put snapshots in QCombobox
     *if not-> exit and continue like normal paint operations
     */

    //QDir directory("/home/grad/workspace/ece1724-pencil/ece1724-pencil/snap");
    QDir directory(QDir::currentPath() + "/snapshots");
    if (!directory.exists()) {
            qDebug() << "Directory Doesn't exists";
        }
    else {
         QStringList files = directory.entryList(QDir::Files);
         //Debugging purpose only     
         //qDebug() << "Directory exists";
         /*foreach(QString itm, files)
         {
                qDebug() << itm;
         }*/
        QWidget *window = new QWidget;
        window->setWindowTitle("Snapshots");
        QGridLayout *layout = new QGridLayout;
        QComboBox *qbox;
        QPushButton *button;
        qbox = new QComboBox();
        layout->addWidget(qbox,0,0,1,2);
        foreach(QString itm, files)
        {
            qbox->addItem(itm);
        }

        button = new QPushButton("Load Snapshot");
        layout->addWidget(button,2,0,1,2);

        window->setLayout(layout);
        //currently commented out, so that QT window doesnt show up -- will deal with this later
        //window->show();
    }