Filewatcher File Search
FTP Search
  
Directory 
  
Content Search 
   
pkg://Xdisk-0.8-2.src.rpm:18827/Xdisk-0.8.tar.gz  info  downloads

Xdisk-0.8/ 40755      0      0           0  6173016641  10431 5ustar  rootrootXdisk-0.8/Xdisk.cpp100644      0      0       14614  6172537564  12355 0ustar  rootroot#include "Xdisk.hpp"
#include <qpainter.h>
#include <qevent.h>
#include <qpaintd.h>
#include <qpixmap.h>
#include <qfile.h>
#include <qfont.h>

#include <malloc.h>
#include <string.h>

// ----------------------------------------------------------------
Xdisk::Xdisk (QWidget *parent, const char *name, WFlags f,
	      char *label, QFont &font, int update, int scalevalue, int disks,
	      QColor &bgcolor, QColor &rdcolor, QColor &wrcolor,
	      QColor &sclcolor, QColor &lblcolor)
    : QWidget (parent, name, f)
{
      // Initialize meta object
    initMetaObject();

      // Initialize private data
    write_color = wrcolor;
    read_color = rdcolor;
    back_color = bgcolor;
    scale_color = sclcolor;
    label_color = lblcolor;
    frequency = update;
    scale_value = scalevalue;
    this->label = label;
    this->font = font;
    this->disks = disks;

    data = NULL;
    nb_data = 0;
    read_new_data();

      // Create timer
    refreshTimer = new QTimer (this);	// create internal timer
    connect (refreshTimer, SIGNAL(timeout()), SLOT(timeToRefresh()));
    refreshTimer->start (frequency * 1000);	// refresh display every <frequency> seconds
}

// ----------------------------------------------------------------
Xdisk::~Xdisk () 
{
      // Release timer and memory before dying
    if (refreshTimer) {
	refreshTimer->stop();
	delete refreshTimer;
    }
    if (data) free (data);
}

// ----------------------------------------------------------------
void Xdisk::paintEvent (QPaintEvent *pe) 
{
      // if we're not visible there's no need to paint something
      // am I right to test this ?
    if (!isVisible()) return;

      // no flickering with a pixmap
    QPixmap pm (size());
    QPainter p;

      // begin painting the pixmap
    pm.fill (back_color);
    p.begin (&pm);

      // draw text
    if (label && *label) {
	p.setPen (label_color);
	p.setFont (font); // Why this doesn't work ? I have the same
			  // font every time, whatever 'font' is ...
	  // put it on the top-left corner
	p.drawText (pm.rect(), AlignLeft | AlignTop, label);
    }

      // draw histograms
    for (int i = 0; i < nb_data; i++) {
	  // hr,hw,hb are pixels value
	int hr = (int)((float)data[i].read * ratio);
	int hw = (int)((float)data[i].write * ratio);
	if (hr+hw == 0) continue;
	int hb = height() - hr - hw;

	  // begin from the top
	p.moveTo (i, hb);
	if (hw >= 1) {
	    p.setPen (write_color);
	    p.lineTo (i, hb+hw-1);
	    p.moveTo (i, hb+hw);
	}
	if (hr >= 1) {
	    p.setPen (read_color);
	    p.lineTo (i, height()-1);
	}
    }

      // draw scale lines
    p.setPen (scale_color);
    for (int i = 0, j = scale_value; i < nb_scales; i++,j+=scale_value)
	p.drawLine (0,        height()-1-(int)(j*ratio),
		    width()-1,height()-1-(int)(j*ratio));

      // that's all folks
    p.end();
      // put the pixmap on the widget
    bitBlt (this, 0,0, &pm);
}

// ----------------------------------------------------------------
void Xdisk::resizeEvent (QResizeEvent *qr) 
{
    int new_width = qr->size().width();
    int old_width = qr->oldSize().width();

      // the first time we don't have anything
    if (!data)
	data = (RW_data*) calloc (new_width, sizeof(*data));

    else {
	  // the widget grows, we put zero values at the left and move
	  // old data to the right
	if (new_width > old_width) {
	    data = (RW_data*) realloc (data, new_width * sizeof(*data));
	    memmove (data + (new_width - old_width), data, old_width * sizeof(*data));
	    memset (data, 0, (new_width - old_width) * sizeof(*data));
	    
	  // the widget shrink, we move data to the left to keep the
	  // most recent ones
	} else if (new_width < old_width) {
	    memmove (data, data + (old_width - new_width), new_width * sizeof(*data));
	    data = (RW_data*) realloc (data, new_width * sizeof(*data));
	      // we could have erased the higher value, we have to
	      // rescale the histogram
	    compute_ratio();
	}
    }
    nb_data = new_width;
}

