예제 #1
0
파일: setup.cpp 프로젝트: icefox/kinkatta
void setup::saveProfile(const QString &user, const QString &profile){
	if(user.isEmpty() || user == QString("<new user>"))
		return;

  QString settingsFileXml = KINKATTA_DIR;
  settingsFileXml += user.lower();
  settingsFileXml += ".xml";

	Preferences prefs(settingsFileXml, QString("kinkatta user prefs"), QString("1.0"));

	prefs.setGroup("profile");
	prefs.setCDATA("profile", profile);

	prefs.flush();

}
예제 #2
0
void UserInterface::loginResult(bool success, std::string const & info)
{
    enableMenuItem(UserInterface::menuLogin, !success);
    enableMenuItem(UserInterface::menuJoinChannel, success);
    enableMenuItem(UserInterface::menuChannels, success);

    if (success)
    {
        char * val;
        prefs().get(PrefAutoJoinChannels, val, "");
        autoJoinChannels(val);
        ::free(val);

        checkAway(this);
    }
}
예제 #3
0
int prefChanged(const char *aPref, void *aClosure)
{
  nsDeviceContextOS2 *context = (nsDeviceContextOS2*)aClosure;
  nsresult rv;
  
  if (nsCRT::strcmp(aPref, "layout.css.dpi")==0) {
    PRInt32 dpi;
    nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
    rv = prefs->GetIntPref(aPref, &dpi);
    if (NS_SUCCEEDED(rv))
      context->SetDPI(dpi);

  }
  
  return 0;
}
nsresult
nsMsgAccount::getPrefService()
{
  if (m_prefs)
    return NS_OK;

  nsresult rv;
  NS_ENSURE_FALSE(m_accountKey.IsEmpty(), NS_ERROR_NOT_INITIALIZED);
  nsCOMPtr<nsIPrefService> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
  NS_ENSURE_SUCCESS(rv, rv);

  nsAutoCString accountRoot("mail.account.");
  accountRoot.Append(m_accountKey);
  accountRoot.Append('.');
  return prefs->GetBranch(accountRoot.get(), getter_AddRefs(m_prefs));
}
예제 #5
0
Magnify_Dialog::Magnify_Dialog() :
    Dialog("Magnify"),
    _view        (0),
    _zoom        (ZOOM_200),
    _widget      (0),
    _zoom_widget (0),
    _close_widget(0)
{
    // Create widgets.

    _widget = new Magnify_Widget;

    _zoom_widget = new Choice_Widget(label_zoom());

    _close_widget = new Push_Button(label_close);

    // Layout.

    Vertical_Layout * layout = new Vertical_Layout(this);

    layout->add(_widget);
    layout->stretch(_widget);

    Horizontal_Layout * layout_h = new Horizontal_Layout(layout);
    layout_h->margin(0);
    layout_h->add(_zoom_widget);
    layout_h->add_spacer(-1, true);
    layout_h->add(_close_widget);
    layout_h->add_spacer(Layout::window_handle_size());

    // Preferences.

    Prefs prefs(Prefs::prefs(), "magnify_dialog");
    Prefs::get_(&prefs, "zoom", &_zoom);

    // Initialize.

    widget_update();

    size(Vector_Util::max(size_hint(), V2i(300, 300)));

    // Callbacks.

    _zoom_widget->signal.set(this, zoom_callback);

    _close_widget->signal.set(this, close_callback);
}
예제 #6
0
static void
AppendGenericFontFromPref(nsString& aFonts, nsIAtom *aLangGroup, const char *aGenericName)
{
    nsresult rv;

    nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
    if (!prefs)
        return;

    nsCAutoString prefName, langGroupString;
    nsXPIDLCString nameValue, nameListValue;

    aLangGroup->ToUTF8String(langGroupString);

    nsCAutoString genericDotLang;
    if (aGenericName) {
        genericDotLang.Assign(aGenericName);
    } else {
        prefName.AssignLiteral("font.default.");
        prefName.Append(langGroupString);
        prefs->GetCharPref(prefName.get(), getter_Copies(genericDotLang));
    }

    genericDotLang.AppendLiteral(".");
    genericDotLang.Append(langGroupString);

    // fetch font.name.xxx value                   
    prefName.AssignLiteral("font.name.");
    prefName.Append(genericDotLang);
    rv = prefs->GetCharPref(prefName.get(), getter_Copies(nameValue));
    if (NS_SUCCEEDED(rv)) {
        if (!aFonts.IsEmpty())
            aFonts.AppendLiteral(", ");
        aFonts.Append(NS_ConvertUTF8toUTF16(nameValue));
    }

    // fetch font.name-list.xxx value                   
    prefName.AssignLiteral("font.name-list.");
    prefName.Append(genericDotLang);
    rv = prefs->GetCharPref(prefName.get(), getter_Copies(nameListValue));
    if (NS_SUCCEEDED(rv) && !nameListValue.Equals(nameValue)) {
        if (!aFonts.IsEmpty())
            aFonts.AppendLiteral(", ");
        aFonts.Append(NS_ConvertUTF8toUTF16(nameListValue));
    }
}
예제 #7
0
nsresult nsIDNService::Init()
{
  nsCOMPtr<nsIPrefService> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
  if (prefs)
    prefs->GetBranch(NS_NET_PREF_IDNWHITELIST, getter_AddRefs(mIDNWhitelistPrefBranch));

  nsCOMPtr<nsIPrefBranch2> prefInternal(do_QueryInterface(prefs));
  if (prefInternal) {
    prefInternal->AddObserver(NS_NET_PREF_IDNTESTBED, this, PR_TRUE); 
    prefInternal->AddObserver(NS_NET_PREF_IDNPREFIX, this, PR_TRUE); 
    prefInternal->AddObserver(NS_NET_PREF_IDNBLACKLIST, this, PR_TRUE);
    prefInternal->AddObserver(NS_NET_PREF_SHOWPUNYCODE, this, PR_TRUE);
    prefsChanged(prefInternal, nsnull);
  }

  return NS_OK;
}
예제 #8
0
파일: setup.cpp 프로젝트: icefox/kinkatta
void setup::savePassword(const QString &user, const QString &password){
	if(user.isEmpty() || (user == QString("<new user>")) || password.isEmpty())
		return;

	QString crypted = cryptPassword(password);

  QString settingsFileXml = KINKATTA_DIR;
  settingsFileXml += user.lower();
  settingsFileXml += ".xml";

	Preferences prefs(settingsFileXml, QString("kinkatta user prefs"), QString("1.0"));

	prefs.setGroup("password");
	prefs.setCDATA("password", crypted);

	prefs.flush();
}
예제 #9
0
int main(int argc, char* argv[])
{
    QApplication qapp(argc, argv);
    Composite::Main::MainWidget mainwin(argc, argv);

    QPalette pal = Composite::Looks::create_default_palette();
    qapp.setPalette(pal);

    // Set up audio engine
    Tritium::Logger::create_instance();
    Tritium::Logger::get_instance()->set_logging_level( "Debug" );
    Tritium::T<Tritium::Preferences>::shared_ptr prefs( new Tritium::Preferences() );
    Tritium::Engine engine(prefs);

    /////////////////////////////////////////////
    // Temporary code to get GMkit loaded
    /////////////////////////////////////////////
    {
	Tritium::LocalFileMng loc( &engine );
	QString gmkit;
	std::vector<QString>::iterator it;
	std::vector<QString> list;
	list = loc.getSystemDrumkitList();
	for( it = list.begin() ; it < list.end() ; ++it ) {
	    if( (*it).endsWith("GMkit") ) {
		gmkit = *it;
	    }
	    break;
	}
	assert( ! gmkit.isNull() );
	Tritium::T<Tritium::Drumkit>::shared_ptr dk = loc.loadDrumkit( gmkit );
	assert( dk );
	engine.loadDrumkit( dk );
    }

    /////////////////////////////////////////////
    // End of temporary code
    /////////////////////////////////////////////

    mainwin.set_audio_engine( &engine );

    mainwin.show();

    return qapp.exec();
}
예제 #10
0
void
QtShanoirSettings::update()
{
    QFile ini(d->iniFile);
    ini.remove();
    QSettings prefs(d->iniFile, QSettings::IniFormat);
    prefs.beginGroup("User");
    prefs.setValue("login", d->login);
    prefs.setValue("password", d->password);
    prefs.endGroup();
    prefs.beginGroup("Server");
    prefs.setValue("host", d->host);
    prefs.setValue("port", d->port);
    prefs.endGroup();
    prefs.beginGroup("Security");
    prefs.setValue("truststore", d->truststore);
    prefs.endGroup();
}
예제 #11
0
void runConflictRefinerPartition(IloCP cp, IloConstraintArray cts) {     
  IloEnv env = cp.getEnv();
  IloInt n = cts.getSize();
  IloNumArray prefs(env, n);   
  IloInt i;  
  for (i=0; i<n; ++i) {
    prefs[i]=1.0; // Normal preference
  }
  while (cp.refineConflict(cts, prefs)) {
    cp.writeConflict(cp.out());
    for (i=0; i<n; ++i) {
      if (cp.getConflict(cts[i])==IloCP::ConflictMember) {
        prefs[i]=-1.0; // Next run will ignore constraints of the current conflict
      }
    }
  }
  prefs.end();
}
예제 #12
0
NS_IMETHODIMP
nsMacShellService::GetShouldCheckDefaultBrowser(bool* aResult)
{
  // If we've already checked, the browser has been started and this is a 
  // new window open, and we don't want to check again.
  if (mCheckedThisSession) {
    *aResult = false;
    return NS_OK;
  }

  nsresult rv;
  nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
  if (NS_FAILED(rv)) {
    return rv;
  }

  return prefs->GetBoolPref(PREF_CHECKDEFAULTBROWSER, aResult);
}
예제 #13
0
void UserInterface::autoJoinChannels(std::string const & text)
{
    std::vector<std::string> channels;

    namespace ba = boost::algorithm;
    ba::split( channels, text, ba::is_any_of("\n "), ba::token_compress_on );

    std::ostringstream oss;
    for (auto & v : channels)
    {
        if (!v.empty())
        {
            oss << v << " ";
            model_.joinChannel(v);
        }
    }
    prefs().set(PrefAutoJoinChannels, oss.str().c_str());
}
예제 #14
0
void wxStEditApp::CreateShell()
{
    wxDialog dialog(m_frame, wxID_ANY, wxT("wxSTEditorShell"),
                    wxDefaultPosition, wxDefaultSize,
                    wxDEFAULT_DIALOG_STYLE_RESIZE);
    wxSTEditorShell* shell = new wxSTEditorShell(&dialog, wxID_ANY);
    // Set the styles and langs to those of the frame (not necessary, but nice)
    // The prefs aren't shared since we want to control the look and feel.
    wxSTEditorPrefs prefs(true);
    prefs.SetPrefInt(STE_PREF_INDENT_GUIDES, 0);
    prefs.SetPrefInt(STE_PREF_EDGE_MODE, wxSTC_EDGE_NONE);
    prefs.SetPrefInt(STE_PREF_VIEW_LINEMARGIN, 0);
    prefs.SetPrefInt(STE_PREF_VIEW_MARKERMARGIN, 1);
    prefs.SetPrefInt(STE_PREF_VIEW_FOLDMARGIN, 0);
    shell->RegisterPrefs(prefs);
    shell->RegisterStyles(m_frame->GetOptions().GetEditorStyles());
    shell->RegisterLangs(m_frame->GetOptions().GetEditorLangs());
    shell->SetLanguage(STE_LANG_PYTHON); // arbitrarily set to python

    shell->BeginWriteable();
    shell->AppendText(_("Welcome to a test of the wxSTEditorShell.\n\n"));
    shell->AppendText(_("This simple test merely responds to the wxEVT_STESHELL_ENTER\n"));
    shell->AppendText(_("events and prints the contents of the line when you press enter.\n\n"));
    shell->AppendText(_("For demo purposes, the shell understands these simple commands.\n"));
    shell->AppendText(_(" SetMaxHistoryLines num : set the number of lines in history buffer\n"));
    shell->AppendText(_(" SetMaxLines num [overflow=2000] : set the number of lines displayed\n"));
    shell->AppendText(_("   and optionally the number of lines to overflow before deleting\n"));
    shell->AppendText(_(" Quit : quit the wxSTEditorShell demo\n"));
    shell->CheckPrompt(true); // add prompt
    shell->EndWriteable();

    shell->Connect(wxID_ANY, wxEVT_STESHELL_ENTER,
                   wxSTEditorEventHandler(wxStEditApp::OnSTEShellEvent), NULL, this);

    int width = shell->TextWidth(wxSTC_STYLE_DEFAULT,
                                 wxT(" SetMaxHistoryLines num : set the number of lines in history buffer  "));
    dialog.SetSize(width + 30, wxDefaultCoord);

    wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL );
    topSizer->Add(shell, 1, wxEXPAND);
    dialog.SetSizer(topSizer);
    dialog.ShowModal();
}
예제 #15
0
void
QtShanoirSettings::loadSettings()
{
    if (!QFile(d->iniFile).exists())
        this->initializeSettings();
    else {
        QSettings prefs(d->iniFile, QSettings::IniFormat);
        prefs.beginGroup("User");
        d->login = prefs.value("login").toString();
        d->password = prefs.value("password").toString();
        prefs.endGroup();
        prefs.beginGroup("Server");
        d->host = prefs.value("host").toString();
        d->port = prefs.value("port").toString();
        prefs.endGroup();
        prefs.beginGroup("Security");
        d->truststore = prefs.value("truststore").toString();
        prefs.endGroup();
    }
}
예제 #16
0
파일: setup.cpp 프로젝트: icefox/kinkatta
QString setup::readPassword(const QString &user){
	//qDebug("::readPassword %s\n", user.latin1());

	QString pw;
  QString settingsFileXml = KINKATTA_DIR;
  settingsFileXml += user.lower();
  settingsFileXml += ".xml";

	if(user.isEmpty() || (user == QString("<new user>")) || !QFile::exists(settingsFileXml)){
		//must be a new user
		return QString("");
	}
	Preferences prefs(settingsFileXml, QString("kinkatta user prefs"), QString("1.0"));

	//qDebug("::readPassword settingsFileXml %s\n", settingsFileXml.latin1());

	prefs.setGroup("password");
	pw = prefs.getCDATA("password", QString(""));
	return decryptPassword(pw);
}
예제 #17
0
NS_IMETHODIMP
nsMsgIdentity::SetKey(const nsACString& identityKey)
{
    mKey = identityKey;
    nsresult rv;
    nsCOMPtr<nsIPrefService> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
    if (NS_FAILED(rv))
        return rv;

    nsCAutoString branchName;
    branchName.AssignLiteral("mail.identity.");
    branchName += mKey;
    branchName.Append('.');
    rv = prefs->GetBranch(branchName.get(), getter_AddRefs(mPrefBranch));
    if (NS_FAILED(rv))
        return rv;

    rv = prefs->GetBranch("mail.identity.default.", getter_AddRefs(mDefPrefBranch));
    return rv;
}
예제 #18
0
void ImportAddressImpl::SaveFieldMap(nsIImportFieldMap *pMap)
{
  if (!pMap)
    return;

  int size;
  int index;
  bool active;
  nsCString str;

  pMap->GetMapSize(&size);
  for (long i = 0; i < size; i++) {
    index = i;
    active = false;
    pMap->GetFieldMap(i, &index);
    pMap->GetFieldActive(i, &active);
    if (active)
      str.Append('+');
    else
      str.Append('-');

    str.AppendInt(index);
    str.Append(',');
  }

  nsresult rv;
  nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));

  if (NS_SUCCEEDED(rv)) {
    nsCString prefStr;
    rv = prefs->GetCharPref("mailnews.import.text.fieldmap", getter_Copies(prefStr));
    if (NS_FAILED(rv) || !str.Equals(prefStr))
      rv = prefs->SetCharPref("mailnews.import.text.fieldmap", str.get());
  }

  // Now also save last used skip first record value.
  bool skipFirstRecord = false;
  rv = pMap->GetSkipFirstRecord(&skipFirstRecord);
  if (NS_SUCCEEDED(rv))
    prefs->SetBoolPref("mailnews.import.text.skipfirstrecord", skipFirstRecord);
}
예제 #19
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int main (int argc, char const *argv[])
{
   // This code is NOT READY to run AT ALL. IT was just a PLACE TO START
  BOOST_ASSERT(false);
  QString configFile;

  try
  {

   // Handle program options passed on command line.
    TCLAP::CmdLine cmd("PipelineRunner", ' ', DREAM3DLib::Version::Complete());

    TCLAP::ValueArg<std::string> inputFileArg( "c", "config", "The text file containing the pipeline information.", true, "", "Pipeline Config File");
    cmd.add(inputFileArg);


    // Parse the argv array.
    cmd.parse(argc, argv);
    if (argc == 1)
    {
      std::cout << "PipelineRunner program was not provided any arguments. Use the --help argument to show the help listing." << std::endl;
      return EXIT_FAILURE;
    }

    configFile = QString::fromStdString(inputFileArg.getValue());


  }
  catch (TCLAP::ArgException &e) // catch any exceptions
  {
    std::cerr << logTime() << " error: " << e.error() << " for arg " << e.argId() << std::endl;
    return EXIT_FAILURE;
  }


  // Create the QSettings Object
  QSettings prefs(configFile, QSettings::IniFormat, NULL);
  readSettings(prefs);

  return EXIT_SUCCESS;
}
예제 #20
0
void runConflictRefinerWithPreferences(IloCP cp, 
                                       IloConstraintArray preferredCts, 
                                       IloConstraintArray otherCts) {
  IloEnv env = cp.getEnv();
  IloConstraintArray cts(env);  
  IloNumArray prefs(env);
  IloInt i;
  for (i=0; i<otherCts.getSize(); ++i) {
    cts.add(otherCts[i]);
    prefs.add(1.0); // Normal preference
  }
  for (i=0; i<preferredCts.getSize(); ++i) {
    cts.add(preferredCts[i]);
    prefs.add(2.0); // Higher preference
  }
  if (cp.refineConflict(cts, prefs)) {
    cp.writeConflict(cp.out());
  } 
  cts.end();
  prefs.end();
}
예제 #21
0
파일: setup.cpp 프로젝트: icefox/kinkatta
QString setup::readProfile(const QString &user){
	//qDebug("::readProfile %s\n", user.latin1());
  QString settingsFileXml = KINKATTA_DIR;
  settingsFileXml += user.lower();
  settingsFileXml += ".xml";

	if(user.isEmpty() || (user == QString("<new user>")) || !QFile::exists(settingsFileXml))
		return QString("");

	Preferences prefs(settingsFileXml, QString("kinkatta user prefs"), QString("1.0"));

	//qDebug("setup::readProfile settingsFileXml %s\n", settingsFileXml.latin1());

	prefs.setGroup("profile");
	QString profile = prefs.getCDATA("profile", "default");
	if(profile == "default"){ //must be a new user
		profile = DEFAULT_PROFILE;
	}
	//qDebug("getCDATA %s\n", i_currentSettings->profile.latin1());
	return profile;
}
예제 #22
0
파일: main.cpp 프로젝트: rousse/vle
static int manage_config_mode(const std::string &configvar, const CmdArgs &args)
{
    int ret = EXIT_SUCCESS;

    try {
        vle::utils::Preferences prefs("vle.conf");

        std::string concat = std::accumulate(args.begin(), args.end(),
                std::string(), Comma());

        if (not prefs.set(configvar, concat))
            throw vle::utils::ArgError(vle::fmt(_("Unknown variable `%1%'")) %
                    configvar);

    } catch (const std::exception &e) {
        std::cerr << vle::fmt(_("Config error: %1%\n")) % e.what();
        ret = EXIT_FAILURE;
    }

    return ret;
}
예제 #23
0
UserInterface::~UserInterface()
{
    prefs().set(PrefAppWindowX, mainWindow_->x_root());
    prefs().set(PrefAppWindowY, mainWindow_->y_root());
    prefs().set(PrefAppWindowW, mainWindow_->w());
    prefs().set(PrefAppWindowH, mainWindow_->h());

    prefs().set(PrefAppWindowSplitH, battleRoom_->x());
    prefs().set(PrefLeftSplitV, battleList_->y());

    delete channelsWindow_;
    delete mapsWindow_;
    delete loginDialog_;
    delete mainWindow_;

    model_.disconnect();

    prefs().flush();
}
예제 #24
0
/**
 * Reads in the settings. Starts the clock.
 */
