Beispiel #1
0
void App::initView(void)
{
  initSettings();
  initDoc();
  initSequenceEngine();

  QString dir;
  settings()->get(KEY_SYSTEM_DIR, dir);
  dir += QString("/") + PIXMAPPATH;
  
  setIcon(QPixmap(dir + QString("/Q.xpm")));

  initWorkspace();
  connect(m_settings, SIGNAL(outputPluginChanged(const QString&)), m_doc, SLOT(slotChangeOutputPlugin(const QString&)));

  initMenuBar();
  initStatusBar();
  initToolBar();

  initVirtualConsole();
  initDeviceManagerView();

  QString config;
  settings()->get(KEY_OPEN_LAST_WORKSPACE, config);

  if (config == Settings::trueValue())
    {
      settings()->get(KEY_LAST_WORKSPACE_NAME, config);

      doc()->loadWorkspaceAs(config);
      setCaption(KApplicationNameLong + QString(" - ") + doc()->workspaceFileName());
      virtualConsole()->hide();
    }
}
Beispiel #2
0
scopePlot::scopePlot(QString title, QWidget *parent) : QMainWindow(parent)
{
  wd=new QWidget(this);
  ui.setupUi(wd);
  mrk1=0;
  mrk2=0;
  initActions();
  initMenuBar();
  initToolBar();
  initStatusBar();
  curve1 = new QwtPlotCurve("Curve 1");
  curve2 = new QwtPlotCurve("Curve 2");
  curve3 = new QwtPlotCurve("Curve 3");
  curve4 = new QwtPlotCurve("Curve 4");

  xScaleMul=1.;
  xPrimeScaleMul=1.;
  xAltScaleMul=1;
  xAxisTitle="Samples";
  xAltAxisTitle="Time (s)";
  toggleMarker=false;

  showCrv1=true;
  showCrv2=true;
  showCrv3=true;
  showCrv4=true;
  init(title);
}
Beispiel #3
0
SettingsBase::SettingsBase( QWidget * parent )
    : KXmlGuiWindow(parent)
{
    // Ensure delayed loading doesn't cause a crash
    activeView = 0;
    aboutDialog = 0;
    configDialog = 0;
    lostFound = 0;
    // Prepare the view area
    stackedWidget = new QStackedWidget( this );
    setWindowTitle(i18n("System Settings"));
    setWindowIcon(QIcon::fromTheme("preferences-system"));
    setCentralWidget(stackedWidget);
    setWindowFlags( windowFlags() | Qt::WindowContextHelpButtonHint );
    // Initialise search
    searchText = new KLineEdit( this );
    searchText->setClearButtonShown( true );
    searchText->setPlaceholderText( i18nc( "Search through a list of control modules", "Search" ) );
    searchText->setCompletionMode( KCompletion::CompletionPopup );

    spacerWidget = new QWidget( this );
    spacerWidget->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Maximum );
    // Initalise the window so we don't flicker
    initToolBar();
    // We can now launch the delayed loading safely
    QTimer::singleShot(0, this, SLOT(initApplication()));
}
Beispiel #4
0
App::App(QWidget* parent) : QMainWindow(parent)
{
	_app = this;

	m_fileMenu = NULL;
	m_helpMenu = NULL;
	m_toolBar = NULL;

	m_copyChannel = NULL;

	setWindowTitle(App::longName());
	setWindowIcon(QIcon(":/qlc-fixtureeditor.png"));
	setCentralWidget(new QMdiArea(this));

	QCoreApplication::setOrganizationName("qlc");
	QCoreApplication::setOrganizationDomain("sf.net");
	QCoreApplication::setApplicationName(FXEDNAME);

	initActions();
	initMenuBar();
	initToolBar();

	QSettings settings;
	QVariant var = settings.value(KSettingsGeometry);
	if (var.isValid() == true)
		restoreGeometry(var.toByteArray());
}
Beispiel #5
0
HelpViewer::HelpViewer(QWidget* parent, const char* name, WFlags f)
    : QMainWindow(parent, name, f)
{
    resize(600, 480);
    setCaption(PACKAGE " " VERSION " Manual");

    setIcon(setting->image0);

    browser = new QTextBrowser(this);

    QStringList strList;

#ifdef Q_WS_WIN
    strList << applicationPath + "/html"
            << "C:/Program Files/qGo/html"
            << "D:/Program Files/qGo/html"
            << "E:/Program Files/qGo/html"
            << "C:/Programme/qGo/html"
            << "D:/Programme/qGo/html"
            << "E:/Programme/qGo/html"
            << "./html";
#else
    strList << "/usr/share/doc/" PACKAGE "/html"
            << "/usr/doc/" PACKAGE "/html"
            << "/usr/local/share/doc/" PACKAGE "/html"
            << "/usr/local/doc/" PACKAGE "/html"
            << "./html/";
#endif

    browser->mimeSourceFactory()->setFilePath(strList);
    browser->setSource("index.html");
    setCentralWidget(browser);

    initToolBar();
}
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    setSizePolicy(
                QSizePolicy(
                    QSizePolicy::MinimumExpanding,
                    QSizePolicy::MinimumExpanding));
    setMinimumSize(100, 100);
    setContentsMargins(0, 0, 0, 5);
    setWindowTitle("Qt VirtManager");
    QIcon::setThemeName("QtVirtManager");
    setWindowIcon(QIcon::fromTheme("virtual-engineering"));
    setMouseTracking(true);
    setDockOptions(
                QMainWindow::AnimatedDocks |
                QMainWindow::ForceTabbedDocks);
    restoreGeometry(settings.value("Geometry").toByteArray());
    initTaskWareHouse();
    initDomainStateMonitor();
    initTrayIcon();
    initConnListWidget();
    initToolBar();
    initDockWidgets();
    restoreState(settings.value("State").toByteArray());
    this->setVisible(!settings.value("Visible", false).toBool());
    changeVisibility();
    waitAtClose = settings.value("WaitAtClose", 180).toInt();
    closeProgress = new QProgressBar(this);
    closeProgress->setRange(0, waitAtClose*1000);
    closeProgress->setToolTip("Progress for waiting the connection close");
    statusBar()->addPermanentWidget(closeProgress);
    statusBar()->hide();
    initVirEventloop();
}
Beispiel #7
0
/**
 * Main initialization function
 */
