Ejemplo n.º 1
0
void __fastcall TMainForm::LoadFromRegistry ()
{
  m_use_date_interval = false;

  TRegistry * reg = new TRegistry (KEY_READ);
  try
  {
    reg->RootKey = HKEY_LOCAL_MACHINE;
    reg->OpenKey ("\\SOFTWARE\\Gis center\\Journal", true);

    m_use_date_interval = reg->ReadBool("UseDateInterval");
    m_date_begin = reg->ReadDate("DateBegin");
    m_date_end = reg->ReadDate("DateEnd");

    m_auto_login = reg->ReadBool("AutoLogin");
    m_user_name = reg->ReadString("UserName");
    m_password = reg->ReadString("Password");
    m_server = reg->ReadString("Server");
    m_notification_days = StrToInt (reg->ReadString ("NotifyInterval"));
  }
  __finally
  {
    //delete reg;
    safe_delete (reg);
  }
}
Ejemplo n.º 2
0
void __fastcall TsplashScreen::loadSettings()
{
   TRegistry *reg = new TRegistry;
   bool r;

   ProgressBar->Position   = 0;
   ProgressBar->Max        = 26;
   reg->RootKey = HKEY_LOCAL_MACHINE;
   try
   {
      if ( reg->OpenKey("Software\\LN3GS Productions\\eLibrary", false) )
      {
         ProgressBar->Position++;
         if( reg->ValueExists("Maximized") )
         {
            r =  reg->ReadBool("Maximized");
            mainForm->WindowState = r? wsMaximized: wsNormal;
         }
         if( !r )
         {
            ProgressBar->Position++;
            if( reg->ValueExists("Width") )
               mainForm->Width =  reg->ReadInteger("Width");

            ProgressBar->Position++;
            if( reg->ValueExists("Height") )
               mainForm->Height = reg->ReadInteger("Height");

            ProgressBar->Position++;
            if( reg->ValueExists("Left") )
               mainForm->Left = reg->ReadInteger("Left");

            ProgressBar->Position++;
            
            if( reg->ValueExists("Top") )
               mainForm->Top = reg->ReadInteger("Top");
         }
         else
            ProgressBar->Position += 4;

         ProgressBar->Position++;            
         if( reg->ValueExists("GridLines") )
            if( !reg->ReadBool("GridLines") )
               mainForm->mnuViewGridLines->Click();

         ProgressBar->Position++;
         if( reg->ValueExists("Statusbar") )
           if( !reg->ReadBool("Statusbar") )
               mainForm->mnuViewStatusBar->Click();

         ProgressBar->Position++;
         if( reg->ValueExists("Toolbar") )
           if( !reg->ReadBool("Toolbar") )
               mainForm->mnuViewToolbar->Click();

         ProgressBar->Position++;
         mainForm->mySettings.server.server = "ibiblio.org";
         if( reg->ValueExists("Server") )
            mainForm->mySettings.server.server = reg->ReadString("Server");

         ProgressBar->Position++;
         if( reg->ValueExists("ClearNewLine") )
            mainForm->mySettings.addNewLine = reg->ReadBool("ClearNewLine");

         ProgressBar->Position++;
         mainForm->mySettings.server.directory  = "pub/docs/books/gutenberg/";
         if( reg->ValueExists("ServerDir") )
            mainForm->mySettings.server.directory = reg->ReadString("ServerDir" );

         ProgressBar->Position++;
         if( reg->ValueExists("Password") )
            mainForm->mySettings.server.password = reg->ReadString("Password");

         ProgressBar->Position++;
         if( reg->ValueExists("Proxy") )
            mainForm->mySettings.server.proxy = reg->ReadString("Proxy" );

         ProgressBar->Position++;
         if( reg->ValueExists("ListFontName" ) )
         {
            mainForm->mySettings.AppFont->Name = reg->ReadString("ListFontName" );
            mainForm->BookList->Font->Name =  mainForm->mySettings.AppFont->Name;
            mainForm->SearchList->Font->Name = mainForm->BookList->Font->Name;
            mainForm->MyLibraryList->Font->Name = mainForm->BookList->Font->Name;
         }

         ProgressBar->Position++;
         if( reg->ValueExists("ListFontSize") )
         {
            mainForm->mySettings.AppFont->Size = reg->ReadInteger("ListFontSize" );
            mainForm->BookList->Font->Size = mainForm->mySettings.AppFont->Size;
            mainForm->SearchList->Font->Size = mainForm->BookList->Font->Size;
            mainForm->MyLibraryList->Font->Size = mainForm->BookList->Font->Size;
         }

         ProgressBar->Position++;
         mainForm->mySettings.bookDir = appPath + "BookDir";
         if( reg->ValueExists("BookDir") )
            mainForm->mySettings.bookDir = reg->ReadString("BookDir");

         ProgressBar->Position++;
         if( reg->ValueExists("HTMLFont") )
            mainForm->mySettings.HTMLFont->Name = reg->ReadString("HTMLFont");

         ProgressBar->Position++;
         if( reg->ValueExists("HTMLFontSize") )
            mainForm->mySettings.HTMLFont->Size = reg->ReadInteger("HTMLFontSize");

         ProgressBar->Position++;
         if( reg->ValueExists("HTMLFontColor") )
            mainForm->mySettings.HTMLFont->Color = StringToColor(reg->ReadString("HTMLFontColor"));

         ProgressBar->Position++;
         if( reg->ValueExists("HTMLBackColor") )
            mainForm->mySettings.HTMLBack = StringToColor( reg->ReadString("HTMLBackColor") );

         //Get Reader Font information
         ProgressBar->Position++;
         if( reg->ValueExists("ReaderFont") )
            mainForm->mySettings.ReaderFont->Name = reg->ReadString("ReaderFont");
         ProgressBar->Position++;
         if( reg->ValueExists("ReaderFontSize") )
            mainForm->mySettings.ReaderFont->Size = reg->ReadInteger("ReaderFontSize");
         ProgressBar->Position++;
         if( reg->ValueExists("ReaderFontColor") )
            mainForm->mySettings.ReaderFont->Color = StringToColor(reg->ReadString("ReaderFontColor"));
         //Set Reader font
         mainForm->memBook->Font = mainForm->mySettings.ReaderFont;

         //Get and Set Reader Back color
         ProgressBar->Position++;
         if( reg->ValueExists("ReaderBackColor") )
            mainForm->mySettings.ReaderBack = StringToColor( reg->ReadString("ReaderBackColor") );
         mainForm->memBook->Color = mainForm->mySettings.ReaderBack;


         ProgressBar->Position++;
         if( reg->ValueExists("HTMLLpp") )
            mainForm->mySettings.HTMLLpp =  reg->ReadInteger("HTMLLpp");

         ProgressBar->Position++;
         if( reg->ValueExists("ReaderLpp") )
            mainForm->mySettings.ReaderLpp =  reg->ReadInteger("ReaderLpp");

         if( reg->ValueExists("StripHeader") )
            mainForm->mySettings.StripHeader = reg->ReadBool("StripHeader");   

      }// end of If was able to open key

   }
   __finally
   {   delete reg;   }
}