// ----------------------------------------------------------------
// the timer slot :
//    - read new data
//    - compute new byte/pixel ratio
//    - redraw all
void Xdisk::timeToRefresh ()
{
    read_new_data();
    compute_ratio();
    repaint(FALSE); // avoid annoying flicker with 'update' or 'repaint(TRUE)'
}

// ----------------------------------------------------------------
// we compute the ratio byte/pixel and the number of scale lines
void Xdisk::compute_ratio ()
{
    int maxval = 0;
    for (int i=0; i < nb_data; i++) {
	int sum = data[i].read + data[i].write;
	if (maxval < sum)
	    maxval = sum;
    }
    nb_scales = (maxval + scale_value - 1) / scale_value;
    maxval = nb_scales * scale_value - 1;
    ratio = (float)height() / (float)maxval;
}

// ----------------------------------------------------------------
// read new data from /proc/stat (disk_rblk and disk_wblk)
// /proc/stat gives us cumulative data, we need to make a diff between
// successive values to gain real bytes/s
// note that /proc/stat give use sectors, not bytes but it's the same
// thing for us.
void Xdisk::read_new_data () 
{
    int nb_read;
    int nb_write;
    int nb1, nb2, nb3, nb4;
    char temp[250];
    QFile *f;

    f = new QFile ("/proc/stat");
    if (f->open (IO_ReadOnly) == FALSE) return;

      // disk-reads counter
    do {
	f->readLine (temp, sizeof(temp)-1);
    } while (strncmp (temp, "disk_rblk", 7) != 0);
    sscanf (&(temp[0])+9, "%d %d %d %d", &nb1, &nb2, &nb3, &nb4);
    nb_read = 0;
    if (disks & 1) nb_read += nb1;
    if (disks & 2) nb_read += nb2;
    if (disks & 4) nb_read += nb3;
    if (disks & 8) nb_read += nb4;

      // disk-writes counter
    do {
	f->readLine (temp, sizeof(temp)-1);
    } while (strncmp (temp, "disk_wblk", 7) != 0);
    sscanf (&(temp[0])+9, "%d %d %d %d", &nb1, &nb2, &nb3, &nb4);
    nb_write = 0;
    if (disks & 1) nb_write += nb1;
    if (disks & 2) nb_write += nb2;
    if (disks & 4) nb_write += nb3;
    if (disks & 8) nb_write += nb4;
    f->close();
    delete f;

      // when the constructor calls this routine, data hasn't been
      // allocated, it just want to keep the current values
    if (data) {
	  // move old data to the left to make room for a new
	memmove (data, data+1, sizeof(*data) * (nb_data - 1));
	  // new data comes at the right most position
	data[nb_data-1].read = nb_read - old_read;
	data[nb_data-1].write = nb_write - old_write;
    }
    
      // keep cumulative data for the next time
    old_read = nb_read;
    old_write = nb_write;
}
Xdisk-0.8/Xdisk.hpp100644      0      0        1755  6172536634  12341 0ustar  rootroot#ifndef Xdisk_HPP
#define Xdisk_HPP

// Widget displaying raw disk activity (ie: at the lowest level)

#include <qwidget.h>
#include <qcolor.h>
#include <qtimer.h>
#include <qfont.h>

class Xdisk : public QWidget
{
    Q_OBJECT
    
public:
    Xdisk (QWidget *parent, const char *name, WFlags f,
	   char *label, QFont &font, int update, int scalevalue, int disks,
	   QColor &bgcolor, QColor &rdcolor, QColor &wrcolor,
	   QColor &sclcolor, QColor &lblcolor);
    ~Xdisk ();
    
protected:
    void paintEvent (QPaintEvent *);
    void resizeEvent (QResizeEvent *);

private slots:
    void timeToRefresh ();

private:
    int frequency;
    QTimer *refreshTimer;
    
    struct RW_data { int read; int write; } *data;
    int nb_data, old_read, old_write;

    QColor read_color, write_color, back_color, scale_color, label_color;
    int scale_value, nb_scales, disks;
    float ratio;

    char *label;
    QFont font;

    void read_new_data ();
    void compute_ratio ();
};

#endif // Xdisk_HPP
Xdisk-0.8/Makefile100644      0      0        2137  6172557754  12207 0ustar  rootrootINCDIR	=/usr/lib/qt/include
CFLAGS	=-O2 -m486 -fomit-frame-pointer -W -Wtemplate-debugging -Wparentheses \
	-Wuninitialized -Wchar-subscripts -Wformat -Wtrigraphs -Wcomment \
	-Wswitch -Wunused -Wreturn-type -Wimplicit -Wpointer-arith -Wsynth \
	-Wconversion -Wno-overloaded-virtual \
	-DNO_DEBUG -DNO_CHECK
LFLAGS  =-lqt
CC	=gcc -pipe
MOC	=/usr/bin/moc