void AwaySchedule::initPlugin() {
    // Read Settings.
    QString DirStr = QDir::homeDirPath() + "/.kinkatta/plugins/awaySchedule.settings" ;
    Preferences prefs(DirStr, info.Name, info.Version);

    prefs.setGroup("messages");
    int messageCount = prefs.getNumber("message_count");

    for(int i = 0; i < messageCount; i++) {
        appointment *a = new appointment();
        a->startHour = prefs.getNumber((QString("message_%1_").arg(i) + "startHour"), 0 );
        a->startMinute = prefs.getNumber((QString("message_%1_").arg(i) + "startMinute"), 0 );
        a->endHour = prefs.getNumber((QString("message_%1_").arg(i) + "endHour"), 0 );
        a->endMinute = prefs.getNumber((QString("message_%1_").arg(i) + "endMinute"), 0 );
        a->message = prefs.getString((QString("message_%1_").arg(i) + "message"), "" );
        appointments.append(a);
    }

    // StartClock
    QTimer::singleShot(  TIME_TO_CHECK_IN_SECONDS*1000, this, SLOT(checkToSeeIfWeShouldGoAway()));
}
예제 #25
0
파일: setup.cpp 프로젝트: icefox/kinkatta
void setup::removePassword(const QString &user){
 	//qDebug("::removePassword %s\n", user.latin1());

  QString settingsFileXml = KINKATTA_DIR;
  settingsFileXml += user.lower();
  settingsFileXml += ".xml";

	if(user.isEmpty() || user == QString("<new user>") || !QFile::exists(settingsFileXml)){
		//must be a new or unknown user
		return;
	}
	Preferences prefs(settingsFileXml, QString("kinkatta user prefs"), QString("1.0"));

	//qDebug("::removePassword settingsFileXml %s\n", settingsFileXml.latin1());

	prefs.setGroup("password");
	prefs.setString("password", ""); // this is to make it "dirty"
	prefs.removeKey("password");

	prefs.flush();
}
예제 #26
0
파일: main.cpp 프로젝트: RickSaada/blog
int _cdecl _tmain(int argc, LPCTSTR argv[]) {
    HRESULT hr = S_OK;

    // coinitialize
    hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
    if (FAILED(hr)) {
        ERR(_T("CoInitializeEx(COINIT_APARTMENTTHREADED) failed: hr = 0x%08x"), hr);
        return hr;
    }

    CCoUninitializeOnExit c;
    
    // parse command line
    CPrefs prefs(argc, argv, hr);

    if (FAILED(hr)) {
        // CPrefs::CPrefs will log the appropriate error
        return hr;
    }

    if (S_FALSE == hr) {
        // usage statement... skip execution
        return 0;
    }

    hr = SetOTAPolicy(
        prefs.pMMDevice,
        prefs.bCopyOK,
        prefs.bDigitalOutputDisable,
        prefs.bTestCertificateEnable,
        prefs.dwDrmLevel
    );

    if (FAILED(hr)) {
        // SetOTAPolicy will log the appropriate error
        return hr;
    }

    return 0;
}
예제 #27
0
int UserInterface::run(int argc, char** argv)
{
    {
        int x, y, w, h;
        prefs().get(PrefAppWindowX, x, 0);
        prefs().get(PrefAppWindowY, y, 0);
        prefs().get(PrefAppWindowW, w, 1000);
        prefs().get(PrefAppWindowH, h, 1000);
        mainWindow_->resize(x,y,w,h);

        prefs().get(PrefAppWindowSplitH, x, 0);
        if (x != 0)
        {
            tile_->position(battleRoom_->x(), 0, x, 0);
        }

        prefs().get(PrefLeftSplitV, y, 0);
        if (y != 0)
        {
            tileLeft_->position(0, battleList_->y(), 0, y);
        }
    }

    tabs_->initTiles();
    battleRoom_->initTiles();

    mainWindow_->show(argc, argv);

    char const* prdWritePath;
    if ( !DownloadGetConfig(CONFIG_FILESYSTEM_WRITEPATH, reinterpret_cast<void const**>(&prdWritePath)) )
    {
        throw std::runtime_error("failed to get pr-downloader write dir");
    }

    springDialog_->addFoundProfiles(prdWritePath);
    // select current spring profile (spring and unitsync)
    bool const pathsOk = springDialog_->setPaths();

    if (loginDialog_->autoLogin())
    {
        loginDialog_->attemptLogin();
    }

    Fl::lock();
    return Fl::run();
}
예제 #28
0
파일: setup.cpp 프로젝트: icefox/kinkatta
/***************************************************************************
 * Returns a list of all the pounces of a user.
 ***************************************************************************/
QDict<pounce> setup::readPounces(const QString &user){
	QDict<pounce> list;
	if(user.isEmpty() || (user == QString("<new user>")) )
		return list;

  QString settingsFileXml = KINKATTA_DIR;
  settingsFileXml += user.lower();
  settingsFileXml += ".xml";

	Preferences prefs(settingsFileXml, QString("kinkatta user prefs"), QString("1.0"));

	prefs.setGroup("pounces");

	pounce *p;
  int count = prefs.getNumber("pounce_count", 0);
	for(int i = 0; i < count; i++){
		p = new pounce;
		p->buddyName = prefs.getString(QString("pounce_%1").arg(i) + "_buddyName", QString(""));
		p->signOn = prefs.getBool(QString("pounce_%1").arg(i) + "_signOn",false);
		p->returnAway = prefs.getBool(QString("pounce_%1").arg(i) + "_returnAway", false);
		p->returnIdle = prefs.getBool(QString("pounce_%1").arg(i) + "_returnIdle", false);
		p->openChat = prefs.getBool(QString("pounce_%1").arg(i) + "_openChat", false);
		p->sendMessage = prefs.getBool(QString("pounce_%1").arg(i) + "_sendMessage", false);
		p->message = prefs.getString(QString("pounce_%1").arg(i) + "_message", QString(""));
		p->execCommand = prefs.getBool(QString("pounce_%1").arg(i) + "_execCommand", false);
		p->command = prefs.getString(QString("pounce_%1").arg(i) + "_command", QString(""));
		p->doNotRemove = true;

		p->hidden = prefs.getBool(QString("pounce_%1").arg(i) + "_hidden", false);
		p->ignoreSettings = prefs.getBool(QString("pounce_%1").arg(i) + "_ignoreSettings", false);
		p->signOnSound = prefs.getString(QString("pounce_%1").arg(i) + "_signOnSound", QString(""));
		p->signOffSound = prefs.getString(QString("pounce_%1").arg(i) + "_signOffSound", QString(""));

		list.insert(p->buddyName, p);
	}
	return list;

}
예제 #29
0
MapsWindow::MapsWindow(Model & model, Cache& cache):
    Fl_Double_Window(100, 100, "Maps"),
    model_(model),
    cache_(cache),
    prefs_(prefs(), label())
{
    int const scrollW = Fl::scrollbar_size();
    mapArea_ = new MapArea(0, 0, w()-scrollW, h());
    scrollbar_ = new Fl_Scrollbar(w()-scrollW, 0, scrollW, h());
    resizable(mapArea_);
    end();

    scrollbar_->callback(&callbackScrollbar, this);
    scrollbar_->linesize(MapArea::SIZE_);

    int x, y, w, h;
    prefs_.get(PrefWindowX, x, 0);
    prefs_.get(PrefWindowY, y, 0);
    prefs_.get(PrefWindowW, w, 600);
    prefs_.get(PrefWindowH, h, 600);
    resize(x,y,w,h);
    size_range(MapArea::SIZE_ + scrollW, MapArea::SIZE_, 0, 0, 0, 0, 0);
}
예제 #30
0
Shortcut::~Shortcut(){
	// delete everthing in the list :P
	YPreferences prefs(SETTINGS_DIR"/KeyBindings");
	prefs.MakeEmpty();
   
	key_bind *kb = NULL;
   
	for(int32 i = 0; i < kbind.CountItems();i++){
		//kb = (key_bind*)kbind.RemoveItem(i);
		kb = (key_bind*)kbind.ItemAt(i);
		if(kb){
			prefs.AddString("IkbID",kb->ID);
			prefs.AddInt32("IkbKey",(int32)kb->key);
			prefs.AddInt32("IkbMod",kb->mod);
			prefs.AddInt32("IkbKeyAlt",(int32)kb->keyAlt);
			prefs.AddInt32("IkbModAlt",kb->modAlt);
			prefs.AddInt32("IkbMessage",kb->message);
			prefs.AddBool("IkbMenu",kb->menuItem);
			// FREE THE 2 STRINGS HERE !!! lable and ID ??
			delete kb;
		}
	}
}