Changeset 84


Ignore:
Timestamp:
21/05/07 15:45:18 (8 years ago)
Author:
guyru
Message:

moved LaunchBrowser?() to UtilityFunctions?.h

Location:
trunk/OpenYahtzee
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/OpenYahtzee/openyahtzee.kdevses

    r82 r84  
    22<!DOCTYPE KDevPrjSession> 
    33<KDevPrjSession> 
    4  <DocsAndViews NumberOfDocuments="8" > 
     4 <DocsAndViews NumberOfDocuments="10" > 
    55  <Doc0 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/About.cpp" > 
    6    <View0 Type="Source" /> 
     6   <View0 line="0" Type="Source" /> 
    77  </Doc0> 
    88  <Doc1 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/DBwrapper.cpp" > 
     
    1313  </Doc2> 
    1414  <Doc3 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/HighScoreDialog.cpp" > 
    15    <View0 line="113" Type="Source" /> 
     15   <View0 Type="Source" /> 
    1616  </Doc3> 
    1717  <Doc4 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/openyahtzee.cpp" > 
     
    1919  </Doc4> 
    2020  <Doc5 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/MainFrame.cpp" > 
    21    <View0 line="871" Type="Source" /> 
     21   <View0 line="36" Type="Source" /> 
    2222  </Doc5> 
    2323  <Doc6 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/MainFrame.h" > 
    24    <View0 line="77" Type="Source" /> 
     24   <View0 line="20" Type="Source" /> 
    2525  </Doc6> 
    2626  <Doc7 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/HighScoreDialog.h" > 
    2727   <View0 line="33" Type="Source" /> 
    2828  </Doc7> 
     29  <Doc8 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/About.h" > 
     30   <View0 line="66" Type="Source" /> 
     31  </Doc8> 
     32  <Doc9 NumberOfViews="1" URL="file:///home/guy/workspace/openyahtzee/trunk/OpenYahtzee/src/UtilityFunctions.h" > 
     33   <View0 line="80" Type="Source" /> 
     34  </Doc9> 
    2935 </DocsAndViews> 
    3036 <pluginList> 
  • trunk/OpenYahtzee/src/About.h

    r66 r84  
    6767 
    6868 
     69 
    6970#endif // ABOUT_H 
  • trunk/OpenYahtzee/src/MainFrame.cpp

    r82 r84  
    3535#include "SettingsDialog.h" 
    3636#include "About.h" 
     37#include "UtilityFunctions.h" 
    3738#include <iostream> 
    3839#include <sstream> 
     
    946947} 
    947948 
    948 /** 
    949  * This function launches the default browser and directs it to a given url. 
    950  * 
    951  * This function extends the wxWidgets default function for this job by checking manually for 
    952  * different browsers if the wxWidgets' function doesn't find one. This is usually necessary  
    953  * under linux when epiphany isn't installed for some unknown reason. 
    954  * @param link The url that the browser will go to when it stats. 
    955  */ 
    956 void MainFrame::LaunchBrowser (wxString link){ 
    957         if (!wxLaunchDefaultBrowser(link)){ 
    958                  //if builtin function doesn't work search for couple of browsers manually. see 
    959                  //http://linux-consulting.buanzo.com.ar/2006/05/wxwidgets-code-to-launch-browser.html 
    960  
    961                 // variable declarations 
    962                 wxArrayString browsers; 
    963                 wxPathList path_list; 
    964                 bool BrowserWasFound = false; 
    965                 unsigned int i = 0; 
    966                 wxString path; 
    967  
    968                 // Add directories to wxPathList's search path from PATH environment variable 
    969                 path_list.AddEnvList(wxT("PATH")); 
    970                  
    971                 // Add browsers filenames. First item = most priority 
    972                 browsers.Add(wxT("firefox")); 
    973                 browsers.Add(wxT("firefox-bin")); 
    974                 browsers.Add(wxT("mozilla")); 
    975                 browsers.Add(wxT("mozilla-bin")); 
    976                 browsers.Add(wxT("opera")); 
    977                 browsers.Add(wxT("konqueror")); 
    978                 browsers.Add(wxT("epiphany")); 
    979                  
    980                 for (i = 0; i < browsers.GetCount(); i++) { 
    981                         path = path_list.FindAbsoluteValidPath(browsers[i]); 
    982                         if (path.IsEmpty()) { 
    983                                 continue; 
    984                         } else { 
    985                                 BrowserWasFound = true; 
    986                                 break; 
    987                         } 
    988                 } 
    989                  
    990                 browsers.Clear(); 
    991                  
    992                 if (BrowserWasFound) { 
    993                         path += wxT(" "); 
    994                         path += link; 
    995                         ::wxExecute(path); 
    996                 } else { 
    997                         wxMessageBox(wxT("No browser has been found."),wxT("OpenYahtzee")); 
    998                 } 
    999         } 
    1000 } 
    1001949 
    1002950/** 
  • trunk/OpenYahtzee/src/MainFrame.h

    r76 r84  
    7575        void PostScore(int id); 
    7676        void CalculateSubTotal(); 
    77         void LaunchBrowser (wxString link); 
    7877        int InitializeDatabase(); 
    7978 
  • trunk/OpenYahtzee/src/Makefile.am

    r72 r84  
    1111 
    1212noinst_HEADERS = MainFrame.h ObjectsID.h SettingsDB.h HighScoreTableDB.h \ 
    13         HighScoreDialog.h SettingsDialog.h Icon.h icon32.ico wxDynamicBitmap.h 
     13        HighScoreDialog.h SettingsDialog.h Icon.h icon32.ico wxDynamicBitmap.h UtilityFunctions.h 
    1414 
    1515openyahtzee_LDFLAGS = `wx-config --libs` -lsqlite3 
  • trunk/OpenYahtzee/src/Makefile.in

    r72 r84  
    196196# the library search path. 
    197197noinst_HEADERS = MainFrame.h ObjectsID.h SettingsDB.h HighScoreTableDB.h \ 
    198         HighScoreDialog.h SettingsDialog.h Icon.h icon32.ico wxDynamicBitmap.h 
     198        HighScoreDialog.h SettingsDialog.h Icon.h icon32.ico wxDynamicBitmap.h UtilityFunctions.h 
    199199 
    200200openyahtzee_LDFLAGS = `wx-config --libs` -lsqlite3 
Note: See TracChangeset for help on using the changeset viewer.