HEADERS	=Xdisk.hpp
SOURCES	=Xdisk.cpp	main.cpp
OBJECTS	=Xdisk.o	main.o
SRCMETA =mXdisk.cpp
OBJMETA =mXdisk.o
TARGET	=Xdisk
DISTRIB =Xdisk-0.8

.SUFFIXES:
.SUFFIXES: .cpp $(SUFFIXES)

.cpp.o:
	$(CC) -c $(CFLAGS) -I$(INCDIR) $<

all: $(TARGET)

$(TARGET): $(OBJECTS) $(OBJMETA)
	$(CC) $(OBJECTS) $(OBJMETA) -o $(TARGET) $(LFLAGS)
	strip $(TARGET)

distribution: $(TARGET)
	rm -f $(OBJECTS) $(SRCMETA) $(OBJMETA) *~ *.bak *% #*
	tar czf ../$(DISTRIB).tar.gz ../$(DISTRIB)

showfiles:
	@echo $(HEADERS) $(SOURCES) Makefile

depend: $(SOURCES)
	@makedepend -I$(INCDIR) $(SOURCES) 2> /dev/null

clean:
	-rm -f *.o *.bak *~ *% #*
	-rm -f $(TARGET) $(SRCMETA)

mXdisk.cpp: Xdisk.hpp
	$(MOC) -o mXdisk.cpp Xdisk.hpp