void App::init()
{
	QSettings settings;

	setWindowIcon(QIcon(":/qlc.png"));

#ifndef __APPLE__
	/* MDI Area */
	setCentralWidget(new QMdiArea(this));
	centralWidget()->setContextMenuPolicy(Qt::CustomContextMenu);
	connect(centralWidget(),
		SIGNAL(customContextMenuRequested(const QPoint&)),
		this,
		SLOT(slotCustomContextMenuRequested(const QPoint&)));

	/* Workspace background */
	setBackgroundImage(settings.value("/workspace/background").toString());

	/* Application geometry and window state */
	QVariant var;
	var = settings.value(KXMLQLCGeometry, QRect(0, 0, 800, 600));
	if (var.isValid() == true)
		setGeometry(var.toRect());
	var = settings.value(KXMLQLCWindowState, Qt::WindowNoState);
	if (var.isValid() == true)
		setWindowState(Qt::WindowState(var.toInt()));
#else
	/* App is just a toolbar, we only need it to be the size of the
	   toolbar's buttons */
	resize(600, 32);
	move(0, 22);
#endif

	/* Input & output mappers and their plugins */
	initOutputMap();
	initInputMap();

	/* Function running engine/master timer */
	m_masterTimer = new MasterTimer(this, m_outputMap);
	m_masterTimer->start();

	/* Buses */
	Bus::init(this);

	/* Fixture definitions */
	loadFixtureDefinitions();

	// The main view
	initStatusBar();
	initActions();
	initMenuBar();
	initToolBar();

	// Document
	initDoc();

	// Start up in non-modified state
	m_doc->resetModified();
}
FmDriverView::FmDriverView() : FmViewBase( EDriverView )
{
    FM_LOG( "FmDriverView::FmDriverView" );
    initMenu(); 
    initToolBar();
    initDiskListWidget();

    QMetaObject::connectSlotsByName( this );
}
Beispiel #9
0
/*
 * The show() public SLOT, when the app is being drawn!!!
 * Init member variables and all UI widgets
 */
