Commit 40ded3ef authored by Hannah von Reth's avatar Hannah von Reth

make kinfocenter compile on non x11 systems and Windows

REVIEW: 111342
parent b9773b48
......@@ -245,12 +245,12 @@ if(${KDE_PLATFORM_PROFILE} STREQUAL "Desktop")
macro_optional_add_subdirectory(kstartupconfig)
macro_optional_add_subdirectory(freespacenotifier)
macro_optional_add_subdirectory(kscreensaver)
macro_optional_add_subdirectory(kinfocenter)
# data
macro_optional_add_subdirectory(doc)
if (Q_WS_X11)
macro_optional_add_subdirectory(kinfocenter)
macro_optional_add_subdirectory(ktouchpadenabler)
endif (Q_WS_X11)
......
......@@ -4,10 +4,10 @@ add_subdirectory( infosummary )
add_subdirectory( memory )
add_subdirectory( devinfo )
add_subdirectory( info )
add_subdirectory( nics )
if(NOT WIN32)
add_subdirectory( samba )
add_subdirectory( samba )
add_subdirectory( nics )
add_feature_info("OpenGL support" OPENGL_FOUND "View OpenGL details in kinfocenter." )
add_feature_info("OpenGL/ES support" OPENGLES_FOUND "View OpenGL ES2.0 details in kinfocenter." )
......
......@@ -34,7 +34,9 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
#include <kglobal.h>
#include <klocale.h>
#ifdef Q_WS_X11
#include <X11/Xlib.h>
#endif
#include "config-infocenter.h"
......@@ -52,6 +54,7 @@ static const QString HexStr(unsigned long val, int digits) {
return hexstr;
}
#ifdef Q_WS_X11
static const QString Order(int order) {
if (order==LSBFirst)
return i18n("LSBFirst");
......@@ -60,6 +63,7 @@ static const QString Order(int order) {
else
return i18n("Unknown Order %1", order);
}
#endif
static const QString BitString(unsigned long n) {
return i18np("1 Bit", "%1 Bits", n);
......@@ -69,6 +73,7 @@ static const QString ByteString(unsigned long n) {
return i18np("1 Byte", "%1 Bytes", n);
}
#ifdef Q_WS_X11
static const struct _event_table {
const char *name;
long value;
......@@ -77,6 +82,7 @@ static const struct _event_table {
"ButtonMotionMask", ButtonMotionMask }, { "KeymapStateMask", KeymapStateMask }, { "ExposureMask", ExposureMask }, { "VisibilityChangeMask", VisibilityChangeMask }, { "StructureNotifyMask", StructureNotifyMask }, { "ResizeRedirectMask", ResizeRedirectMask }, {
"SubstructureNotifyMask", SubstructureNotifyMask }, { "SubstructureRedirectMask", SubstructureRedirectMask }, { "FocusChangeMask", FocusChangeMask }, { "PropertyChangeMask", PropertyChangeMask }, { "ColormapChangeMask", ColormapChangeMask }, { "OwnerGrabButtonMask",
OwnerGrabButtonMask }, { 0L, 0 } };
#endif
/* easier to read with such a define ! */
#define I18N_MAX(txt,in,fm,maxw) \
......@@ -85,6 +91,7 @@ static const struct _event_table {
#define PIXEL_ADD 20 // add x Pixel to multicolumns..
#define HEXDIGITS (sizeof(int)*8/4) /* 4 Bytes = 32 Bits = 8 Hex-Digits */
#ifdef Q_WS_X11
static QTreeWidgetItem* XServer_fill_screen_info(QTreeWidgetItem *lBox, QTreeWidgetItem *last, Display *dpy, int scr, int default_scr) {
unsigned width, height;
double xres, yres;
......@@ -199,8 +206,10 @@ static QTreeWidgetItem* XServer_fill_screen_info(QTreeWidgetItem *lBox, QTreeWid
else
return last->child(last->childCount()-1);
}
#endif
static bool GetInfo_XServer_Generic(QTreeWidget *lBox) {
#ifdef Q_WS_X11
/* Many parts of this source are taken from the X11-program "xdpyinfo" */
int i, n;
......@@ -316,6 +325,7 @@ static bool GetInfo_XServer_Generic(QTreeWidget *lBox) {
last = new QTreeWidgetItem(next, imageByteList);
XCloseDisplay(dpy);
#endif
return true;
}
......
......@@ -329,13 +329,21 @@ QVListLayout *SolVolumeDevice::infoPanelLayout()
labels << i18n("Volume Space:");
usageBar = new KCapacityBar();
usageBar->setValue(static_cast<int>((mountSpaceInfo.used() * 100) / mountSpaceInfo.size()));
usageBar->setText(
i18nc("Available space out of total partition size (percent used)",
"%1 free of %2 (%3% used)",
KGlobal::locale()->formatByteSize(mountSpaceInfo.available()),
KGlobal::locale()->formatByteSize(mountSpaceInfo.size()),
usageBar->value()));
if(mountSpaceInfo.size() > 0)
{
usageBar->setValue(static_cast<int>((mountSpaceInfo.used() * 100) / mountSpaceInfo.size()));
usageBar->setText(
i18nc("Available space out of total partition size (percent used)",
"%1 free of %2 (%3% used)",
KGlobal::locale()->formatByteSize(mountSpaceInfo.available()),
KGlobal::locale()->formatByteSize(mountSpaceInfo.size()),
usageBar->value()));
}
else
{
usageBar->setValue(0);
usageBar->setText(i18nc("No data available"));
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment