* Now shows some info about the monitor if detected.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32030 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -331,13 +331,33 @@ ScreenMode::GetMonitorInfo(monitor_info& info, float* _diagonalInches)
|
|||||||
return status;
|
return status;
|
||||||
|
|
||||||
if (_diagonalInches != NULL) {
|
if (_diagonalInches != NULL) {
|
||||||
*_diagonalInches = sqrt(info.width * info.width
|
*_diagonalInches = round(sqrt(info.width * info.width
|
||||||
+ info.height * info.height) / 2.54;
|
+ info.height * info.height) / 0.254) / 10.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(info.vendor, "LEN"))
|
// TODO: If the names aren't sound, we could see if we find/create a
|
||||||
strcpy(info.vendor, "Lenovo");
|
// database for the entries with user presentable names; they are fine
|
||||||
|
// for the models I could test with so far.
|
||||||
|
|
||||||
|
uint32 id = (info.vendor[0] << 24) | (info.vendor[1] << 16)
|
||||||
|
| (info.vendor[2] << 8) | (info.vendor[3]);
|
||||||
|
|
||||||
// TODO: replace more vendor strings with something readable
|
// TODO: replace more vendor strings with something readable
|
||||||
|
switch (id) {
|
||||||
|
case 'BNQ\0':
|
||||||
|
strcpy(info.vendor, "BenQ");
|
||||||
|
break;
|
||||||
|
case 'LEN\0':
|
||||||
|
strcpy(info.vendor, "Lenovo");
|
||||||
|
break;
|
||||||
|
case 'SAM\0':
|
||||||
|
strcpy(info.vendor, "Samsung");
|
||||||
|
break;
|
||||||
|
case 'VSC\0':
|
||||||
|
strcpy(info.vendor, "ViewSonic");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -201,6 +201,9 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
|
|||||||
layout->SetInsets(10, 10, 10, 10);
|
layout->SetInsets(10, 10, 10, 10);
|
||||||
screenBox->SetLayout(layout);
|
screenBox->SetLayout(layout);
|
||||||
|
|
||||||
|
fMonitorInfo = new BStringView("monitor info", "");
|
||||||
|
screenBox->AddChild(fMonitorInfo);
|
||||||
|
|
||||||
fMonitorView = new MonitorView(BRect(0.0, 0.0, 80.0, 80.0), "monitor",
|
fMonitorView = new MonitorView(BRect(0.0, 0.0, 80.0, 80.0), "monitor",
|
||||||
screen.Frame().IntegerWidth() + 1, screen.Frame().IntegerHeight() + 1);
|
screen.Frame().IntegerWidth() + 1, screen.Frame().IntegerHeight() + 1);
|
||||||
screenBox->AddChild(fMonitorView);
|
screenBox->AddChild(fMonitorView);
|
||||||
@@ -464,6 +467,7 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
|
|||||||
controlsBox->TopBorderOffset() - 1));
|
controlsBox->TopBorderOffset() - 1));
|
||||||
|
|
||||||
_UpdateControls();
|
_UpdateControls();
|
||||||
|
_UpdateMonitor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -720,6 +724,7 @@ ScreenWindow::_UpdateActiveMode()
|
|||||||
fScreenMode.Get(fActive);
|
fScreenMode.Get(fActive);
|
||||||
fSelected = fActive;
|
fSelected = fActive;
|
||||||
|
|
||||||
|
_UpdateMonitor();
|
||||||
_UpdateControls();
|
_UpdateControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1068,6 +1073,30 @@ ScreenWindow::_UpdateOriginal()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ScreenWindow::_UpdateMonitor()
|
||||||
|
{
|
||||||
|
monitor_info info;
|
||||||
|
float diagonalInches;
|
||||||
|
status_t status = fScreenMode.GetMonitorInfo(info, &diagonalInches);
|
||||||
|
|
||||||
|
if (status != B_OK) {
|
||||||
|
if (!fMonitorInfo->IsHidden())
|
||||||
|
fMonitorInfo->Hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
char text[256];
|
||||||
|
snprintf(text, sizeof(text), "%s %s %g\"", info.vendor, info.name,
|
||||||
|
diagonalInches);
|
||||||
|
|
||||||
|
fMonitorInfo->SetText(text);
|
||||||
|
|
||||||
|
if (fMonitorInfo->IsHidden())
|
||||||
|
fMonitorInfo->Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ScreenWindow::_Apply()
|
ScreenWindow::_Apply()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
class BBox;
|
class BBox;
|
||||||
class BPopUpMenu;
|
class BPopUpMenu;
|
||||||
class BMenuField;
|
class BMenuField;
|
||||||
|
class BStringView;
|
||||||
class BTextControl;
|
class BTextControl;
|
||||||
|
|
||||||
class RefreshWindow;
|
class RefreshWindow;
|
||||||
@@ -52,6 +53,7 @@ class ScreenWindow : public BWindow {
|
|||||||
void _UpdateMonitorView();
|
void _UpdateMonitorView();
|
||||||
void _UpdateControls();
|
void _UpdateControls();
|
||||||
void _UpdateOriginal();
|
void _UpdateOriginal();
|
||||||
|
void _UpdateMonitor();
|
||||||
|
|
||||||
void _Apply();
|
void _Apply();
|
||||||
|
|
||||||
@@ -62,6 +64,7 @@ class ScreenWindow : public BWindow {
|
|||||||
bool fIsVesa;
|
bool fIsVesa;
|
||||||
bool fBootWorkspaceApplied;
|
bool fBootWorkspaceApplied;
|
||||||
|
|
||||||
|
BStringView* fMonitorInfo;
|
||||||
MonitorView* fMonitorView;
|
MonitorView* fMonitorView;
|
||||||
BMenuItem* fAllWorkspacesItem;
|
BMenuItem* fAllWorkspacesItem;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user