Changeset bb6089a


Ignore:
Timestamp:
04/16/13 13:01:42 (17 months ago)
Author:
beanpole135 <ken@…>
Branches:
master, 9.1-release, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
eac8359
Parents:
1620346
Message:

Add the ability for the mount tray to monitor/warn the user about disks that are almost full. Also add a new dialog that will show the current disk usage for the entire system. Still need to clean up the menu a bit, and add the ability to change settings for this.

Location:
src-qt4/pc-mounttray
Files:
4 added
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/pc-mounttray/mountTray.cpp

    r1620346 rbb6089a  
    77#include <QMenu> 
    88#include <QTranslator> 
    9 //#include <iostream> 
    109 
    1110#include "mountTray.h" 
     
    4342  qDebug() << "-Performing initial device scan"; 
    4443  scanInitialDevices(); 
     44   
     45  //Start up the filesystem watcher 
     46  qDebug() << "-Starting up the disk space alert system"; 
     47  diskWatcher = new FSWatcher(); 
     48  connect(diskWatcher,SIGNAL(FSWarning(QString,QString)),this,SLOT(slotDisplayWarning(QString,QString))); 
     49  diskWatcher->start(3600000); // check every 1 hour in milliseconds 
    4550   
    4651  //Update the tray menu and icons 
     
    7479  trayIconMenu->addAction( QIcon(":icons/folder.png"), tr("Open Media Directory"), this, SLOT(slotOpenMediaDir()) ); 
    7580  trayIconMenu->addSeparator(); 
     81  trayIconMenu->addAction( QIcon(":icons/folder.png"), tr("Current Disk Usage"),this,SLOT(slotOpenFSDialog()) ); 
    7682  trayIconMenu->addAction( QIcon(":icons/refresh.png"),tr("Rescan Devices"), this, SLOT(slotRescan()) ); 
    7783  //Add the "close tray" entry to the list 
     
    305311  //Open the default file-manager to the directory listed 
    306312  if(dir.isEmpty()){ dir = MOUNTDIR; } 
     313  if(!dir.endsWith("/")){ dir.append("/"); } //make sure the filemanager knows it is a directory 
    307314  //Make sure we can setup user permissions 
    308315  if(USERNAME=="root"){ 
     
    329336} 
    330337 
     338void MountTray::slotOpenFSDialog(){ 
     339  //Open up the Filsystem disk space monitoring dialog 
     340  diskDisplay = new FSDialog(); 
     341  diskDisplay->show(); 
     342} 
     343 
    331344void MountTray::slotSingleInstance() 
    332345{ 
     
    337350  //Display a popup bubble with the given message for 3 seconds 
    338351  trayIcon->contextMenu()->hide(); //close the menu list 
     352  disconnect(trayIcon, SIGNAL(messageClicked()),0,0); //make sure only one signal/slot connection 
     353  connect(trayIcon,SIGNAL(messageClicked()),this,SLOT(slotOpenMediaDir()) ); 
    339354  trayIcon->showMessage(title, msg , QSystemTrayIcon::NoIcon,3000 ); 
    340355} 
     356 
     357void MountTray::slotDisplayWarning(QString title, QString msg){ 
     358  //Display a popup bubble with the given message for 5 seconds 
     359  trayIcon->contextMenu()->hide(); //close the menu list 
     360  disconnect(trayIcon, SIGNAL(messageClicked()),0,0); //make sure only one signal/slot connection 
     361  connect(trayIcon,SIGNAL(messageClicked()),this,SLOT(slotOpenFSDialog()) ); 
     362  trayIcon->showMessage(title, msg , QSystemTrayIcon::Warning,5000 ); 
     363} 
  • src-qt4/pc-mounttray/mountTray.h

    r1620346 rbb6089a  
    1414#include "menuItem.h" 
    1515#include "devCheck.h" 
     16#include "fsWatcher.h" 
     17#include "fsDialog.h" 
    1618 
    1719extern bool DEBUG_MODE; 
    1820extern QString DEVICEDIR; 
    1921extern QString MOUNTDIR; 
    20  
    21 //class QString; 
    22 //class QPixmap; 
    2322 
    2423class MountTray : public QDialog { 
     
    4544  void openMediaDir(QString);  
    4645  void slotDisplayPopup(QString,QString); 
     46  void slotDisplayWarning(QString,QString); 
    4747  void removeDevice(QString); 
    4848  void slotRescan(); 
     49  void slotOpenFSDialog(); 
    4950   
    5051private: 
     
    5859  QList<MenuItem*> deviceList; 
    5960  QStringList oldsysdev; 
     61  FSWatcher *diskWatcher; 
     62  FSDialog *diskDisplay; 
    6063 
    6164 
  • src-qt4/pc-mounttray/pc-mounttray.pro

    r1620346 rbb6089a  
    77LIBS    += -L../libpcbsd -lQtSolutions_SingleApplication-head -lpcbsd-utils 
    88 
    9 HEADERS += mountTray.h menuItem.h devCheck.h 
     9HEADERS += mountTray.h \ 
     10        menuItem.h \ 
     11        devCheck.h \ 
     12        fsWatcher.h \ 
     13        fsDialog.h 
    1014 
    11 SOURCES += main.cpp mountTray.cpp menuItem.cpp devCheck.cpp 
     15SOURCES += main.cpp \ 
     16        mountTray.cpp \ 
     17        menuItem.cpp \ 
     18        devCheck.cpp \ 
     19        fsWatcher.cpp \ 
     20        fsDialog.cpp 
    1221 
    1322RESOURCES += pc-mounttray.qrc 
Note: See TracChangeset for help on using the changeset viewer.