void MainWindow::show()
{
  if(m_initializationCompleted == false)
  {
    restoreGeometry(SettingsManager::getWindowSize());
    m_commandExecuting=ectn_NONE;
    m_commandQueued=ectn_NONE;
    m_leFilterPackage = new SearchLineEdit(this, m_hasSLocate);

    setWindowTitle(StrConstants::getApplicationName());
    setMinimumSize(QSize(820, 520));

    initTabOutput();
    initTabInfo();
    initTabFiles();
    initTabTransaction();
    initTabHelpUsage();
    initTabNews();
    initLineEditFilterPackages();
    initPackageTreeView();
    initActions();
    loadSettings();
    loadPanelSettings();
    initStatusBar();
    initToolButtonPacman();
    initToolButtonAUR();
    initAppIcon();
    initMenuBar();
    initToolBar();
    initTabWidgetPropertiesIndex();
    refreshDistroNews(false);

    if (Package::hasPacmanDatabase())
    {
      refreshGroupsWidget();
    }        

    QMainWindow::show();

    m_listOfVisitedPackages.clear();
    m_indOfVisitedPackage = 0;

    if (Package::hasPacmanDatabase())
    {
      metaBuildPackageList();
    }
    // Maybe this system has never run a pacman -Syy
    else
    {
      doSyncDatabase();
    }
  }
  else
    QMainWindow::show();
}
FmFileView::FmFileView() : FmViewBase( EFileView ), mWidget( 0 ),
    mStyleAction( 0 ), mSelectableAction( 0 ),
    mFindAction( 0 ), mSortExtension( 0 ), 
    mOperationService( 0 ), mMenu( 0 ), mIsFindDisabled( false )
{
    mOperationService = FmViewManager::viewManager()->operationService();
	initMenu();
	initMainWidget();
    initToolBar();

	QMetaObject::connectSlotsByName( this );
}
/*! \todo Ownership/destructor
*/
CrossfallEditorTool::CrossfallEditorTool(ToolManager *toolManager)
    : Tool(toolManager)
    , toolId_(ODD::TCF_SELECT)
{
    // Connect emitted ToolActions to ToolManager //
    //
    connect(this, SIGNAL(toolAction(ToolAction *)), toolManager, SLOT(toolActionSlot(ToolAction *)));

    // Tool Bar //
    //
    initToolBar();
    initToolWidget();
}
Beispiel #12
0
/*! \todo Ownership/destructor
*/
JunctionEditorTool::JunctionEditorTool(ToolManager *toolManager)
    : Tool(toolManager)
    , toolId_(ODD::TJE_SELECT)
{
    // Connect //
    //
    connect(this, SIGNAL(toolAction(ToolAction *)), toolManager, SLOT(toolActionSlot(ToolAction *)));

    // Tool Bar //
    //
    initToolBar();
    initToolWidget();
}
Beispiel #13
0
MainWindow::MainWindow()
{
	setCaption(tr("GA Bots " VERSION));

	initActions();
	initMenuBar();
	initToolBar();
	initStatusBar();

	initGABotDoc();
	initView();

	ViewToolBar->setOn(true);
	ViewStatusBar->setOn(true);
	//ViewGame->setOn(true);

	connect(GABotDoc, SIGNAL(gameReady(bool)), this, SLOT(slotGameReady(bool)));
	connect(GABotDoc, SIGNAL(teamAScores()), View, SLOT(slotScoreA()));
	connect(GABotDoc, SIGNAL(teamBScores()), View, SLOT(slotScoreB()));
	connect(GABotDoc, SIGNAL(clearScores()), View, SLOT(slotClearScores()));

	connect(GABotDoc, SIGNAL(moveTeamA(Coordinate, Coordinate)), View,
		SLOT(slotMoveTeamA(Coordinate, Coordinate)));
	connect(GABotDoc, SIGNAL(moveTeamB(Coordinate, Coordinate)), View,
		SLOT(slotMoveTeamB(Coordinate, Coordinate)));
	connect(GABotDoc, SIGNAL(turnTeamA(Coordinate, Direction)), View,
		SLOT(slotTurnTeamA(Coordinate, Direction)));
	connect(GABotDoc, SIGNAL(turnTeamB(Coordinate, Direction)), View,
		SLOT(slotTurnTeamB(Coordinate, Direction)));

	connect(GABotDoc, SIGNAL(moveBall(Coordinate,Coordinate)), View,
		SLOT(slotMoveBall(Coordinate,Coordinate)));

	connect(GoGame, SIGNAL(activated()), this, SLOT(slotGoGame()));
	connect(GoGame, SIGNAL(activated()), GABotDoc, SLOT(slotStartTimer()));
	connect(StopGame, SIGNAL(activated()), GABotDoc, SLOT(slotStopTimer()));
	connect(StopGame, SIGNAL(activated()), this, SLOT(slotStopGame()));

	connect(View, SIGNAL(valueChanged(int)), this, SLOT(slotTickInterval(int)));
	connect(GABotDoc, SIGNAL(clearField()), View, SLOT(slotClearField()));

	connect(ResetScreen, SIGNAL(activated()), View, SLOT(slotClearField()));
//not sure if we should clear the field whenever regenerating the team
//	connect(TeamAGenerate,SIGNAL(activated()), View, SLOT(slotClearField()));
//	connect(TeamBGenerate,SIGNAL(activated()), View, SLOT(slotClearField()));

	connect(GABotDoc, SIGNAL(gameOver()), View, SLOT(slotClearField()));
	connect(GABotDoc, SIGNAL(gameOver()), View, SLOT(slotClearScores()));
	connect(GABotDoc, SIGNAL(gameOver()), this, SLOT(slotGameOver()));
	
}
Beispiel #14
0
//
// Initialize this widget
//
void DeviceManagerView::initView()
{
  // Create a vertical layout to this widget
  m_layout = new QVBoxLayout(this);

  // Init the title and icon
  initTitle();

  // Set up toolbar
  initToolBar();

  // Init the device view and text view
  initDataView();

  // Connect to know when to enable/disable buttons
  connect(_app, SIGNAL(modeChanged()), this, SLOT(slotModeChanged()));

  // Update view
  update();

  //
  // Set widget proportions
  //
  QString x, y, w, h;
  _app->settings()->get(KEY_DEVICE_MANAGER_X, x);
  _app->settings()->get(KEY_DEVICE_MANAGER_Y, y);
  _app->settings()->get(KEY_DEVICE_MANAGER_W, w);
  _app->settings()->get(KEY_DEVICE_MANAGER_H, h);
  if (w == 0 || h == 0)
    {
      setGeometry(0, 0, 350, 200);
    }
  else
    {
      setGeometry(x.toInt(), y.toInt(), w.toInt(), h.toInt());
    }

  // Check if DM should be open
  QString config;
  _app->settings()->get(KEY_DEVICE_MANAGER_OPEN, config);
  if (config == Settings::trueValue())
    {
      _app->slotViewDeviceManager();
    }
  else
    {
      hide();
      _app->slotDeviceManagerViewClosed();
    }
}
Beispiel #15
0
void App::initView(void)
{
	setIcon(QPixmap(QString(PIXMAPS) + QString("/qlc-fixtureeditor.png")));

	initWorkspace();

	initMenuBar();
	initStatusBar();
	initToolBar();

	m_lastPath = QString(FIXTURES);

	resize(800, 600);
}
Beispiel #16
0
void App::initView(void)
{
  initSettings();

  setIcon(QPixmap(QString(PIXMAPS) + QString("/Q.xpm")));

  initWorkspace();

  initMenuBar();
  initStatusBar();
  initToolBar();
  
  m_lastPath = QString(FIXTURES);
}
Beispiel #17
0
Monitor::Monitor(QWidget* parent, Qt::WindowFlags f) : QWidget(parent, f)
{
	/* Master layout for toolbar and scroll area */
	new QVBoxLayout(this);

	/* Scroll area that contains the monitor widget */
	m_scrollArea = new QScrollArea(this);
	m_scrollArea->setWidgetResizable(true);
	layout()->addWidget(m_scrollArea);

	/* Monitor widget that contains all MonitorFixtures */
	m_monitorWidget = new QWidget(m_scrollArea);
	m_monitorWidget->setBackgroundRole(QPalette::Dark);
	m_monitorLayout = new MonitorLayout(m_monitorWidget);
	m_monitorLayout->setSpacing(1);
	m_monitorLayout->setMargin(1);

	/* Load global settings */
	loadSettings();

	/* Create toolbar */
	initToolBar();

	/* Create a bunch of MonitorFixtures for each fixture */
	for (t_fixture_id i = 0; i < KFixtureArraySize; i++)
	{
		Fixture* fxi = _app->doc()->fixture(i);
		if (fxi != NULL)
			createMonitorFixture(fxi);
	}

	/* Show the master container widgets */
	m_scrollArea->setWidget(m_monitorWidget);
	m_monitorWidget->show();
	m_scrollArea->show();

	/* Listen to Document changes */
	connect(_app, SIGNAL(documentChanged(Doc*)),
		this, SLOT(slotDocumentChanged(Doc*)));

	/* Listen to fixture additions and changes from Doc */
	connect(_app->doc(), SIGNAL(fixtureAdded(t_fixture_id)),
		this, SLOT(slotFixtureAdded(t_fixture_id)));
	connect(_app->doc(), SIGNAL(fixtureChanged(t_fixture_id)),
		this, SLOT(slotFixtureChanged(t_fixture_id)));

	m_timer = startTimer(1000 / 50);
	QWidget::show();
}
Beispiel #18
0
/*! \todo Ownership/destructor
*/
TrackEditorTool::TrackEditorTool(PrototypeManager *prototypeManager, ToolManager *toolManager)
    : Tool(toolManager)
    , prototypeManager_(prototypeManager)
    , toolId_(ODD::TTE_SELECT)
    , currentRoadSystemPrototype_(NULL)
{
    // Connect //
    //
    connect(this, SIGNAL(toolAction(ToolAction *)), toolManager, SLOT(toolActionSlot(ToolAction *)));

    // Tool Bar //
    //
    initToolBar();
    initToolWidget();
}
Beispiel #19
0
/*
 * The show() public SLOT, when the app is being drawn!!!
 * Init member variables and all UI widgets
 */
