Ticket #12101: devices-fix.diff

File devices-fix.diff, 3.6 KB (added by Karvjorm, 9 years ago)

Workaround for the layout problem

  • src/apps/devices/Device.cpp

    diff --git a/src/apps/devices/Device.cpp b/src/apps/devices/Device.cpp
    index bc92b7b..3d345fa 100644
    a b Attributes  
    125125Device::GetBusAttributes()
    126126{
    127127    Attributes attributes;
    128     attributes.push_back(Attribute("None", ""));
     128    attributes.push_back(Attribute(B_TRANSLATE("None"), ""));
    129129    return attributes;
    130130}
    131131
  • src/apps/devices/DevicePCI.cpp

    diff --git a/src/apps/devices/DevicePCI.cpp b/src/apps/devices/DevicePCI.cpp
    index 0913373..173ecfd 100644
    a b DevicePCI::GetBusAttributes()  
    129129BString
    130130DevicePCI::GetBusStrings()
    131131{
    132     BString str("Class Info:\t\t\t\t: %classInfo%");
     132    BString str(B_TRANSLATE("Class Info:\t\t\t\t: %classInfo%"));
    133133    str.ReplaceFirst("%classInfo%", fAttributeMap["Class Info"]);
    134134    return str;
    135135}
  • src/apps/devices/DeviceSCSI.cpp

    diff --git a/src/apps/devices/DeviceSCSI.cpp b/src/apps/devices/DeviceSCSI.cpp
    index 84145f4..56f5186 100644
    a b  
    44 *
    55 * Authors:
    66 *      Alexander von Gluck, kallisti5@unixzen.com
     7 *      Modified by Jorma Karvonen, karvonen.jorma@gmail.com
    78 */
    89
    910
    const char* SCSITypeMap[] = {  
    3839    B_TRANSLATE("RBC"),                 // 0x0E
    3940    B_TRANSLATE("Card Reader"),         // 0x0F
    4041    B_TRANSLATE("Bridge"),              // 0x10
    41     B_TRANSLATE("Other")                // 0x11
     42    B_TRANSLATE("Other"),               // 0x11
     43    B_TRANSLATE("Automation"),          // 0x12
     44    B_TRANSLATE("Security"),            // 0x13
     45    B_TRANSLATE("Reserved"),            // 0x14
     46    B_TRANSLATE("RMC"),                 // 0x15
     47    B_TRANSLATE("Reserved"),            // 0x16
     48    B_TRANSLATE("Reserved"),            // 0x17
     49    B_TRANSLATE("Reserved"),            // 0x18
     50    B_TRANSLATE("Reserved"),            // 0x19
     51    B_TRANSLATE("Reserved"),            // 0x1A
     52    B_TRANSLATE("Reserved"),            // 0x1B
     53    B_TRANSLATE("Reserved"),            // 0x1C
     54    B_TRANSLATE("Reserved"),            // 0x1D
     55    B_TRANSLATE("Logical"),             // 0x1E
     56    B_TRANSLATE("Unknown")              // 0x1F
    4257};
    4358
    4459
  • src/apps/devices/PropertyListPlain.cpp

    diff --git a/src/apps/devices/PropertyListPlain.cpp b/src/apps/devices/PropertyListPlain.cpp
    index 44d1d03..0af7fd8 100644
    a b  
    55 * Author:
    66 *      Artur Wyszynski <harakash@gmail.com>
    77 *      Modified by Pieter Panman
     8 *      Modified by Jorma Karvonen <karvonen.jorma@gmail.com>
    89 */
    910
    1011#include "PropertyListPlain.h"
    (this hunk was shorter than expected)  
    1819#include <String.h>
    1920#include <StringView.h>
    2021#include <TextView.h>
    2122
    2223#include "Device.h"
    2324
    2425PropertyListPlain::PropertyListPlain(const char* name)
    2526    :
    PropertyListPlain::AddAttributes(const Attributes& attributes)  
    4448    BGroupLayoutBuilder layout(B_VERTICAL);
    4549    BTextView* view = new BTextView(BRect(0, 0, 1000, 1000),
    4650        "", BRect(5, 5, 995, 995), B_FOLLOW_ALL_SIDES);
     51    int length = 0;
    4752
    4853    view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
    4954    view->MakeEditable(false);
     55   
     56    for (unsigned int i = 0; i < attributes.size(); i++) {
     57        if (attributes[i].fName.Length() > length) {
     58            length = attributes[i].fName.Length();
     59        }
     60    }
    5061
    5162    for (unsigned int i = 0; i < attributes.size(); i++) {
    5263        BString attributeLine;
    53         attributeLine << attributes[i].fName
    54             << "\t" << attributes[i].fValue << "\n";
     64        attributeLine << attributes[i].fName;
     65        if (attributes[i].fName.Length() < length) {
     66            for (int j = attributes[i].fName.Length(); j < length; j++) {
     67                attributeLine << " ";
     68            }
     69            /* TODO: The following is a workaround of a layout (?) bug */
     70            if (attributes[i].fName == "device/id")
     71                attributeLine << "\t";
     72            /* TODO: Another layout (?) bug with the SCSI Device name */
     73        }
     74        attributeLine << "\t" << attributes[i].fValue << "\n";
    5575        view->Insert(attributeLine);
    5676
    5777        view->SetExplicitAlignment(