# DO NOT DELETE THIS LINE -- make depend depends on it.
Xdisk-0.8/Xdisk100755      0      0       46074  6172560020  11563 0ustar  rootrootELF0#4H4 (444EEEUUDDGDWDW/lib/ld-linux.so.12o-t'4cZ#;}hfd@?9*]le($[i1R`.bIVW
8T!GOEuM\vqk~Q"B^_X7YnUL%PN0S3rACy&,j w>K<m=zs{6x/|)DFJ:+g5pa
H	DWU+1`87X"C"E" h,"
t,"
--"
dHh!\ "2 9&Ah!V!T`h"7w!"!!" I,"
,"
,"
+CXJWC	 h"x Hx" 8"7SR >y_!u"d~X1! 9H+QX!y]WTi( pxDC D ;#""("""H 2-<"`( (8`h~e'(!ICXk8o=x!!!0/Vh 	yH"	H!>>8"#D#	g"" xX 	!6	!O	 h	C~	.	>	<X	U
	8!4	W!	xF	U!
	8X	8 &"	(">
W
4X

"%
/
g6
\8=
C
"I
<P
$[
"b
"i
"p


"
"

"
"
"
W
"
8
,
&"
"
"
W
@X
"
g"libqt.so.0_DYNAMIC_GLOBAL_OFFSET_TABLE__init_fini__builtin_newconnect__7QObjectPC7QObjectPCcT1T2_._7QStringdetach__t7QArrayT1ZcnewData__7QGArraydeleteData__7QGArrayPQ27QGArray10array_data_._t7QArrayT1Zc_._7QGArrayduplicate__7QGArrayRC7QGArray__12QApplicationRiPPc__5QFont_._12QApplicationstrcmpstrncmpsetFamily__5QFontPCc_._5QFont__as__6QColorRC6QColorsetMainWidget__12QApplicationP7QWidget__7QWidgetP7QWidgetPCcUiexec__12QApplication__builtin_vec_newmemset_._11QPointArraydetach__18QArrayM_QPointData_._18QArrayM_QPointDatafill__7QPixmapRC6QColor__7QPixmapRC5QSizeibitBlt__FP12QPaintDeviceiiPC12QPaintDeviceiiii8RasterOpb_._7QPixmapcmd__12QPaintDeviceiP8QPainterP13QPDevCmdParam_._7QWidget__8QPainterbegin__8QPainterPC12QPaintDeviceend__8QPainter_._8QPainterrepaint__7QWidgetiiiibsetPen__8QPainterRC6QColordrawText__8QPainteriiiiiPCciP5QRectPPcsetRgb__6QColoriiisetBackgroundColor__7QWidgetRC6QColorsetPalette__7QWidgetRC8QPalettesetFont__7QWidgetRC5QFontshow__7QWidgetmove__7QWidgetiiresize__7QWidgetiisetGeometry__7QWidgetiiiidrawLine__8QPainteriiii__5QFilePCc_IO_stderr_strtok__as__5QFontRC5QFontsetPointSize__5QFontisetItalic__5QFontbsetWeight__5QFontifreereallocmemmovefprintfexitcallocmoveTo__8QPainteriilineTo__8QPainteriisetFont__8QPainterRC5QFonthide__7QWidget__11QMetaObjectPCcT1P9QMetaDataiT3itimerEvent__7QObjectP11QTimerEventeventFilter__7QObjectP7QObjectP6QEventconnectNotify__7QObjectPCcdisconnectNotify__7QObjectPCcmetric__C7QWidgetievent__7QWidgetP6QEventinitMetaObject__7QWidgetsetStyle__7QWidget8GUIStylesetBackgroundPixmap__7QWidgetRC7QPixmapsetCursor__7QWidgetRC7QCursorclose__7QWidgetbadjustSize__7QWidgetmousePressEvent__7QWidgetP11QMouseEventmouseReleaseEvent__7QWidgetP11QMouseEventmouseDoubleClickEvent__7QWidgetP11QMouseEventmouseMoveEvent__7QWidgetP11QMouseEventkeyPressEvent__7QWidgetP9QKeyEventkeyReleaseEvent__7QWidgetP9QKeyEventfocusInEvent__7QWidgetP11QFocusEventfocusOutEvent__7QWidgetP11QFocusEvententerEvent__7QWidgetP6QEventleaveEvent__7QWidgetP6QEventmoveEvent__7QWidgetP10QMoveEventcloseEvent__7QWidgetP11QCloseEventx11Event__7QWidgetP7_XEventstyleChange__7QWidget8GUIStylebackgroundColorChange__7QWidgetRC6QColorbackgroundPixmapChange__7QWidgetRC7QPixmappaletteChange__7QWidgetRC8QPalettefontChange__7QWidgetRC5QFontfocusNextChild__7QWidgetfocusPrevChild__7QWidget__6QTimerP7QObjectPCcstop__6QTimerstart__6QTimerib_7QWidget.metaObj__environatexitlibc.so.5errno__libc_initenviron__fpu_controlsscanf__setfpucw_errno___brk_addrstrcpyungetc__ctype_bgetenv_etextqsortfgetsmemcpy__overflowmallocselectfflush__ctype_toupperstrrchrwritereadstrncpyunlinkfreadfopen__bss_startfclose__uflowgetpwuidsprintffwriteaccess_edata_endopenstrchr__ctype_tolowerclose<Ws@WjW54Xs8XoWr<XiU
U=UIU%UNUUaUJUhUgU\U&U/UBUDUUUFVOV
V0V"VmV@VfVY V8$V>(V),VP0V 4V,8VL<VH@VZDV3HVLVKPV7TV+XV\V`V	dVUhVAlV<pVStV`xV:|V6VpVCVbVVV$VV2VGV!V9V*VeVVRVVMVkVXV4VVQVV1V-VVcVdVVTV.V?VqW(WWWWW'WWEW W#$W[(W,W_0W^4W;8W]5U%U%Uh%Uh%Uh%Uh%Uh %Uh(%Uh0%Uh8p%Uh@`%UhHP%UhP@%UhX0%Uh` %Uhh%Uhp%Uhx%Uh%Uh%Vh%Vh%Vh%Vh%Vh%Vhp%Vh`%VhP% Vh@%$Vh0%(Vh %,Vh%0Vh%4Vh%8Vh%<Vh%@Vh%DVh%HVh %LVh(%PVh0%TVh8p%XVh@`%\VhHP%`VhP@%dVhX0%hVh` %lVhh%pVhp%tVhx%xVh%|Vh%Vh%Vh%Vh%Vh%Vh%Vhp%Vh`%VhP%Vh@%Vh0%Vh %Vh%Vh%Vh%Vh%Vh%Vh%Vh%Vh %Vh(%Vh0%Vh8p%Vh@`%VhHP%VhP@%VhX0%Vh` %Vhh%Vhp%Vhx%Vh%Vh%Wh%Wh%Wh%Wh%Wh%Whp%Wh`%WhP% Wh@%$Wh0%(Wh %,Wh%0Wh%4Wh%8WhYЃPSQ̀D$U8XPh`8P[t&̀&UVS[1BEE8ut&E0փEve[^]Í&US[ó1]]ÐUWVSl$ L$$D$,PT$,RQU`E,CE CT$(Dž@DžDž@DžDž@DžT$Dž@DžT$Dž@DžSU(T$PRVT$TRT$(RrT$XRWgT$lRT$4RX$T$TRT$RFT$@UhT$DT$8T$<RS0T$PEpEtU>jUj,PEl h^:UhS:PfjEhPElP[^_]ÐVS\$t$C,CC CClt$PKltA jPR@ЃCpt	PjPVS[^Í6UWVS$E4MDE@)EFUB)fAf$f@f$$$$jP$St$4VPSiSV tq8tlPVPVf$P@fD$ fD$"fJfT$$fHfD$&jjjQj	@P@PjjV(1L$(L$69}tEpم|$D$D$l$\$l$EpمL|$D$D$l$$^l$D$EFUB)@+D$)SWL$Q~1PL$QCPWL$ QSWL$,Q |$~-PL$QEFUB)PWL$QG
6PD$,P19UFEB)S$؍|$L$L$l$$Xl$)REDU@)PUFEB)؍|$$L$$L$ l$ $Xl$$)RjD$8PhFet$(Vfjjjjjj$SjjE$P,jVNjS[^_]WVS|$D$pX؋WpujV$Gpr9~@PRj‰WpPR)ىPSjGpP /9}*S)PR`SGpPGpWQwt[^_ÍvS\$SS3fjCFSB)@PCDS@)@PjjS[ÍvWVS\$11ҋstv9}Cp<|9}B鐋TЙICFSB)@Q$P<$ٛ[^_ÍvUWVS$ ho:j(PËCjPR@Ѓt$ z:vChVPXR@\Ѓtjhz:V6v;$)ȅuD$PD$PD$ PD$(Ph:D$=P1t|$t|$t|$t|$t$ ChVPXR@\Ѓ:tjh:V;$)ȅuD$PD$PD$ PD$(Ph:D$=PG1tt$tt$tt$tt$CPR@ЃtCjPR@ЃUpt3EtHPBPRUtEp+MxLUtEp+M|L}xu|[^_]ÍvT$D$B:PR^Í6D$PPÐT$D$B:PR2Í6T$D$B;PRÍ6D$PPEÐT$D$B;PRÐUPhWjST$\$:#t1[ÍD$Ph@BPu-T$P%PRS[Ív1[ÐWVSD$ |$$1h@PiÃt7
t [v+ASWi1@th@S
v@)؅u	jW6@tth@S
v@)؅u	jK6@tth@St
v@)؅uj?jD$@tth@S?	6@)؅t(@tth@S@)؅uD$|$j2W
%D$@th@S	6@)؅t(@tth@S@)؅uD$|$t	fjjD$@tth@S_	6@)؅t(@tth@S5@)؅uD$|$t)fjWHD$Ph@S8t1[^_ÍvD$
PW[^_Í6h@jFu[^_UWVSE@EE@EE@EE@EE@EEP]ȃhhj`SSEP]jhjSSEPn]jjhSySEPL]jjjSZSEP-]jjjS;SEPDž`EE@EP]uvN@th@RJ@)Ѕu
`@tth@P
@)ȅuDž`@tth@P
@)ȅuc@tth@P
@)ȅuP/AtthAPn
A)ȅu106AtthAP2
A)ȅu#EPh@PN6AtthAP
A)ȅu#EPh@P6 Atth AP
 A)ȅuEPPJ@v)Atth)APF
)A)ȅuEPPkv2Atth2AP
2A)ȅuEPPv;Atth;AP
;A)ȅuEPPf\vEAtthEAPb
EA)ȅuEPPvOAtthOAP
OA)ȅuEPPvXAtthXAP
XA)ȅu#EPh@Pt|EHvxqƅd_Atth_APs6_A)ȅt,hAtthhAPE	hA)ȅuƅdduJvMEEMQMQhS^EPEPEPEPEPEPEPEPuV`QWjjhPǃDW jZjZPWSvW PSjSAjVT[^_]ËT$D$BAPR>Í6D$PPmÐT$D$BAPRÐCÍ6T$=Uuk=<Xu	Rf$$D$)jCT$L$PHjjjPhBhCjP!U ÐUÍ6T$D$BdEPRfÍ6D$PPÐT$D$BdEPR:ÐUVS[ÿBEE8ut&E0փEve[^]Í&US[s
]];moveTopLeftsetTopLeftQRectmoveBottomRightsetBottomRightmoveTopRightsetTopRightmoveBottomLeftsetBottomLeftmoveCentersetCentermoveBytranslatemoveqRedQREDqGreenQGREENqBlueQBLUEqRgbQRGBqGrayQGRAYwinIdidQWidgetsetEnabled(TRUE)enablesetEnabled(FALSE)disable!isEnabled()isDisabledminimumSize()minimumSize(int*,int*)maximumSize()maximumSize(int*,int*)sizeIncrement()sizeIncrement(int*,int*)isUpdatesEnabled/setUpdatesEnabledenableUpdatesQRegionQPointArray2timeout()1timeToRefresh()/proc/statdisk_rblk%d %d %d %ddisk_wblk6,,,,,,-,moveTopLeftsetTopLeftQRectmoveBottomRightsetBottomRightmoveTopRightsetTopRightmoveBottomLeftsetBottomLeftmoveCentersetCentermoveBytranslatemoveqRedQREDqGreenQGREENqBlueQBLUEqRgbQRGBqGrayQGRAYwinIdidQWidgetsetEnabled(TRUE)enablesetEnabled(FALSE)disable!isEnabled()isDisabledminimumSize()minimumSize(int*,int*)maximumSize()maximumSize(int*,int*)sizeIncrement()sizeIncrement(int*,int*)isUpdatesEnabled/setUpdatesEnabledenableUpdatesoverrideCursorcursorQApplicationsetOverrideCursorsetCursorrestoreOverrideCursorrestoreCursorXdisk 0.8 - display disk statistics
usage:  Xdisk [-options ...]