void MainWindow::show()
{
  if(m_initializationCompleted == false)
  {
    UnixCommand::getIgnorePkg();
    loadSettings();
    restoreGeometry(SettingsManager::getWindowSize());
    m_commandExecuting=ectn_NONE;
    m_commandQueued=ectn_NONE;
    m_leFilterPackage = new SearchLineEdit(this);

    setWindowTitle(StrConstants::getApplicationName());
    setMinimumSize(QSize(820, 520));

    initTabOutput();
    initTabInfo();
    initTabFiles();
    initTabTransaction();
    initTabHelpUsage();
    initTabNews();
    initLineEditFilterPackages();
    initPackageTreeView();

    loadPanelSettings();
    initActions();
    initStatusBar();
    initToolButtonPacman();
    initToolButtonYaourt();
    initAppIcon();
    initToolBar();
    initTabWidgetPropertiesIndex();
    refreshDistroNews(false);
    refreshGroupsWidget();

    QMainWindow::show();

    metaBuildPackageList();
  }
  else
    QMainWindow::show();
}
bool UserManagement_Invoicing::init(MainWindow *parent)
{
    PluginInterface *plugin = parent->getPlugin("UserManagementIF");
    userManagementInterface = dynamic_cast<UserManagementInterface *>(plugin);
    if(!userManagementInterface) {
        return false;
    }
    else {
        userManagementInterface->registeObserver(this);
    }
    initAction();
    initToolBar();

    if(!showLoginWindow()) {
        exit(0);
    }
    userManagement();
    userChanged();
    this->parent = parent;
    return true;
}
Beispiel #21
0
TextEditer::TextEditer(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::TextEditer)
{
    ui->setupUi(this);
	initMenu();
	initToolBar();
	initCenterWidget();
	initStatusBar();
	initLocSize();
	initConnection();

	textEdit->setFont(QFont("FreeMono", 10));	/* 默认字体 */
	textEdit->setTabStopWidth(40);	/* Tab键跳格参数, 系统默认为80, 修改为40 */

	isUntitled = true;	/* 新文件未命名 */
	isSaved = false;	/* 新文件未保存 */
	curFile = "";
	hasFile = false;	/* 没有文件打开 */
	setWindowTitle(tr("TextEditer"));
}
/*
 * Description: initializing.
 */
