[haiku-commits] haiku: hrev44486 - src/apps/codycam

  • From: leavengood@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 7 Aug 2012 06:49:21 +0200 (CEST)

hrev44486 adds 1 changeset to branch 'master'
old head: e77304562da050fbc739b99474f8b5bfad0cf5b2
new head: 9c250a42b8bc094063857e2a465b2773e4a6ab19

----------------------------------------------------------------------------

9c250a4: Use BTranslatorUtils::AddTranslationItems in CodyCam.

                                  [ Ryan Leavengood <leavengood@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev44486
Commit:      9c250a42b8bc094063857e2a465b2773e4a6ab19
URL:         http://cgit.haiku-os.org/haiku/commit/?id=9c250a4
Author:      Ryan Leavengood <leavengood@xxxxxxxxx>
Date:        Tue Aug  7 04:47:32 2012 UTC

----------------------------------------------------------------------------

1 file changed, 2 insertions(+), 53 deletions(-)
src/apps/codycam/CodyCam.cpp |   55 ++------------------------------------

----------------------------------------------------------------------------

diff --git a/src/apps/codycam/CodyCam.cpp b/src/apps/codycam/CodyCam.cpp
index 6c4038c..36f17d4 100644
--- a/src/apps/codycam/CodyCam.cpp
+++ b/src/apps/codycam/CodyCam.cpp
@@ -22,7 +22,7 @@
 #include <TabView.h>
 #include <TextControl.h>
 #include <TimeSource.h>
-#include <TranslationKit.h>
+#include <TranslationUtils.h>
 
 #undef B_TRANSLATION_CONTEXT
 #define B_TRANSLATION_CONTEXT "CodyCam"
@@ -69,57 +69,6 @@ ErrorAlert(const char* message, status_t err, BWindow 
*window = NULL)
 }
 
 
-status_t
-AddTranslationItems(BMenu* intoMenu, uint32 fromType)
-{
-
-       BTranslatorRoster* use;
-       char* translatorTypeName;
-       const char* translatorIdName;
-
-       use = BTranslatorRoster::Default();
-       translatorIdName = "be:translator";
-       translatorTypeName = (char *)"be:type";
-       translator_id* ids = NULL;
-       int32 count = 0;
-
-       status_t err = use->GetAllTranslators(&ids, &count);
-       if (err < B_OK)
-               return err;
-
-       for (int tix = 0; tix < count; tix++) {
-               const translation_format* formats = NULL;
-               int32 num_formats = 0;
-               bool ok = false;
-               err = use->GetInputFormats(ids[tix], &formats, &num_formats);
-               if (err == B_OK)
-                       for (int iix = 0; iix < num_formats; iix++) {
-                               if (formats[iix].type == fromType) {
-                                       ok = true;
-                                       break;
-                               }
-                       }
-
-               if (!ok)
-                       continue;
-
-               err = use->GetOutputFormats(ids[tix], &formats, &num_formats);
-               if (err == B_OK)
-                       for (int oix = 0; oix < num_formats; oix++) {
-                               if (formats[oix].type != fromType) {
-                                       BMessage* itemmsg;
-                                       itemmsg = new BMessage(msg_translate);
-                                       itemmsg->AddInt32(translatorIdName, 
ids[tix]);
-                                       itemmsg->AddInt32(translatorTypeName, 
formats[oix].type);
-                                       intoMenu->AddItem(new 
BMenuItem(formats[oix].name, itemmsg));
-                               }
-                       }
-       }
-       delete[] ids;
-       return B_OK;
-}
-
-
 // functions for EnumeratedStringValueSettings
 
 const char*
@@ -684,7 +633,7 @@ VideoWindow::_BuildCaptureControls()
 
        // format menu
        fImageFormatMenu = new BPopUpMenu(B_TRANSLATE("Image Format Menu"));
-       AddTranslationItems(fImageFormatMenu, B_TRANSLATOR_BITMAP);
+       BTranslationUtils::AddTranslationItems(fImageFormatMenu, 
B_TRANSLATOR_BITMAP);
        fImageFormatMenu->SetTargetForItems(this);
 
        if (fImageFormatSettings->Value()


Other related posts:

  • » [haiku-commits] haiku: hrev44486 - src/apps/codycam - leavengood