(options)		(meaning)		(default)

-h -? -help	display this screen
-display dpy	X server on which to display	0:0
-geometry geom	size and location of window	90x90
-noborder	no border, unmoveable window
-thinborder	thin border			default
-fullborder	standard border
-nolabel	suppress label			default
-label text	annotation text
-lblcolor color	annotation color		#000000
-lblfont font	font to use in label		??
-update seconds	interval between updates	5
-scale value	scale lines value (kb/s)	64
-bgcolor color	background color		#60A0C0
-rdcolor color	read part color			#00FF00
-wrcolor color	write part color		#FF0000
-sclcolor color	scale color			#000000
-disks value	logical OR of 1 = sda | hda	15
			      2 = sdb | hdb
			      4 = sdc | hdc
			      8 = sdd | hdd

%x-blackbolddemiboldmedium*ior%d-label-nolabel-noborder-thinborder-fullborder-update-scale-bgcolor-rdcolor-wrcolor-sclcolor-lblcolor-lblfont-disks-display-geometry66666moveTopLeftsetTopLeftQRectmoveBottomRightsetBottomRightmoveTopRightsetTopRightmoveBottomLeftsetBottomLeftmoveCentersetCentermoveBytranslatemoveqRedQREDqGreenQGREENqBlueQBLUEqRgbQRGBqGrayQGRAYwinIdidQWidgetsetEnabled(TRUE)enablesetEnabled(FALSE)disable!isEnabled()isDisabledminimumSize()minimumSize(int*,int*)maximumSize()maximumSize(int*,int*)sizeIncrement()sizeIncrement(int*,int*)isUpdatesEnabled/setUpdatesEnabledenableUpdatesXdisktimeToRefresh()v%h%h 767((8(!X!"8X! x!!!h H"H!8"0&@)#"" xX !! 7777v=DW.>N^n~.>N^n~.>N^n~  . > N ^ n ~         !!.!>!N!^!n!~!!!!!!!!!"".">"N"^"n"~"""""""""##	
`8P
U8GCC: (GNU) 2.7.2 snapshot 951210GCC: (GNU) 2.7.2GCC: (GNU) 2.7.2GCC: (GNU) 2.7.2GCC: (GNU) 2.7.2 snapshot 951210.symtab.strtab.shstrtab.interp.hash.dynsym.dynstr.rel.got.rel.bss.rel.plt.init.plt.text.fini.rodata.data.ctors.dtors.got.dynamic.bss.comment#h)PPP	19	B	(K		TZ _0#0#,e`8`8kh8h8$
sUEyUEUEUEDWDGWGlGzNHXdisk-0.8/README100644      0      0        2416  6173016633  11412 0ustar  rootroot		README file for Xdisk 0.8


Let's start with some legalese from Troll Tech :

   Xdisk requires the Qt library, which is copyright Troll Tech
   AS. Freely distributable programs may generally use Qt for free, see
   [README.QT] for details.

Now, let's take a look at the interesting stuff:

Xdisk display the amount of bytes read from and wrote to the specified
disk(s). The histogram include all physical access to the disk(s). If
you have a swap partition and a filesystem on one disk, the swap
activity will be merged with the filesystem activity.

Xdisk as a number of options to let you put some text in the graph,
to choose what disk(s) you want to monitor, the colors you want etc...
To see these options simply type 'Xdisk -help'

This distribution include source code and an ELF binary.

Xdisk requires the Qt shared lib, X11 and the /proc filesystem. It has
been made and tested on my DX4/100 with 3 scsi disks, linux 2.0.0,
XFree-86 3.1.2, GCC 2.7.2, Qt 0.9.8 and XEmacs 19.14.
Qt is available from http://www.troll.no. The shared lib weight 426 Kb
in tar.gz format.


Note: I've made this utility just to learn Qt, so it's not perfect and
I could have made some major mistakes. If you find bugs or things done
the-bad-way, drop me a note !

--Rmi Guyomarch <rguyom@valcofim.fr>Xdisk-0.8/main.cpp100644      0      0       11465  6172556747  12224 0ustar  rootroot#include "Xdisk.hpp"
#include <qapp.h>
#include <qcolor.h>

#include <stdio.h>
#include <unistd.h>

char *help_str =
"Xdisk 0.8 - display disk statistics
usage:  Xdisk [-options ...]

(options)		(meaning)		(default)

-h -? -help	display this screen
-display dpy	X server on which to display	0:0
-geometry geom	size and location of window	90x90
-noborder	no border, unmoveable window
-thinborder	thin border			default
-fullborder	standard border
-nolabel	suppress label			default
-label text	annotation text
-lblcolor color	annotation color		#000000
-lblfont font	font to use in label		??
-update seconds	interval between updates	5
-scale value	scale lines value (kb/s)	64
-bgcolor color	background color		#60A0C0
-rdcolor color	read part color			#00FF00
-wrcolor color	write part color		#FF0000
-sclcolor color	scale color			#000000
-disks value	logical OR of 1 = sda | hda	15
			      2 = sdb | hdb
			      4 = sdc | hdc
			      8 = sdd | hdd

";

// ----------------------------------------------------------------
// usage: print usage and exit
void usage (void) 
{
    fprintf (stderr, help_str);
    exit (-1);
}

// ----------------------------------------------------------------
// parse_color: parse X11 hex color specification
int parse_color (char *text, QColor &c) 
{
    int x;

    if (*text != '#') return 0;
    if (sscanf (text+1, "%x", &x) != 1) return 0;
    c.setRgb (x >> 16, (x >> 8) & 0xFF, x & 0xFF);
    return 1;
}

// ----------------------------------------------------------------
// parse_font: try to construct a QFont from a X11 font specification
// it doesn't work and I don't know why ...
int parse_font (char *text, QFont &f) 
{
    char *s;
    int i;

    for (i=0, s=strtok(text,"-"); s; s=strtok(NULL,"-"),i++)
	switch (i) {
	    case 1:	// fmly
		f.setFamily (s);
		break;

	    case 2:	// wght
		     if (strcmp(s,"black") == 0)    f.setWeight (QFont::Black);
		else if (strcmp(s,"bold") == 0)     f.setWeight (QFont::Bold);
		else if (strcmp(s,"demibold") == 0) f.setWeight (QFont::DemiBold);
		else if (strcmp(s,"medium") == 0 ||
			 strcmp(s,"*") == 0)        f.setWeight (QFont::Normal);
		else return 0;
		break;

	    case 3:	// slant
		     if (strcmp(s,"i") == 0 || strcmp(s,"o") == 0) f.setItalic (TRUE);
		else if (strcmp(s,"r") == 0 || strcmp(s,"*") == 0) f.setItalic (FALSE);
		else return 0;
		break;

	    case 7:	// ptSz
		int pointsize;
		if (sscanf (s, "%d", &pointsize) != 1) return 0;
		f.setPointSize (pointsize / 10);
		return 1;
	}
    return 1;
}

// ----------------------------------------------------------------
int main (int argc, char **argv) 
{
    char *label;
    int scalevalue, update, disks;
    QColor bgcolor, rdcolor, wrcolor, sclcolor, lblcolor;
    QFont lblfont;
    int borderstyle;

      // defaults
    bgcolor = QColor (0x60, 0xA0, 0xC0);
    rdcolor = QColor (0x00, 0xFF, 0x00);
    wrcolor = QColor (0xFF, 0x00, 0x00);
    sclcolor = QColor (0,0,0);
    lblcolor = QColor (0,0,0);
    label = NULL;
    update = 5;
    scalevalue = 64;
    disks = 15;
    borderstyle = WStyle_Customize | WStyle_DialogBorder;
    
      // parse options
      // C isn't a programing language, it's a compression method
#define ARG(s) (strcmp(*xargv,s) == 0)
    char **xargv = &argv[1];
    while (*xargv) {
	     if (ARG("-label"))      label = xargv[1];
	else if (ARG("-nolabel"))    label = NULL, xargv--;
	else if (ARG("-noborder"))   borderstyle = WStyle_Customize | WStyle_NoBorder, xargv--;
	else if (ARG("-thinborder")) borderstyle = WStyle_Customize | WStyle_DialogBorder, xargv--;
	else if (ARG("-fullborder")) borderstyle = 0, xargv--;
	else if (ARG("-update"))     { if (!sscanf(xargv[1],"%d",&update)) usage(); }
	else if (ARG("-scale"))      { if (!sscanf(xargv[1],"%d",&scalevalue)) usage(); }
	else if (ARG("-bgcolor"))    { if (!parse_color(xargv[1],bgcolor)) usage(); }
	else if (ARG("-rdcolor"))    { if (!parse_color(xargv[1],rdcolor)) usage(); }
	else if (ARG("-wrcolor"))    { if (!parse_color(xargv[1],wrcolor)) usage(); }
	else if (ARG("-sclcolor"))   { if (!parse_color(xargv[1],sclcolor)) usage();}
	else if (ARG("-lblcolor"))   { if (!parse_color(xargv[1],lblcolor)) usage();}
	else if (ARG("-lblfont"))    { if (!parse_font(xargv[1],lblfont)) usage();  }
	else if (ARG("-disks"))      { if (!sscanf(xargv[1],"%d",&disks) || disks<=0 || disks>=16) usage(); }
	else if (ARG("-display") || ARG("-geometry")) { ; /* handled by QApplication ? */ }
	else usage();
	xargv += 2;
    }
#undef ARG

      // convert scalevalue from kbytes/s to sectors/s
    scalevalue *= 2*update;
    
      // create app & widget and launch all the stuff
    QApplication a (argc, argv);
    Xdisk *w = new Xdisk (0,0, borderstyle,
			  label, lblfont, update, scalevalue, disks,
			  bgcolor, rdcolor, wrcolor, sclcolor, lblcolor);
    w->resize (90, 90); // default size
    a.setMainWidget (w);
    w->show();
    return a.exec();
}
Xdisk-0.8/README.QT100644      0      0       11264  6172534346  11763 0ustar  rootrootQt is a complete and well-developed object-oriented framework for
developing graphical user interface applications using C++. It has been
used professionally for over a year.

Qt has excellent documentation: 450 pages of postscript and fully
cross-referenced online html documentation. See it on the web:
http://www.troll.no/qt/

Qt is easy to learn, with consistent naming across all the classes and a
14-chapter on-line tutorial with links into the rest of the documentation.

Qt dramatically cuts down on development time and complexity in writing
user interface software for X-Windows.  It allows the programmer to focus
directly on the programming task, and not mess around with low-level X11
code.

Qt is fully object-oriented. All widgets and dialogs are C++ objects,
and, using inheritance, creation of new widgets is easy and natural.

Qt's revolutionary signal/slot mechanism provides true component
programming. Reusable components can work together without any knowledge
of each other, and in a type-safe way.

Qt has a very fast paint engine, in some cases ten times faster than
most other toolkits. You have full access to low-level painting
functionality. Painting is device independent, so the same code that draws
on the screen can generate printer output.  You can also do arbitrary
clipping, rotation, and scaling - simply and fast.

Qt is very fast and compact because it is based directly on Xlib and uses
neither Motif nor X Intrinsics.  Qt's widgets (user interface objects)
emulate the Motif look and feel, with slight improvements.

Qt is available under several licenses:

	- for commercial use
	- for use with free software (X only)
	- for shareware developers (X only)

Note that the toolkit is the same, only the licenses differ.

The Qt GUI toolkit is copyright Troll Tech AS.  It is available (at the
time of writing) for Windows 95/NT and several variations of unix (X11
release 5 or later).  See http://www.troll.no/ for more availability
information, or fax Troll Tech at +47 22646949.

Qt can be downloaded from http://www.troll.no/dl/ or via anonymous FTP
from ftp.troll.no.

Join the qt-interest mailing list by sending a message containing the
single word "subscribe" to qt-interest-request@nvg.unit.no.

You can contact Troll Tech at

	Troll Tech AS
	Postboks 6133 Etterstad
	N-0602 Oslo
	Norway

	fax: +47 22646949
	email: sales@troll.no

Here is the license intended for free software:

                     TROLL TECH NON-COMMERCIAL LICENSE

Copyright (C) 1992-1996 Troll Tech AS.  All rights reserved.

This is the non-commercial license for Qt version 0.98; it covers
private use and development of free software for the free software
community.


                        COPYRIGHT AND RESTRICTIONS

The Qt toolkit is a product of Troll Tech AS. This license is limited to
use on computers running the X Window System.

You may copy this beta version of the Qt toolkit provided that the entire
archive is distributed unchanged and as a whole, including this notice.

You may use the Qt toolkit to create application programs provided that:
  - You accept this license.
  - Your software is distributed including source code.
  - Your software does not require modifications to Qt.
  - Third parties may legally modify and/or redistribute your software for
    no charge.

If you are paid to develop something with Qt or it is a part of your job
the following conditions also apply:
  - Your software must be suitable for use outside your organization.
  - You must upload your software (including source) to ftp.troll.no
    before you start using it.
  - When you change your software in any significant way, you must upload
    the new version of your software (including source) to ftp.troll.no
    before you start using it.

You may also use the Qt toolkit to create reusable components (such as
libraries) provided that you accept the terms above, and in addition that:
  - Your components' license includes the following text:
	[Your package] requires the Qt library, which is copyright
	Troll Tech AS.  Freely distributable programs may generally
	use Qt for free, see [README.QT] for details.
  - README.QT is distributed along with your components.
  - Qt is not distributed as an integral part of your components.


                       LIMITATIONS OF LIABILITY
 
Troll Tech AS makes no obligation under this license to support or upgrade
Qt, or assist in the use of Qt.

In no event shall Troll Tech AS be liable for any lost revenue or profits
or other direct, indirect, special, incidental or consequential damages,
even if Troll Tech has been advised of the possibility of such damages.

QT IS PROVIDED AS IS WITH NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY
OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Results 1 - 1
Help - FTP Sites List - Software Dir.
Searching half a billion files worldwide
© 1997-2009 MARUHN Internet Solutions