void IRNowPlayingView::initialize()
{
    LOG_METHOD;
    setObjectName(NOW_PLAYING_VIEW_OBJECT_NAME);
    QObjectList roots;
    roots.append(this);
    iLoader.setObjectTree(roots);

    // Load XML file
    iLoader.load(NOW_PLAYING_VIEW_LAYOUT_FILENAME);
    
    initMenu();
    initToolBar();
    initWidget();    
#ifdef SUBTITLE_STR_BY_LOCID
    setTitle(hbTrId("txt_irad_title_internet_radio"));
#else
    setTitle("Internet radio");      
#endif
    handleOrientationChanged(getViewManager()->orientation());
}
Beispiel #23
0
PreviewPlot2D::PreviewPlot2D(WorkshopMeasure* pDoc, QWidget* parent, const char *name,
							 Qt::WidgetAttribute wflags):
        WorkshopTool(parent, name, wflags)
{
	pWin->setCaption(name);

	view_back = new Q3HBox(pWin);
	view_back->setFrameStyle( Q3Frame::StyledPanel | Q3Frame::Sunken );
	
	initTool();
	initPlot();
	initVars();
	initActions();
	initToolBar();

	connect(this, SIGNAL(newMeasure(int)), SLOT(onNewMeasure(int)));
	//connect(this, SIGNAL(rmMeasure(int)), SLOT(onDelMeasure(int)));

	addNewMeasure(pDoc);
	pWin->show();
}
/**
  * Initialisiert die Komponenten der Anwendung
  */
