Example #1
0
void MountTray::slotOpenSettings(){
  //Stop the refresh timer on the watcher
  diskWatcher->stop();
  //Open up the settings window and apply changes as necessary
  SettingsDialog *sdlg = new SettingsDialog();
  sdlg->useDiskWatcher = useDiskWatcher;
  sdlg->useDiskAutoTimer = useDiskTimerDevd;
  sdlg->diskRefreshMS = diskTimerMaxMS;
  sdlg->useAutoPlay = useAutoPlay;
  sdlg->showDialog();
  //Now parse the output and save if necessary
  if(sdlg->SettingsChanged){
    useDiskWatcher = sdlg->useDiskWatcher;
    useDiskTimerDevd = sdlg->useDiskAutoTimer;
    diskTimerMaxMS = sdlg->diskRefreshMS;
    useAutoPlay = sdlg->useAutoPlay;
    for(int i=0; i<DEVLIST.length(); i++){
      DEVLIST[i]->setAutoPlay(useAutoPlay);
    }
    qDebug() << "INFO: Saving updated settings to file";
    saveCurrentSettings(); //update the saved settings
  }
  //Now restart the disk watcher if enabled
  if(useDiskWatcher){ diskWatcher->start(diskTimerMaxMS); }
}
	void onButtonB(Gwen::Controls::Base* pControl)
	{
		Gwen::Controls::Label* label = (Gwen::Controls::Label*) pControl;
		Gwen::UnicodeString la = label->GetText();// node->GetButton()->GetName();// GetText();
		Gwen::String laa = Gwen::Utility::UnicodeToString(la);
		//const char* ha = laa.c_str();

		
		selectDemo(sCurrentHightlighted);
		saveCurrentSettings(sCurrentDemoIndex, startFileName);
	}
Example #3
0
ConfigManager::ConfigManager(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ConfigManager)
{
    ui->setupUi(this);

    setWindowFlags(Qt::Window |
                   Qt::WindowTitleHint |
                   Qt::WindowCloseButtonHint |
                   Qt::WindowStaysOnTopHint);

    setGeometry(QStyle::alignedRect(Qt::LeftToRight,
                                    Qt::AlignCenter,
                                    size(),
                                    qApp->desktop()->availableGeometry()));

    #ifdef Q_OS_MAC
    this->setWindowIcon(QIcon(":/cat_builder.icns"));
    ui->frame->setAutoFillBackground(false);
    ui->frame->setFrameShape(QFrame::NoFrame);
    ui->frame->setLineWidth(0);
    #endif
    #ifdef Q_OS_WIN
    this->setWindowIcon(QIcon(":/cat_builder.ico"));

    if(QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA)
    {
        if(QtWin::isCompositionEnabled())
        {
            this->setAttribute(Qt::WA_TranslucentBackground, true);
            QtWin::extendFrameIntoClientArea(this, -1, -1, -1, 1);
            QtWin::enableBlurBehindWindow(this);
        }
        else
        {
            QtWin::resetExtendedFrame(this);
            setAttribute(Qt::WA_TranslucentBackground, false);
        }
    }
    #endif

    connect(ui->configList, SIGNAL(clicked(QModelIndex)), ui->configList, SLOT(update()));
    connect(this, SIGNAL(accepted()), this, SLOT(saveCurrentSettings()));

    m_currentConfig = "";
    m_themePackName = "";
    m_doAskAgain    = false;
    loadConfigPackList();
}
	void onButtonD(Gwen::Controls::Base* pControl)
	{
/*		Gwen::Controls::Label* label = (Gwen::Controls::Label*) pControl;
		Gwen::UnicodeString la = label->GetText();// node->GetButton()->GetName();// GetText();
		Gwen::String laa = Gwen::Utility::UnicodeToString(la);
		const char* ha = laa.c_str();
		*/

	//	printf("onKeyReturn ! \n");
		if (!gDisableDemoSelection )
		{
			selectDemo(sCurrentHightlighted);
			saveCurrentSettings(sCurrentDemoIndex, startFileName);
		}

	}
void	MyComboBoxCallback(int comboId, const char* item)
{
	//printf("comboId = %d, item = %s\n",comboId, item);
	if (comboId==DEMO_SELECTION_COMBOBOX)
	{
		//find selected item
		for (int i=0;i<allNames.size();i++)
		{
			if (strcmp(item,allNames[i])==0)
			{
				selectDemo(i);
				saveCurrentSettings(sCurrentDemoIndex,startFileName);
				break;
			}
		}
	}

}
Example #6
0
void MountTray::loadSavedSettings(){
  //The saved settings file
  QString filename = QDir::homePath()+"/.mounttray.settings";
  //Set the defaults
  useDiskWatcher=true; useDiskTimerDevd=true;
  diskTimerMaxMS=3600000; //1 hour refresh timer
  useAutoPlay = true;
  //Now load the file
  QFile file(filename);
  if(file.exists()){
    if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ 
      qDebug() << "-Could not open settings file: using defaults";
      return; 
    }
    QTextStream in(&file);
    while(!in.atEnd()){
      QString line = in.readLine();
      if(!line.startsWith("#")){ //skip comment lines
        QString var = line.section(")",0,0,QString::SectionSkipEmpty).simplified();
        QString val = line.section(")",1,30,QString::SectionSkipEmpty).simplified();
        if(var=="UseDiskSpaceMonitoring"){ 
          if(val.toLower() == "true"){ useDiskWatcher = true;}
          else{ useDiskWatcher = false; }
        }else if(var=="UseDiskSpaceDevdTiming"){
          if(val.toLower() == "true"){ useDiskTimerDevd = true;}
          else{ useDiskTimerDevd = false; }	
        }else if(var=="DiskSpaceTimingMaxMilliseconds"){
          diskTimerMaxMS = val.toInt();	
        }else if(var=="AutoPlay"){
	  useAutoPlay = (val.toLower()=="true");
	}
      }
    }
    file.close();
  }else{
    qDebug() << "-Creating new settings file with defaults";
    saveCurrentSettings();
  }
}