Update for the Catalog API change. Based on r37345. Review appreciated.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39087 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matt Madia
2010-10-23 20:18:22 +00:00
parent 974d4226ff
commit afbf2c78d1
3 changed files with 29 additions and 31 deletions
@@ -4,7 +4,7 @@
// //
// InspectorApp.cpp // InspectorApp.cpp
// //
// BApplication object for the Inspector application. The purpose of // BApplication object for the Inspector application. The purpose of
// Inspector is to provide the user with as much relevant information as // Inspector is to provide the user with as much relevant information as
// possible about the currently open document. // possible about the currently open document.
// //
@@ -14,18 +14,18 @@
// Permission is hereby granted, free of charge, to any person obtaining a // Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"), // copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation // to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, // the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the // and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions: // Software is furnished to do so, subject to the following conditions:
// //
// The above copyright notice and this permission notice shall be included // The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software. // in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
/*****************************************************************************/ /*****************************************************************************/
@@ -49,14 +49,12 @@ InspectorApp::InspectorApp()
{ {
fpActivesWin = NULL; fpActivesWin = NULL;
fpInfoWin = NULL; fpInfoWin = NULL;
be_locale->GetAppCatalog(&fAppCatalog);
AddToTranslatorsList("/system/add-ons/Translators", AddToTranslatorsList("/system/add-ons/Translators",
SYSTEM_TRANSLATOR); SYSTEM_TRANSLATOR);
AddToTranslatorsList("/boot/home/config/add-ons/Translators", AddToTranslatorsList("/boot/home/config/add-ons/Translators",
USER_TRANSLATOR); USER_TRANSLATOR);
// Show application window // Show application window
BRect rect(100, 100, 500, 400); BRect rect(100, 100, 500, 400);
ImageWindow *pwin = new ImageWindow(rect, IMAGEWINDOW_TITLE); ImageWindow *pwin = new ImageWindow(rect, IMAGEWINDOW_TITLE);
@@ -68,14 +66,14 @@ InspectorApp::AddToTranslatorsList(const char *folder, int32 group)
{ {
BDirectory dir; BDirectory dir;
if (dir.SetTo(folder) == B_OK) { if (dir.SetTo(folder) == B_OK) {
BEntry ent; BEntry ent;
while (dir.GetNextEntry(&ent) == B_OK) { while (dir.GetNextEntry(&ent) == B_OK) {
BPath path; BPath path;
if (ent.GetPath(&path) == B_OK) if (ent.GetPath(&path) == B_OK)
flstTranslators.AddItem( flstTranslators.AddItem(
new BTranslatorItem(path.Leaf(), path.Path(), group)); new BTranslatorItem(path.Leaf(), path.Path(), group));
} }
} }
} }
@@ -86,24 +84,24 @@ InspectorApp::MessageReceived(BMessage *pmsg)
case M_ACTIVE_TRANSLATORS_WINDOW: case M_ACTIVE_TRANSLATORS_WINDOW:
if (!fpActivesWin) if (!fpActivesWin)
fpActivesWin = new ActiveTranslatorsWindow( fpActivesWin = new ActiveTranslatorsWindow(
BRect(625, 350, 800, 600), BRect(625, 350, 800, 600),
B_TRANSLATE("Active Translators"), B_TRANSLATE("Active Translators"),
GetTranslatorsList()); GetTranslatorsList());
break; break;
case M_ACTIVE_TRANSLATORS_WINDOW_QUIT: case M_ACTIVE_TRANSLATORS_WINDOW_QUIT:
fpActivesWin = NULL; fpActivesWin = NULL;
break; break;
case M_INFO_WINDOW: case M_INFO_WINDOW:
if (!fpInfoWin) if (!fpInfoWin)
fpInfoWin = new InfoWindow(BRect(625, 50, 800, 300), fpInfoWin = new InfoWindow(BRect(625, 50, 800, 300),
B_TRANSLATE_COMMENT("Info Win", B_TRANSLATE_COMMENT("Info Win",
"This is a quite narrow info window and title 'Info Win' " "This is a quite narrow info window and title 'Info Win' "
"is therefore shortened."), fbstrInfo.String()); "is therefore shortened."), fbstrInfo.String());
break; break;
case M_INFO_WINDOW_QUIT: case M_INFO_WINDOW_QUIT:
fpInfoWin = NULL; fpInfoWin = NULL;
break; break;
case M_INFO_WINDOW_TEXT: case M_INFO_WINDOW_TEXT:
// If image view is telling me to // If image view is telling me to
// update the info window... // update the info window...
@@ -111,7 +109,7 @@ InspectorApp::MessageReceived(BMessage *pmsg)
if (fpInfoWin) if (fpInfoWin)
fpInfoWin->PostMessage(pmsg); fpInfoWin->PostMessage(pmsg);
break; break;
default: default:
BApplication::MessageReceived(pmsg); BApplication::MessageReceived(pmsg);
break; break;
@@ -136,12 +134,12 @@ InspectorApp::GetTranslatorsList()
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
InspectorApp *papp = new InspectorApp(); InspectorApp *papp = new InspectorApp();
papp->Run(); papp->Run();
delete papp; delete papp;
papp = NULL; papp = NULL;
return 0; return 0;
} }
@@ -4,7 +4,7 @@
// //
// InspectorApp.h // InspectorApp.h
// //
// BApplication object for the Inspector application. The purpose of // BApplication object for the Inspector application. The purpose of
// Inspector is to provide the user with as much relevant information as // Inspector is to provide the user with as much relevant information as
// possible about the currently open document. // possible about the currently open document.
// //
@@ -14,18 +14,18 @@
// Permission is hereby granted, free of charge, to any person obtaining a // Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"), // copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation // to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, // the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the // and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions: // Software is furnished to do so, subject to the following conditions:
// //
// The above copyright notice and this permission notice shall be included // The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software. // in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
/*****************************************************************************/ /*****************************************************************************/
@@ -47,9 +47,9 @@ public:
InspectorApp(); InspectorApp();
void MessageReceived(BMessage *pmsg); void MessageReceived(BMessage *pmsg);
void RefsReceived(BMessage *pmsg); void RefsReceived(BMessage *pmsg);
BList *GetTranslatorsList(); BList *GetTranslatorsList();
private: private:
void AddToTranslatorsList(const char *folder, int32 group); void AddToTranslatorsList(const char *folder, int32 group);
@@ -57,7 +57,6 @@ private:
BList flstTranslators; BList flstTranslators;
ActiveTranslatorsWindow *fpActivesWin; ActiveTranslatorsWindow *fpActivesWin;
InfoWindow *fpInfoWin; InfoWindow *fpInfoWin;
BCatalog fAppCatalog;
}; };
#endif // #ifndef INSPECTORAPP_H #endif // #ifndef INSPECTORAPP_H
+3 -2
View File
@@ -2,7 +2,7 @@ SubDir HAIKU_TOP src tools translation inspector ;
AddResources Inspector : Inspector.rsrc ; AddResources Inspector : Inspector.rsrc ;
Application Inspector : Application Inspector :
TranslatorItem.cpp TranslatorItem.cpp
StatusCheck.cpp StatusCheck.cpp
ActiveTranslatorsWindow.cpp ActiveTranslatorsWindow.cpp
@@ -20,5 +20,6 @@ DoCatalogs Inspector :
ActiveTranslatorsWindow.cpp ActiveTranslatorsWindow.cpp
; ;
LinkAgainst Inspector : be tracker locale translation $(TARGET_LIBSUPC++) ; LinkAgainst Inspector :
be tracker translation $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS) ;