JobHistoryView::~JobHistoryView()
{
	IniConfig & ini = userConfig();
	ini.pushSection( "JobHistoryView" );
	//saveTreeView( ini, job_history_columns );
	ini.popSection();
}
Example #2
0
void saveAssetTree( RecordTreeView * lv )
{
  IniConfig & cfg = userConfig();
  cfg.pushSection( "BachAssetList" );
  lv->saveTreeView(cfg,AssetColumns);
  cfg.popSection();
}
//-------------------------------------------------------------------------------------------------
void BachKeywordView::saveState()
{
	IniConfig & cfg = userConfig();
	cfg.pushSection( "BachKeywordView" );
	saveTreeView( cfg,KeywordColumns );
	cfg.popSection();
}
Example #4
0
bool LoadMenuSetup(int user_number) {
  if (!pSecondUserRec) {
    MenuSysopLog("Mem Error");
    return false;
  }
  UnloadMenuSetup();

  if (!user_number) {
    return false;
  }
  File userConfig(syscfg.datadir, CONFIG_USR);
  if (!userConfig.Exists()) {
    return false;
  }
  WUser user;
  application()->users()->ReadUser(&user, user_number);
  if (userConfig.Open(File::modeReadOnly | File::modeBinary)) {
    userConfig.Seek(user_number * sizeof(user_config), File::seekBegin);

    int len = userConfig.Read(pSecondUserRec, sizeof(user_config));
    userConfig.Close();

    if (len != sizeof(user_config) || !IsEqualsIgnoreCase(reinterpret_cast<char*>(pSecondUserRec->name), user.GetName())) {
      memset(pSecondUserRec, 0, sizeof(user_config));
      strcpy(reinterpret_cast<char*>(pSecondUserRec->name), user.GetName());
      return 0;
    }
    nSecondUserRecLoaded = user_number;
    return true;
  }
  return false;
}
Example #5
0
void MainWindow::closeEvent( QCloseEvent * ce )
{
    IniConfig & cfg = userConfig();
    cfg.pushSection( "MainWindow" );
    cfg.writeString( "FrameGeometry", QString("%1,%2,%3,%4").arg( pos().x() ).arg( pos().y() ).arg( size().width() ).arg( size().height() ) );
    cfg.popSection();
    QMainWindow::closeEvent(ce);
}
void ViewColors::readColors()
{
	IniConfig & c = userConfig();
	c.pushSection( mViewName );
	for( int i=0; i<mColors.size(); i++ )
	{
		ColorOption & co = mColors[i];
		co.fg = c.readColor( co.role + "fg", co.fg );
		co.bg = c.readColor( co.role + "bg", co.bg );
	}
	c.popSection();
}
void JobHistoryView::setupModel()
{
    if( !mModel ) {
        mModel = new RecordSuperModel(this);
        RecordDataTranslator * rdt = new RecordDataTranslator(mModel->treeBuilder());
        rdt->setRecordColumnList(QStringList() << "key" << "fkeyjob" << "fkeyhost" << "message" << "fkeyuser" << "created");
        setModel( mModel );
        IniConfig & ini = userConfig();
        ini.pushSection( "JobHistoryView" );
        setupTreeView( ini, job_history_columns );
        ini.popSection();
    }
}
Example #8
0
/*!
    Saves any changes to the profile and character sets it contains.

    Note that any changes to the character sets are stored separately
    to the system character sets.  This allows the user to revert
    back to a system character using the handwriting settings application.
*/
void QIMPenProfile::save() const
{
    QSettings usrConfig("Trolltech",userConfig());
    usrConfig.beginGroup("Settings");
    usrConfig.setValue("MultiTimeout", msTimeout);

    if (tstyle)
        usrConfig.setValue("Style", pstyle == BothCases ? "BothCases" : "ToggleCases" );
    if (istyle)
        usrConfig.setValue("IgnoreTimeout", isTimeout);

    // each set knows if its modified.
    if (!sets.isEmpty())
        saveData();
}
Example #9
0
void QIMPenProfile::load()
{
#ifndef QT_NO_TRANSLATION
    static int translation_installed = 0;
    if (!translation_installed) {
        QtopiaApplication::loadTranslations("libqmstroke");
        translation_installed++;
    }
#endif

    QTranslatableSettings config(filename, QSettings::IniFormat);
    config.beginGroup( "Handwriting" );

    pname = config.value( "Name" ).toString();
    pdesc = config.value( "Description" ).toString();

    tstyle = config.value( "CanSelectStyle", false ).toBool();
    istyle = config.value( "CanIgnoreStroke", false ).toBool();

    config.endGroup();

    config.beginGroup( "Settings" );

    pstyle = BothCases;
    QString s = config.value( "Style", "BothCases" ).toString();
    if ( s == "ToggleCases" )
        pstyle = ToggleCases;

    msTimeout = config.value( "MultiTimeout", 500 ).toInt();
    isTimeout = config.value( "IgnoreTimeout", 200 ).toInt();

    // Read user configuration
    QSettings usrConfig("Trolltech",userConfig());
    usrConfig.beginGroup( "Settings" );
    msTimeout = usrConfig.value( "MultiTimeout", msTimeout ).toInt();

    if ( tstyle && usrConfig.contains( "Style" ) ) {
        pstyle = BothCases;
        QString s = usrConfig.value( "Style", "BothCases" ).toString();
        if ( s == "ToggleCases" )
            pstyle = ToggleCases;
    }
    if ( istyle && usrConfig.contains( "IgnoreTimeout" ) ) {
        isTimeout = usrConfig.value( "IgnoreTimeout", isTimeout ).toInt();
    }
}
Example #10
0
void WriteMenuSetup(int user_number) {
  if (!user_number) {
    return;
  }

  WUser user;
  application()->users()->ReadUser(&user, user_number);
  strcpy(pSecondUserRec->name, user.GetName());

  File userConfig(syscfg.datadir, CONFIG_USR);
  if (!userConfig.Open(File::modeReadWrite | File::modeBinary | File::modeCreateFile)) {
    return;
  }

  userConfig.Seek(user_number * sizeof(user_config), File::seekBegin);
  userConfig.Write(pSecondUserRec, sizeof(user_config));
  userConfig.Close();
}
Example #11
0
int main( int argc, char * argv[] )
{
	int result=0;

#ifdef Q_OS_WIN
	hMutex = CreateMutex( NULL, true, L"FreezerSingleProcessMutex");
	if (hMutex == NULL) {
		LOG_5( "Error: Couldn't create mutex, exiting" );
		return false;
	}
	if( GetLastError() == ERROR_ALREADY_EXISTS ) {
		LOG_5( "Error: Another process owns the mutex, exiting" );
		QList<int> pids;
		if( pidsByName( "freezer.exe", &pids ) ) {
			int otherProcessId = pids[0];
			if( otherProcessId == processID() ) {
				if( pids.size() < 2 )
					return false;
				otherProcessId = pids[1];
			}
			LOG_5( "Trying to find window with process pid of " + QString::number( otherProcessId ) );
			EnumWindows( AFEnumWindowsProc, LPARAM(otherProcessId) );
		}
		return false;
	}

	QLibrary excdll( "exchndl.dll" );
	if( !excdll.load() ) {
		qWarning( excdll.errorString().toLatin1().constData() );
	}
	disableWindowsErrorReporting( "assburner.exe" );

#endif

    signal(SIGSEGV, oops_handler);
    signal(SIGABRT, oops_handler);
	QApplication a(argc, argv);

    if( !initConfig( "freezer.ini" ) ) {
#ifndef Q_OS_WIN
        // Fallback if the config file does not exist in the current folder
        if( !initConfig( "/etc/ab/freezer.ini" ) )
#endif
        return -1;
    }

#ifdef Q_OS_WIN
	QString cp = "h:/public/" + getUserName() + "/Blur";
	if( !QDir( cp ).exists() )
		cp = "C:/Documents and Settings/" + getUserName();
	initUserConfig( cp + "/freezer.ini" );
#else
	initUserConfig( QDir::homePath() + "/.freezer" );
#endif

    initStone( argc, argv );
    classes_loader();
    initStoneGui();
	{
		JobList showJobs;
		bool showTime = false;
        QString currentView;
        QStringList loadViewFiles;

		for( int i = 1; i<argc; i++ ){
			QString arg( argv[i] );
			if( arg == "-h" || arg == "--help" )
			{
				LOG_1( QString("Freezer v") + VERSION );
				LOG_1( "Options:" );
				LOG_1( "-current-render" );
				LOG_1( "\tShow the current job that is rendering on this machine\n" );
				LOG_1( "-show-time" );
				LOG_1( "\tOutputs summary of time executed for all sql statement at program close\n" );
				LOG_1( "-user USER" );
				LOG_1( "\tSet the logged in user to USER: Requires Admin Privs" );
				LOG_1( "-current-view VIEWNAME" );
				LOG_1( "\tMake VIEWNAME the active view, once they are all loaded" );
				LOG_1( "-load-view FILE" );
				LOG_1( "\tRead a saved view config from FILE" );
				LOG_1( stoneOptionsHelp() );
				return 0;
			}
			else if( arg.endsWith("-show-time") )
				showTime = true;
			else if( arg.endsWith( "-current-render" ) ) {
				showJobs = Host::currentHost().activeAssignments().jobs();
			}
			else if( arg.endsWith("-user") && (i+1 < argc) ) {
				QString impersonate( argv[++i] );
				if( User::hasPerms( "User", true ) ) // If you can edit users, you can login as anyone
					User::setCurrentUser( impersonate );
			}
            else if( arg.endsWith("-current-view") && (i+1 < argc) ) {
				currentView = QString( argv[++i] );
            }
            else if( arg.endsWith("-load-view") && (i+1 < argc) ) {
                loadViewFiles << QString(argv[++i]);
            }
		}

		// Share the database across threads, each with their own connection
		FreezerCore::setDatabaseForThread( classesDb(), Connection::createFromIni( config(), "Database" ) );
		
		{
            loadPythonPlugins();
			MainWindow m;
			IniConfig & cfg = userConfig();
			cfg.pushSection( "MainWindow" );
			QStringList fg = cfg.readString( "FrameGeometry", "" ).split(',');
			cfg.popSection();
			if( fg.size()==4 ) {
				m.resize( QSize( fg[2].toInt(), fg[3].toInt() ) );
				m.move( QPoint( fg[0].toInt(), fg[1].toInt() ) );
			}
			if( showJobs.size() )
				m.jobPage()->setJobList( showJobs );
            foreach( QString viewFile, loadViewFiles )
                m.loadViewFromFile( viewFile );
            if( !currentView.isEmpty() )
                m.setCurrentView( currentView );
			m.show();
			result = a.exec();
			if( showTime ){
				Database * tm = Database::current();
				LOG_5( 			"                  Sql Time Elapsed" );
				LOG_5(			"|   Select  |   Update  |  Insert  |  Delete  |  Total  |" );
				LOG_5( 			"-----------------------------------------------" );
				LOG_5( QString(	"|     %1    |     %2    |    %3    |    %4    |    %5   |\n")
					.arg( tm->elapsedSqlTime( Table::SqlSelect ) )
					.arg( tm->elapsedSqlTime( Table::SqlUpdate ) )
					.arg( tm->elapsedSqlTime( Table::SqlInsert ) )
					.arg( tm->elapsedSqlTime( Table::SqlDelete ) )
					.arg( tm->elapsedSqlTime() )
				);
				LOG_5( 			"                  Index Time Elapsed" );
				LOG_5(			"|   Added  |   Updated  |  Incoming  |  Deleted  |  Search  |  Total  |" );
				LOG_5( 			"-----------------------------------------------" );
				LOG_5( QString(	"|     %1     |     %2    |    %3    |    %4   |    %5    |   %6    |\n")
					.arg( tm->elapsedIndexTime( Table::IndexAdded ) )
					.arg( tm->elapsedIndexTime( Table::IndexUpdated ) )
					.arg( tm->elapsedIndexTime( Table::IndexIncoming ) )
					.arg( tm->elapsedIndexTime( Table::IndexRemoved ) )
					.arg( tm->elapsedIndexTime( Table::IndexSearch ) )
					.arg( tm->elapsedIndexTime() )
				);
				tm->printStats();
			}
		}
	}
	shutdown();
#ifdef Q_OS_WIN
	CloseHandle( hMutex );
#endif
	return result;
}