void Window::loadPreferences(bool seekToEnd) {
    if (m_fileWatcher) {
        delete m_fileWatcher;
        m_fileWatcher = 0;
    }
    QSettings settings("DNSSEC-Tools", "dnssec-system-tray");
    m_maxRows = settings.value("logNumber", 5).toInt();
    m_showStillRunningWarning = settings.value("stillRunningWarning", true).toBool();
    readLogFileNames();
    openLogFiles(seekToEnd);
}
    void 
    run (int argc, char* argv[])
    {
      exit_ = false;
      get_image_ = false;
      cols_ = 640;
      rows_ = 480;
      new_rgb_ = false;
      new_depth_ = false;
      new_ir_ = false;
      
      cv_rgb_.create(480, 640, CV_8UC3);
      cv_depth_.create(480, 640, CV_16UC1);
      cv_ir_.create(480, 640, CV_16UC1);
      cv_ir_raw_.create(480, 640, CV_16UC1);
      
      rgb_data_.resize(480 *640);
      depth_data_.resize(480 *640);      
      ir_data_.resize(480 *640);
	      
      image_viewer_.reset (new pcl::visualization::ImageViewer ("PCL OpenNI image"));
      image_viewer_->setPosition (0, 0);
      image_viewer_->setSize (640, 480);
      image_viewer_->registerKeyboardCallback(keyboardCallback,(void*)this);
         
       openLogFiles();
       
      //ROS subscribing
      ros::init(argc, argv, "capture_node");
      ros::NodeHandle nh;
      ros::Subscriber sub = nh.subscribe("/camera/rgb/image_raw", 1, &OpenNIShoter::frameRGBCallback, this);         
      
      //Callback in separate thread. 
      //AsyncSPinner thread grabs frames from the stream if visodo is not busy and notifies visodo thread when new frames arrived
      capture_.reset(new ros::AsyncSpinner(1));
      //ros::spin();   
      
      capture_->start(); 
     
      std::cout << "<Esc>, \'q\', \'Q\': quit the program" << std::endl;
      std::cout << "\' \': pause" << std::endl;
      std::cout << "\'s\': get image (if in snapshot mode)" << std::endl;
      char key;

      
      do
      {         
        if (new_rgb_ == true )
        {
          //std::cout <<"new rgb" << std::endl;
          if (get_image_) 
          {
            saveImagesToDisk(nh, sub);
            get_image_ = false;
          }
          else
          {
            boost::mutex::scoped_lock lock(rgb_mutex_);   
            
            if (&rgb_data_[0] != 0)
              image_viewer_->addRGBImage ((unsigned char*)&rgb_data_[0], cols_, rows_);
            
            new_rgb_ = false;
          }
        }
        
        //boost::this_thread::sleep (boost::posix_time::millisec (10)); 
        
        image_viewer_->spinOnce ();
           
      } while (!exit_);

      // stop the grabber
      capture_->stop ();
    }