AstroCalcApp::AstroCalcApp()
{
	CalcBib = new AstroCalcBib();

	QPixmap imageApp( ( const char** ) imageApp_data );
	setIcon( imageApp );	
	setCaption( tr( "AstroCalc" ));
	/* setCaption(tr("AstroCalc " VERSION)); */
	/* Fenster laesst sich dennoch verkleinern... Any hints ?! */
	setFixedSize( 400, 240 );
	
	///////////////////////////////////////////////////////////////////
	// call inits to invoke all other construction parts
  	initActions();
  	initMenuBar();
	initToolBar();
  	initMainLabel();
  	initStatusBar();
  	
  	viewToolBar->setOn(true);
  	viewStatusBar->setOn(true);
}
Beispiel #25
0
App::App(QWidget* parent) : QMainWindow(parent)
{
    _app = this;

    m_fileMenu = NULL;
    m_helpMenu = NULL;
    m_toolBar = NULL;

    m_copyChannel = NULL;

    setWindowTitle(App::longName());
    setWindowIcon(QIcon(":/qlcplus-fixtureeditor.png"));
    QMdiArea *mdiArea = new QMdiArea(this);
    mdiArea->setBackground(QBrush(QColor(0x60, 0x60, 0x60)));
    setCentralWidget(mdiArea);

    QCoreApplication::setOrganizationName("qlcplus");
    QCoreApplication::setOrganizationDomain("sf.net");
    QCoreApplication::setApplicationName(FXEDNAME);

    initActions();
    //initMenuBar();
    initToolBar();

    QSettings settings;
    QVariant var = settings.value(SETTINGS_GEOMETRY);
    if (var.isValid() == true)
        restoreGeometry(var.toByteArray());

    QVariant dir = settings.value(SETTINGS_WORKINGPATH);
    if (dir.isValid() == false || QDir(dir.toString()).exists() == false)
        m_workingDirectory = QLCFixtureDefCache::userDefinitionDirectory();
    else
        m_workingDirectory = QDir(dir.toString());


    this->raise();
}
Beispiel #26
0
FixtureManager::FixtureManager(QWidget* parent, Qt::WindowFlags flags)
	: QWidget(parent, flags)
{
	new QVBoxLayout(this);

	m_console = NULL;

	initActions();
	initToolBar();
	initDataView();
	updateView();

	/* To disable some actions when switching to operate mode */
	connect(_app, SIGNAL(modeChanged(App::Mode)),
		this, SLOT(slotModeChanged(App::Mode)));

	/* Listen to document changes */
	connect(_app, SIGNAL(documentChanged(Doc*)),
		this, SLOT(slotDocumentChanged(Doc*)));

	/* Listen to fixture additions/removals */
	slotDocumentChanged(_app->doc());
}
Beispiel #27
0
Freecell::Freecell(QWidget * parent, Qt::WFlags flags)
:  QMainWindow(parent, flags)
    , rotation(90)
{
    FILE *f;

    // create ~/.qfreecell  
    QDir d("/tmp");
    char buffer[200];

    // save location of binary
    d.cdUp();
    strcpy(game_directory, (d.path()).toLatin1().data());

    strcpy(directory, QDir::homePath().toLatin1().data());
    strcat(directory, "/.qfreecell");

    d.setPath(directory);
    if (!d.exists())            // create directories if not exists
    {
        printf("Creating ~/.qfreecell...\n");
        d.mkdir(directory);
        sprintf(buffer, "%s/protocols", directory);
    }
    //Init statistics

    pstatistics = new CStatistics(this, "", false);
    protocol_file = new QString();
    protocol_fd = NULL;

    // first set configuration to default   
    opt.empty_file = new char[200];
    opt.background_file = new char[200];
    opt.background_enabled = new bool;
    opt.background_color = new QColor(0, 128, 0);
    opt.num_freecells = new int;
    opt.spinbox_freecells_min = new int;

    // set picture filename of freecells
    strcpy(opt.empty_file, directory);
    strcat(opt.empty_file, "/freecells/");
    strcat(opt.empty_file, DEFAULT_FREECELL);

    // set background filename
    strcpy(opt.background_file, directory);
    strcat(opt.background_file, "/backgrounds/");
    strcat(opt.background_file, DEFAULT_BACKGROUND);

    // enable backgrounds
    *opt.background_enabled = true;

    // set number of free cells to 4
    *opt.num_freecells = 4;

    //////////////////////////////
    // now read configuration file

    sprintf(buffer, "%s/configuration", directory);
    f = fopen(buffer, "r");
    if (f != NULL) {
        unsigned int i;
        while (fgets(buffer, 200, f) != NULL) {
            i = 0;
            while (buffer[i++] != '\0')
                if (buffer[i - 1] == '\n')
                    buffer[i - 1] = '\0';
            for (i = 0; i < strlen(buffer); i++)
                if (buffer[i] == '=')
                    break;

            if (memcmp(buffer, "background picture", 18) == 0)
                strcpy(opt.background_file, buffer + i + 1);
            if (memcmp(buffer, "freecell", 8) == 0)
                strcpy(opt.empty_file, buffer + i + 1);
            if (memcmp(buffer, "background enabled", 18) == 0)
                if (buffer[i + 1] == '1')
                    *opt.background_enabled = true;
                else
                    *opt.background_enabled = false;
        }
        fclose(f);
    }
    ///////////////////////////////////////////////////////////////////
    // call inits to invoke all other construction parts
    initMenuBar();
    initToolBar();
    initStatusBar();

    initDoc();
    initView();

    slotFileNew();
}
Beispiel #28
0
//////////////////////////////////////////////////////////////////////
// Main initialization function                                     //
//                                                                  //
// This creates all items that are not saved in workspace files     //
//////////////////////////////////////////////////////////////////////
void App::init(QString openFile)
{
  //
  // Default size
  //
  resize(maximumSize());

  //
  // Settings has to be first
  //
  initSettings();

  //
  // Menus, toolbar, statusbar
  //
  initMenuBar();
  initStatusBar();
  initToolBar();

  //
  // The main view
  //
  initWorkspace();

  //
  // Plugins
  //
  initPlugins();

  //
  // Device classes
  //
  initDeviceClasses();

  //
  // Submasters & values
  //
  initSubmasters();
  initValues();

  //
  // Function consumer
  //
  initFunctionConsumer();

  //
  // Buses
  //
  Bus::init();

  //
  // Document
  //
  initDoc();

  //
  // Views
  //
  initDeviceManagerView();
  initVirtualConsole();


  // Trying to load workspace files
  // Either specified on command line or the last active workspace
  bool success = false;
  if (openFile != "")
    {
       success = doc()->loadWorkspaceAs(openFile);
       if (!success)
         {
            QString msg = "File: " + openFile + "\ncould'nt be opened. Please check path and spelling!\n";
	            msg += "We revert to the previously used workspace.";
	    QMessageBox::warning(this, KApplicationNameShort, msg,
			       QMessageBox::Ok, 0);
         }
    }
  //
  // Load the previous workspace
  //
  if (!success)
    {
      QString config;
      if (settings()->get(KEY_OPEN_LAST_WORKSPACE, config))
       {
         if (config == Settings::trueValue())
	  {
	    if (settings()->get(KEY_LAST_WORKSPACE_NAME, config))
	      {
	         success =  doc()->loadWorkspaceAs(config);
		 if (!success)
		   {
                      QString msg = "Previously used workspace file: " + config + "\ncould'nt be opened.";
	                      msg += "We start over with a new workspace.";
	              QMessageBox::warning(this, KApplicationNameShort, msg, QMessageBox::Ok, 0);
		   }
	      }
	  }
       }
    }
  if (!success)
    {
      newDocument();
    }
}
Beispiel #29
0
void App::init()
{
    QSettings settings;

    setWindowIcon(QIcon(":/qlcplus.png"));

    m_tab = new QTabWidget(this);
    m_tab->setTabPosition(QTabWidget::South);
    setCentralWidget(m_tab);

    QVariant var = settings.value(SETTINGS_GEOMETRY);
    if (var.isValid() == true)
    {
        this->restoreGeometry(var.toByteArray());
    }
    else
    {
        /* Application geometry and window state */
        QSize size = settings.value("/workspace/size").toSize();
        if (size.isValid() == true)
            resize(size);
        else
            resize(800, 600);

        QVariant state = settings.value("/workspace/state", Qt::WindowNoState);
        if (state.isValid() == true)
            setWindowState(Qt::WindowState(state.toInt()));
    }

    // The engine object
    initDoc();
    // Main view actions
    initActions();
    // Main tool bar
    initToolBar();

    // Create primary views.
    m_tab->setIconSize(QSize(24, 24));
    QWidget* w = new FixtureManager(m_tab, m_doc);
    m_tab->addTab(w, QIcon(":/fixture.png"), tr("Fixtures"));
    w = new FunctionManager(m_tab, m_doc);
    m_tab->addTab(w, QIcon(":/function.png"), tr("Functions"));
    w = new ShowManager(m_tab, m_doc);
    m_tab->addTab(w, QIcon(":/show.png"), tr("Shows"));
    w = new VirtualConsole(m_tab, m_doc);
    m_tab->addTab(w, QIcon(":/virtualconsole.png"), tr("Virtual Console"));
    w = new SimpleDesk(m_tab, m_doc);
    m_tab->addTab(w, QIcon(":/slidermatrix.png"), tr("Simple Desk"));
    w = new InputOutputManager(m_tab, m_doc);
    m_tab->addTab(w, QIcon(":/input_output.png"), tr("Inputs/Outputs"));

    // Listen to blackout changes and toggle m_controlBlackoutAction
    connect(m_doc->outputMap(), SIGNAL(blackoutChanged(bool)), this, SLOT(slotBlackoutChanged(bool)));

    // Enable/Disable panic button
    connect(m_doc->masterTimer(), SIGNAL(functionListChanged()), this, SLOT(slotRunningFunctionsChanged()));
    slotRunningFunctionsChanged();

    // Start up in non-modified state
    m_doc->resetModified();
}
Beispiel #30
0
void App::init()
{
    QSettings settings;

    setWindowIcon(QIcon(":/qlcplus.png"));

    m_tab = new QTabWidget(this);
    m_tab->setTabPosition(QTabWidget::South);
    setCentralWidget(m_tab);

    QLCFile::checkRaspberry();

    QVariant var = settings.value(SETTINGS_GEOMETRY);
    if (var.isValid() == true)
    {
        this->restoreGeometry(var.toByteArray());
    }
    else
    {
        /* Application geometry and window state */
        QSize size = settings.value("/workspace/size").toSize();
        if (size.isValid() == true)
            resize(size);
        else
        {
            if (QLCFile::isRaspberry())
            {
                QRect geometry = qApp->desktop()->availableGeometry();
                if (m_noGui == true)
                {
                    setGeometry(geometry.width(), geometry.height(), 1, 1);
                }
                else
                {
                    int w = geometry.width();
                    int h = geometry.height();
                    if (m_overscan == true)
                    {
                        // if we're on a Raspberry Pi, introduce a 5% margin
                        w = (float)geometry.width() * 0.95;
                        h = (float)geometry.height() * 0.95;
                    }
                    setGeometry((geometry.width() - w) / 2, (geometry.height() - h) / 2,
                                w, h);
                }
            }
            else
                resize(800, 600);
        }

        QVariant state = settings.value("/workspace/state", Qt::WindowNoState);
        if (state.isValid() == true)
            setWindowState(Qt::WindowState(state.toInt()));
    }

    QVariant dir = settings.value(SETTINGS_WORKINGPATH);
    if (dir.isValid() == true)
        m_workingDirectory = QDir(dir.toString());

    // The engine object
    initDoc();
    // Main view actions
    initActions();
    // Main tool bar
    initToolBar();

    m_dumpProperties = new DmxDumpFactoryProperties(KUniverseCount);

    // Create primary views.
    m_tab->setIconSize(QSize(24, 24));
    QWidget* w = new FixtureManager(m_tab, m_doc);
    m_tab->addTab(w, QIcon(":/fixture.png"), tr("Fixtures"));
    w = new FunctionManager(m_tab, m_doc);
    m_tab->addTab(w, QIcon(":/function.png"), tr("Functions"));
    w = new ShowManager(m_tab, m_doc);
    m_tab->addTab(w, QIcon(":/show.png"), tr("Shows"));
    w = new VirtualConsole(m_tab, m_doc);
    m_tab->addTab(w, QIcon(":/virtualconsole.png"), tr("Virtual Console"));
    w = new SimpleDesk(m_tab, m_doc);
    m_tab->addTab(w, QIcon(":/slidermatrix.png"), tr("Simple Desk"));
    w = new InputOutputManager(m_tab, m_doc);
    m_tab->addTab(w, QIcon(":/input_output.png"), tr("Inputs/Outputs"));

    // Listen to blackout changes and toggle m_controlBlackoutAction
    connect(m_doc->inputOutputMap(), SIGNAL(blackoutChanged(bool)), this, SLOT(slotBlackoutChanged(bool)));

    // Listen to DMX value changes and update each Fixture values array
    connect(m_doc->inputOutputMap(), SIGNAL(universesWritten(int, const QByteArray&)),
            this, SLOT(slotUniversesWritten(int, const QByteArray&)));

    // Enable/Disable panic button
    connect(m_doc->masterTimer(), SIGNAL(functionListChanged()), this, SLOT(slotRunningFunctionsChanged()));
    slotRunningFunctionsChanged();

    // Start up in non-modified state
    m_doc->resetModified();

    QString ssDir;

#if defined(WIN32) || defined(Q_OS_WIN)
    /* User's input profile directory on Windows */
    LPTSTR home = (LPTSTR) malloc(256 * sizeof(TCHAR));
    GetEnvironmentVariable(TEXT("UserProfile"), home, 256);
    ssDir = QString("%1/%2").arg(QString::fromUtf16(reinterpret_cast<ushort*> (home)))
                            .arg(USERQLCPLUSDIR);
    free(home);
    HotPlugMonitor::setWinId(winId());
#else
    /* User's input profile directory on *NIX systems */
    ssDir = QString("%1/%2").arg(getenv("HOME")).arg(USERQLCPLUSDIR);
#endif

    QFile ssFile(ssDir + QDir::separator() + "qlcplusStyle.qss");
    if (ssFile.exists() == true)
    {
        ssFile.open(QFile::ReadOnly);
        QString styleSheet = QLatin1String(ssFile.readAll());
        this->setStyleSheet(styleSheet);
    }

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
    m_videoProvider = new VideoProvider(m_doc, this);
#endif
}