Example #1
0
ButtonLog::ButtonLog(LogPlay *log,RDCae *cae,int id,RDAirPlayConf *conf,
		     bool allow_pause,QWidget *parent,const char *name)
  : QWidget(parent,name)
{
  log_id=id;
  log_log=log;
  log_cae=cae;
  log_action_mode=RDAirPlayConf::Normal;
  log_op_mode=RDAirPlayConf::LiveAssist;
  log_time_mode=RDAirPlayConf::TwentyFourHour;
  log_pause_enabled=allow_pause;

  QFont font=QFont("Helvetica",14,QFont::Bold);
  font.setPixelSize(14);

  //
  // Set Mappings
  //
  connect(log_log,SIGNAL(transportChanged()),
	  this,SLOT(transportChangedData()));
  connect(log_log,SIGNAL(modified(int)),this,SLOT(modifiedData(int)));
  connect(log_log,SIGNAL(played(int)),this,SLOT(playedData(int)));
  connect(log_log,SIGNAL(stopped(int)),this,SLOT(stoppedData(int)));
  connect(log_log,SIGNAL(paused(int)),this,SLOT(pausedData(int)));
  connect(log_log,SIGNAL(position(int,int)),this,SLOT(positionData(int,int)));

  //
  // Edit Event Dialog
  //
  log_event_edit=new EditEvent(log_log,log_cae,this,"list_event_edit");

  //
  // Line Boxes / Start Buttons
  //
  QSignalMapper *mapper=new QSignalMapper(this,"start_button_mapper");
  connect(mapper,SIGNAL(mapped(int)),
	  this,SLOT(startButton(int)));
  for(int i=0;i<BUTTON_PLAY_BUTTONS;i++) {
    log_line_box[i]=new LogLineBox(conf,this);
    log_line_box[i]->setMode(LogLineBox::Full);
    log_line_box[i]->setAcceptDrops(rdstation_conf->enableDragdrop());
    log_line_box[i]->setAllowDrags(rdstation_conf->enableDragdrop());
    log_line_box[i]->setGeometry(10+log_line_box[i]->sizeHint().height(),
			       (log_line_box[i]->sizeHint().height()+12)*i,
			       log_line_box[i]->sizeHint().width(),
			       log_line_box[i]->sizeHint().height());
    connect(log_line_box[i],SIGNAL(doubleClicked(int)),
	    this,SLOT(boxDoubleClickedData(int)));
    connect(log_line_box[i],SIGNAL(cartDropped(int,RDLogLine *)),
	    this,SLOT(cartDroppedData(int,RDLogLine *)));
    log_start_button[i]=new StartButton(allow_pause,this);
    log_start_button[i]->setGeometry(5,
			       (log_line_box[i]->sizeHint().height()+12)*i,
			       log_line_box[i]->sizeHint().height(),
			       log_line_box[i]->sizeHint().height());
    mapper->setMapping(log_start_button[i],i);
    connect(log_start_button[i],SIGNAL(clicked()),
	    mapper,SLOT(map()));
  }

  for(int i=BUTTON_PLAY_BUTTONS;i<BUTTON_TOTAL_BUTTONS;i++) {
    log_line_box[i]=new LogLineBox(conf,this);
    log_line_box[i]->setMode(LogLineBox::Half);
    log_line_box[i]->setAcceptDrops(rdstation_conf->enableDragdrop());
    log_line_box[i]->setAllowDrags(rdstation_conf->enableDragdrop());
    log_line_box[i]->setGeometry(10+log_line_box[0]->sizeHint().height(),
			       (log_line_box[0]->sizeHint().height()+12)*3+
			       (log_line_box[i]->sizeHint().height()+12)*(i-3),
			        log_line_box[i]->sizeHint().width(),
			        log_line_box[i]->sizeHint().height());
    connect(log_line_box[i],SIGNAL(doubleClicked(int)),
	    this,SLOT(boxDoubleClickedData(int)));
    connect(log_line_box[i],SIGNAL(cartDropped(int,RDLogLine *)),
	    this,SLOT(cartDroppedData(int,RDLogLine *)));
    log_start_button[i]=new StartButton(allow_pause,this);
    log_start_button[i]->setGeometry(5,
			       (log_line_box[0]->sizeHint().height()+12)*3+
			       (log_line_box[i]->sizeHint().height()+12)*(i-3),
			        log_line_box[0]->sizeHint().height(),
			        log_line_box[i]->sizeHint().height());
    mapper->setMapping(log_start_button[i],i);
    connect(log_start_button[i],SIGNAL(clicked()),
	    mapper,SLOT(map()));
  }
}
Example #2
0
AddConstraintActivitiesOccupyMaxDifferentRoomsForm::AddConstraintActivitiesOccupyMaxDifferentRoomsForm(QWidget* parent): QDialog(parent)
{
	setupUi(this);

	addConstraintPushButton->setDefault(true);
	
	allActivitiesListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
	selectedActivitiesListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
	
	connect(addConstraintPushButton, SIGNAL(clicked()), this, SLOT(addCurrentConstraint()));
	connect(closePushButton, SIGNAL(clicked()), this, SLOT(close()));
	connect(allActivitiesListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(addActivity()));
	connect(addAllActivitiesPushButton, SIGNAL(clicked()), this, SLOT(addAllActivities()));
	connect(selectedActivitiesListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(removeActivity()));
	connect(clearPushButton, SIGNAL(clicked()), this, SLOT(clear()));
	connect(teachersComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged()));
	connect(studentsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged()));
	connect(subjectsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged()));
	connect(activityTagsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged()));
	
	centerWidgetOnScreen(this);
	restoreFETDialogGeometry(this);
							
	maxDifferentRoomsSpinBox->setMinimum(1);
	maxDifferentRoomsSpinBox->setMaximum(MAX_ROOMS);
	maxDifferentRoomsSpinBox->setValue(1);

	//activities
	QSize tmp1=teachersComboBox->minimumSizeHint();
	Q_UNUSED(tmp1);
	QSize tmp2=studentsComboBox->minimumSizeHint();
	Q_UNUSED(tmp2);
	QSize tmp3=subjectsComboBox->minimumSizeHint();
	Q_UNUSED(tmp3);
	QSize tmp4=activityTagsComboBox->minimumSizeHint();
	Q_UNUSED(tmp4);

	teachersComboBox->addItem("");
	for(int i=0; i<gt.rules.teachersList.size(); i++){
		Teacher* tch=gt.rules.teachersList[i];
		teachersComboBox->addItem(tch->name);
	}
	teachersComboBox->setCurrentIndex(0);

	subjectsComboBox->addItem("");
	for(int i=0; i<gt.rules.subjectsList.size(); i++){
		Subject* sb=gt.rules.subjectsList[i];
		subjectsComboBox->addItem(sb->name);
	}
	subjectsComboBox->setCurrentIndex(0);

	activityTagsComboBox->addItem("");
	for(int i=0; i<gt.rules.activityTagsList.size(); i++){
		ActivityTag* st=gt.rules.activityTagsList[i];
		activityTagsComboBox->addItem(st->name);
	}
	activityTagsComboBox->setCurrentIndex(0);

	studentsComboBox->addItem("");
	for(int i=0; i<gt.rules.yearsList.size(); i++){
		StudentsYear* sty=gt.rules.yearsList[i];
		studentsComboBox->addItem(sty->name);
		for(int j=0; j<sty->groupsList.size(); j++){
			StudentsGroup* stg=sty->groupsList[j];
			studentsComboBox->addItem(stg->name);
			if(SHOW_SUBGROUPS_IN_COMBO_BOXES) for(int k=0; k<stg->subgroupsList.size(); k++){
				StudentsSubgroup* sts=stg->subgroupsList[k];
				studentsComboBox->addItem(sts->name);
			}
		}
	}
	studentsComboBox->setCurrentIndex(0);

	selectedActivitiesListWidget->clear();
	selectedActivitiesList.clear();

	filterChanged();
}
Example #3
0
MainWindow::MainWindow(QWidget *parent) :
        QWidget(parent) {
    this->setWindowTitle("环境变量编辑器");
    /***************************************************
     全局布局控制
     */
    hblMain = new QHBoxLayout(this);
    vblRight = new QVBoxLayout(this);
    vblLeft = new QVBoxLayout(this);
    hblMain->addLayout(vblLeft);
    hblMain->addLayout(vblRight);
    /*******************************************************
     左侧布局
     */
    lbTableView = new QLabel("当前系统环境变量:", this);
    vblLeft->addWidget(lbTableView);
    tvValueList = new QTableView();
    vblLeft->addWidget(tvValueList);
    lbDetailTittle = new QLabel("变量信息:", this);
    vblLeft->addWidget(lbDetailTittle);
    lbPathDetail = new QLabel("变量信息:", this);
    vblLeft->addWidget(lbPathDetail);
    lbPathDetail->setGeometry(QRect(328, 240, 329, 27 * 4));  //四倍行距
    lbPathDetail->setWordWrap(true);  //自动换行
    lbPathDetail->setAlignment(Qt::AlignTop);
    /*******************************************************
     右侧布局
     */
    lbPathDescribe = new QLabel("Path设置:", this);
    vblRight->addWidget(lbPathDescribe);
    pbShowPath = new QPushButton("显示Path信息");  //显示path
    vblRight->addWidget(pbShowPath);
    pbEiditPath = new QPushButton("编辑Path路径");  //修改path
    vblRight->addWidget(pbEiditPath);

    //*****************************************************************

    lbBackDescribe = new QLabel("环境适配:");
    vblRight->addWidget(lbBackDescribe);
    pbSetBack = new QPushButton("备份当前环境");  //备份环境
    vblRight->addWidget(pbSetBack);
    pbUseBack = new QPushButton("还原到指定环境");  //还原环境
    vblRight->addWidget(pbUseBack);
    pbCheckIN = new QPushButton("导入特定环境变量");  //导入环境
    vblRight->addWidget(pbCheckIN);
    pbCheckOut = new QPushButton("导出指定环境变量"); //导出环境
    vblRight->addWidget(pbCheckOut);

    //*****************************************************************

    lbEiditDescribe = new QLabel("变量操作:");
    vblRight->addWidget(lbEiditDescribe);
    pbNewValue = new QPushButton("新建环境变量");  //新建变量
    vblRight->addWidget(pbNewValue);
    pbEiditValue = new QPushButton("编辑选中变量");  //编辑变量
    vblRight->addWidget(pbEiditValue);
    pbDelValue = new QPushButton("删除选中变量");  //删除变量
    vblRight->addWidget(pbDelValue);

    //*****************************************************************
    lbEiditFunction = new QLabel(" ");
    vblRight->addWidget(lbEiditFunction);
    pbAbout = new QPushButton("关于…");//关于
    vblRight->addWidget(pbAbout);
    pbExit = new QPushButton("退出"); //退出
    vblRight->addWidget(pbExit);

    /******************************************
     //        环境变量池
     */
    //显示变量
    slotRefrehValue();

    //通过是否可以新建环境变量判断是否以管理员身份启动
    reg->setValue("testAdminPermissions", "test");
    if (reg->value("testAdminPermissions", false).toBool()) {

        reg->remove("testAdminPermissions");
        isAdimin = true;
        //判断back目录是否存在,若没有提示用户备份!
        QDir dir;
        if (!dir.exists("./back/")) {
            switch (QMessageBox::information(this, "备份提醒",
                    "程序当前目录下找不到back文件夹,您可能从未对环境变量进行备份,为了保证操作安全,强烈建议您备份当前环境变量以减少误操作所带来的困扰!",
                    "立即备份!", "暂不需要!", 0, 1)) {
            case 0:
                slotSetBack();
                break;
            case 1:
                break;

            }

        }
    } else {
        QMessageBox::information(NULL, "未获得UAC管理员权限",
                "未使用UAC管理员权限开启本程序,由于Windows系统的限制,你可能只能查看变量内容而无法对其编辑");
        isAdimin = false;

    }

    //显示选中变量概要
    connect(tvValueList, SIGNAL(clicked(QModelIndex)), this,
            SLOT(slotGetClickedLine()));

    //槽
    //显示Path信息
    connect(pbShowPath, SIGNAL(clicked()), this, SLOT(slotShowPath()));
    //添加按钮槽
    connect(pbNewValue, SIGNAL(clicked()), this, SLOT(slotCreateWindow()));
    connect(pbEiditValue, SIGNAL(clicked()), this, SLOT(slotEiditWindow()));
    connect(pbEiditPath, SIGNAL(clicked()), this, SLOT(slotPathWindow()));

    //删除按钮槽
    connect(pbDelValue, SIGNAL(clicked()), this, SLOT(slotRemoveValue()));
    //备份
    connect(pbSetBack, SIGNAL(clicked()), this, SLOT(slotSetBack()));
    //还原
    connect(pbUseBack, SIGNAL(clicked()), this, SLOT(SlotGetBackWindow()));
    //导出
    connect(pbCheckOut, SIGNAL(clicked()), this, SLOT(slotExportWindow()));
    //导入
    connect(pbCheckIN, SIGNAL(clicked()), this, SLOT(slotImportWindow()));
    //退出
    connect(pbExit, SIGNAL(clicked()), this, SLOT(close()));
    //关于
    connect(pbAbout, SIGNAL(clicked()), this, SLOT(slotAboutWindow()));
}
SpiceDialog::SpiceDialog(SpiceFile *c, Schematic *d)
			: QDialog(d, 0, TRUE, Qt::WDestructiveClose)
{
  resize(400, 250);
  setCaption(tr("Edit SPICE Component Properties"));
  Comp = c;
  Doc  = d;

  all = new Q3VBoxLayout(this); // to provide neccessary size
  QWidget *myParent = this;

  Expr.setPattern("[^\"=]+");  // valid expression for property 'edit' etc
  Validator = new QRegExpValidator(Expr, this);
  Expr.setPattern("[\\w_]+");  // valid expression for property 'NameEdit' etc
  ValRestrict = new QRegExpValidator(Expr, this);


  // ...........................................................
  Q3GridLayout *topGrid = new Q3GridLayout(0, 4,3,3,3);
  all->addLayout(topGrid);

  topGrid->addWidget(new QLabel(tr("Name:"), myParent), 0,0);
  CompNameEdit = new QLineEdit(myParent);
  CompNameEdit->setValidator(ValRestrict);
  topGrid->addWidget(CompNameEdit, 0,1);
  connect(CompNameEdit, SIGNAL(returnPressed()), SLOT(slotButtOK()));

  topGrid->addWidget(new QLabel(tr("File:"), myParent), 1,0);
  FileEdit = new QLineEdit(myParent);
  FileEdit->setValidator(ValRestrict);
  topGrid->addWidget(FileEdit, 1,1);
  connect(FileEdit, SIGNAL(returnPressed()), SLOT(slotButtOK()));

  ButtBrowse = new QPushButton(tr("Browse"), myParent);
  topGrid->addWidget(ButtBrowse, 1,2);
  connect(ButtBrowse, SIGNAL(clicked()), SLOT(slotButtBrowse()));

  ButtEdit = new QPushButton(tr("Edit"), myParent);
  topGrid->addWidget(ButtEdit, 2,2);
  connect(ButtEdit, SIGNAL(clicked()), SLOT(slotButtEdit()));

  FileCheck = new QCheckBox(tr("show file name in schematic"), myParent);
  topGrid->addWidget(FileCheck, 2,1);

  SimCheck = new QCheckBox(tr("include SPICE simulations"), myParent);
  topGrid->addWidget(SimCheck, 3,1);

  Q3HBox *h1 = new Q3HBox(myParent);
  h1->setSpacing(5);
  PrepCombo = new QComboBox(h1);
  PrepCombo->insertItem("none");
  PrepCombo->insertItem("ps2sp");
  PrepCombo->insertItem("spicepp");
  PrepCombo->insertItem("spiceprm");
  QLabel * PrepLabel = new QLabel(tr("preprocessor"), h1);
  PrepLabel->setMargin(5);
  topGrid->addWidget(h1, 4,1);
  connect(PrepCombo, SIGNAL(activated(int)), SLOT(slotPrepChanged(int)));

  // ...........................................................
  Q3GridLayout *midGrid = new Q3GridLayout(0, 2,3,5,5);
  all->addLayout(midGrid);

  midGrid->addWidget(new QLabel(tr("SPICE net nodes:"), myParent), 0,0);
  NodesList = new Q3ListBox(myParent);
  midGrid->addWidget(NodesList, 1,0);
  connect(NodesList, SIGNAL(doubleClicked(Q3ListBoxItem*)),
	SLOT(slotAddPort(Q3ListBoxItem*)));
  
  Q3VBox *v0 = new Q3VBox(myParent);
  v0->setSpacing(5);
  midGrid->addWidget(v0, 1,1);
  ButtAdd = new QPushButton(tr("Add >>"), v0);
  connect(ButtAdd, SIGNAL(clicked()), SLOT(slotButtAdd()));
  ButtRemove = new QPushButton(tr("<< Remove"), v0);
  connect(ButtRemove, SIGNAL(clicked()), SLOT(slotButtRemove()));
  v0->setStretchFactor(new QWidget(v0), 5); // stretchable placeholder

  midGrid->addWidget(new QLabel(tr("Component ports:"), myParent), 0,2);
  PortsList = new Q3ListBox(myParent);
  midGrid->addWidget(PortsList, 1,2);
  connect(PortsList, SIGNAL(doubleClicked(Q3ListBoxItem*)),
	SLOT(slotRemovePort(Q3ListBoxItem*)));
  

  // ...........................................................
  Q3HBox *h0 = new Q3HBox(this);
  h0->setSpacing(5);
  all->addWidget(h0);
  connect(new QPushButton(tr("OK"),h0), SIGNAL(clicked()),
	  SLOT(slotButtOK()));
  connect(new QPushButton(tr("Apply"),h0), SIGNAL(clicked()),
	  SLOT(slotButtApply()));
  connect(new QPushButton(tr("Cancel"),h0), SIGNAL(clicked()),
	  SLOT(slotButtCancel()));

  // ------------------------------------------------------------
  CompNameEdit->setText(Comp->Name);
  changed = false;

  // insert all properties into the ListBox
  Property *pp = Comp->Props.first();
  FileEdit->setText(pp->Value);
  FileCheck->setChecked(pp->display);
  SimCheck->setChecked(Comp->Props.at(2)->Value == "yes");
  for(int i=0; i<PrepCombo->count(); i++) {
    if(PrepCombo->text(i) == Comp->Props.at(3)->Value) {
      PrepCombo->setCurrentItem(i);
      currentPrep = i;
      break;
    }
  }

  loadSpiceNetList(pp->Value);  // load netlist nodes
}
transferOrderItem::transferOrderItem(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
    : XDialog(parent, name, modal, fl)
{
  setupUi(this);

  connect(_cancel,	SIGNAL(clicked()),      this, SLOT(sCancel()));
  connect(_freight,     SIGNAL(valueChanged()), this, SLOT(sCalculateTax()));
  connect(_freight,	SIGNAL(valueChanged()), this, SLOT(sChanged()));
  connect(_item,	SIGNAL(newId(int)),     this, SLOT(sChanged()));
  connect(_item,	SIGNAL(newId(int)),     this, SLOT(sPopulateItemInfo(int)));
  connect(_next,	SIGNAL(clicked()),      this, SLOT(sNext()));
  connect(_notes,	SIGNAL(textChanged()),  this, SLOT(sChanged()));
  connect(_prev,	SIGNAL(clicked()), this, SLOT(sPrev()));
  connect(_promisedDate,SIGNAL(newDate(const QDate&)), this, SLOT(sChanged()));
  connect(_qtyOrdered,  SIGNAL(lostFocus()), this, SLOT(sDetermineAvailability()));
  connect(_qtyOrdered,  SIGNAL(textChanged(const QString&)), this, SLOT(sChanged()));
  connect(_save,	SIGNAL(clicked()), this, SLOT(sSave()));
  connect(_scheduledDate, SIGNAL(newDate(const QDate&)), this, SLOT(sChanged()));
  connect(_scheduledDate, SIGNAL(newDate(const QDate&)), this, SLOT(sDetermineAvailability()));
  connect(_showAvailability, SIGNAL(toggled(bool)), this, SLOT(sDetermineAvailability()));
  connect(_showAvailability, SIGNAL(toggled(bool)), this, SLOT(sDetermineAvailability()));
  connect(_showIndented,SIGNAL(toggled(bool)), this, SLOT(sDetermineAvailability()));
  connect(_taxLit, SIGNAL(leftClickedURL(QString)), this, SLOT(sTaxDetail()));
  connect(_warehouse,	SIGNAL(newID(int)), this, SLOT(sChanged()));
  connect(_warehouse,	SIGNAL(newID(int)), this, SLOT(sDetermineAvailability()));
  connect(_inventoryButton, SIGNAL(toggled(bool)), this, SLOT(sHandleButton()));

  _modified	= false;
  _canceling	= false;
  _error	= false;
  _originalQtyOrd	= 0.0;
  _saved = false;

  _availabilityLastItemid	= -1;
  _availabilityLastWarehousid	= -1;
  _availabilityLastSchedDate	= QDate();
  _availabilityLastShow		= false;
  _availabilityLastShowIndent	= false;
  _availabilityQtyOrdered	= 0.0;

  _item->setType(ItemLineEdit::cActive | (ItemLineEdit::cAllItemTypes_Mask ^ ItemLineEdit::cKit));
  _item->addExtraClause( QString("(itemsite_active)") ); // ItemLineEdit::cActive doesn't compare against the itemsite record

  _availability->addColumn(tr("#"),           _seqColumn, Qt::AlignCenter,true, "bomitem_seqnumber");
  _availability->addColumn(tr("Item Number"),_itemColumn, Qt::AlignLeft,  true, "item_number");
  _availability->addColumn(tr("Description"),         -1, Qt::AlignLeft,  true, "item_descrip");
  _availability->addColumn(tr("UOM"),         _uomColumn, Qt::AlignCenter,true, "uom_name");
  _availability->addColumn(tr("Pend. Alloc."),_qtyColumn, Qt::AlignRight, true, "pendalloc");
  _availability->addColumn(tr("Total Alloc."),_qtyColumn, Qt::AlignRight, true, "totalalloc");
  _availability->addColumn(tr("On Order"),    _qtyColumn, Qt::AlignRight, true, "ordered");
  _availability->addColumn(tr("QOH"),         _qtyColumn, Qt::AlignRight, true, "qoh");
  _availability->addColumn(tr("Availability"),_qtyColumn, Qt::AlignRight, true, "totalavail");
  
  _itemchar = new QStandardItemModel(0, 2, this);
  _itemchar->setHeaderData( 0, Qt::Horizontal, tr("Name"), Qt::DisplayRole);
  _itemchar->setHeaderData( 1, Qt::Horizontal, tr("Value"), Qt::DisplayRole);

  _itemcharView->setModel(_itemchar);
  ItemCharacteristicDelegate * delegate = new ItemCharacteristicDelegate(this);
  _itemcharView->setItemDelegate(delegate);

  _qtyOrdered->setValidator(omfgThis->qtyVal());
  _shippedToDate->setPrecision(omfgThis->qtyVal());
  _onHand->setPrecision(omfgThis->qtyVal());
  _allocated->setPrecision(omfgThis->qtyVal());
  _unallocated->setPrecision(omfgThis->qtyVal());
  _onOrder->setPrecision(omfgThis->qtyVal());
  _available->setPrecision(omfgThis->qtyVal());

  if (!_metrics->boolean("UsePromiseDate"))
  {
    _promisedDateLit->hide();
    _promisedDate->hide();
  }

  _comments->setType(Comments::TransferOrderItem);

  _captive = FALSE;
  _dstwhsid	= -1;
  _itemsiteid	= -1;
  _transwhsid	= -1;
  _toheadid	= -1;
  _taxzoneid	= -1;
  adjustSize();
  
  _inventoryButton->setEnabled(_showAvailability->isChecked());
  _dependencyButton->setEnabled(_showAvailability->isChecked());
  _availability->setEnabled(_showAvailability->isChecked());
  _showIndented->setEnabled(_showAvailability->isChecked());
}
RouterKeygen::RouterKeygen(QWidget *parent) :
		QMainWindow(parent), ui(new Ui::RouterKeygen), loading(NULL), loadingText(
				NULL) {
	ui->setupUi(this);
	connect(ui->calculateButton, SIGNAL( clicked() ), this,
			SLOT( manualCalculation() ));
	connect(ui->refreshScan, SIGNAL( clicked() ), this,
			SLOT( refreshNetworks() ));
	connect(ui->networkslist, SIGNAL( cellClicked(int,int) ), this,
			SLOT( tableRowSelected(int,int) ));
#ifdef Q_OS_UNIX
	connect(ui->forceRefresh, SIGNAL( stateChanged(int) ), this,
			SLOT( forceRefreshToggle(int) ));
#else
	ui->forceRefresh->setVisible(false); // it is not needed in Windows
#endif
	wifiManager = new QWifiManager();
	connect(wifiManager, SIGNAL( scanFinished(int) ), this,
			SLOT( scanFinished(int) ));
	loadingAnim = new QMovie(":/images/loading.gif");
	loadingAnim->setParent(this);
	/*Auto-Complete!*/
	QStringList wordList;
	wordList << "Thomson" << "Blink" << "SpeedTouch" << "O2Wireless"
			<< "Orange-" << "INFINITUM" << "BigPond" << "Otenet" << "Bbox-"
			<< "DMAX" << "privat" << "DLink-" << "Discus--" << "eircom"
			<< "FASTWEB-1-" << "Alice-" << "WLAN_" << "WLAN" << "JAZZTEL_"
			<< "WiFi" << "YaCom" << "SKY" << "TECOM-AH4222-" << "TECOM-AH4021-"
			<< "InfostradaWiFi-" << "TN_private_" << "CYTA" << "PBS" << "CONN"
			<< "OTE" << "Vodafone-" << "EasyBox-" << "Arcor-" << "Megared"
			<< "Optimus" << "OptimusFibra" << "MEO-";
	QCompleter *completer = new QCompleter(wordList, this);
	completer->setCaseSensitivity(Qt::CaseInsensitive);
	completer->setCompletionMode(QCompleter::PopupCompletion);
	ui->ssidInput->setCompleter(completer);
	ui->networkslist->setSelectionBehavior(QAbstractItemView::SelectRows);
	ui->networkslist->setEditTriggers(QAbstractItemView::NoEditTriggers);
	ui->passwordsList->installEventFilter(this);
	this->router = NULL;
	this->calculator = NULL;

	//Set widget ration
	ui->splitter->setStretchFactor(0, 2);
	ui->splitter->setStretchFactor(1, 1);

	// set up and show the system tray icon

	// build menu
	trayMenu = new QMenu(this);
	trayIcon = new QSystemTrayIcon(this);
	trayIcon->setIcon(windowIcon());
	trayIcon->setContextMenu(trayMenu);
	trayIcon->show();

	settings = new QSettings("Exobel", "RouterKeygen");
	bool forceRefresh = settings->value(FORCE_REFRESH, false).toBool();
	wifiManager->setForceScan(forceRefresh);
	ui->forceRefresh->setChecked(forceRefresh);
	runInBackground = settings->value(RUN_IN_BACKGROUND, true).toBool();
	runOnStartUp = settings->value(RUN_ON_START_UP, false).toBool();
	qApp->setQuitOnLastWindowClosed(!runInBackground);
	wifiManager->startScan();

}
Example #7
0
TabWidget::TabWidget( QWidget* parent )
{
    qDebug() << "[TABWIDGET] Constructing";

    mGrabbedWidget = 0;
    mTabs = 0;

    // set the tab position

    setTabsPosition();
    mStatusBar = &mStatusBar->getInstance();

    // create the tabbar

    mBar = new TabBar;
    setTabBar( mBar );

    // connect the mouse clicks

    connect( mBar, SIGNAL( tabRightClicked( int, QPoint ) ),
             this, SLOT( tabRightClicked( int, QPoint ) ) );

    connect( mBar, SIGNAL( tabMiddleClicked( int, QPoint ) ),
             this, SLOT( tabMiddleClicked( int, QPoint ) ) );

    TabButton* newTabButton = new TabButton( this );
    TabButton* mMenuButton = new TabButton( this );

    connect( newTabButton, SIGNAL( clicked() ),
             this, SLOT( addUnityBrowser()) );

    connect( newTabButton, SIGNAL( middleClicked() ),
             this, SLOT( addUnityBrowserWithSR() ) );

    connect( mMenuButton, SIGNAL( clicked() ),
             mMenuButton, SLOT( showMenu()) );

    mMenuButton->setMenu( kueueMainMenu() );

    newTabButton->setIcon( QIcon( ":icons/menus/newtab.png" ) );
    mMenuButton->setIcon( QIcon(":/icons/kueue.png") );

    if ( Settings::unityEnabled() )
    {
        setCornerWidget( newTabButton, Qt::TopRightCorner );
    }

    setCornerWidget( mMenuButton, Qt::TopLeftCorner );

    // create the main browser tabs...

    mQueueBrowser = new QueueBrowser( this );

    mSubownerBrowser = new SubownerBrowser( this );

    mPersonalTab = new BrowserWithSearch( mQueueBrowser, this );

    mSubownerTab = new BrowserWithSearch( mSubownerBrowser, this );

    connect( mQueueBrowser, SIGNAL( setMenus() ),
             this, SLOT( setMenus() ) );

    connect( mSubownerBrowser, SIGNAL( setMenus() ),
             this, SLOT( setMenus() ) );

    connect( mQueueBrowser, SIGNAL( expandAll() ),
             this, SLOT( expandAllTables() ) );

    connect( mQueueBrowser, SIGNAL( closeAll() ),
             this, SLOT( closeAllTables() ) );

    mQmonBrowser = new QMonBrowser( this );
    mMonitorTab = new BrowserWithSearch( mQmonBrowser, this );

    mStatsBrowser = new StatsBrowser( this );
    mStatsTab = new BrowserWithSearch( mStatsBrowser, this );

    if ( Settings::unityEnabled() )
    {
        addUnityBrowser();
        rebuildMaps();
    }

    mSubVisible = true;

    // ...and add them to the tabbar

    insertTab( 0, mPersonalTab, QIcon( ":icons/conf/targets.png" ), "Personal queue" );
    insertTab( 1, mSubownerTab, QIcon( ":icons/conf/targets.png" ), "Subowned SRs" );
    insertTab( 2, mMonitorTab, QIcon( ":/icons/conf/monitor.png" ), "Queue monitor" );
    insertTab( 3, mStatsTab, QIcon( ":/icons/conf/stats.png" ), "Statistics" );

    QShortcut* search = new QShortcut( QKeySequence( Qt::CTRL + Qt::Key_F ), this );

    connect( search, SIGNAL( activated() ),
             this, SLOT( showSearch() ) );

    refreshTabs();
}
CustomFrame::CustomFrame(QWidget *contentWidget, const QString &title)
    : contentWidget_(contentWidget)
{
    this->setWindowFlags(Qt::FramelessWindowHint);
    this->setAttribute(Qt::WA_TranslucentBackground);
    this->setMouseTracking(true);

    isMax_ = false;
    isPress_ = false;

    QLabel *logoLabel = new QLabel();
    QPixmap logoPixmap = this->style()->standardPixmap(QStyle::SP_TitleBarMenuButton);
    logoLabel->setPixmap(logoPixmap);
    logoLabel->setFixedSize(16, 16);
    logoLabel->setScaledContents(true);

    QLabel *titleLabel = new QLabel();
    titleLabel->setText(title);
    QFont titleFont = titleLabel->font();
    titleFont.setBold(true);
    titleLabel->setFont(titleFont);
    titleLabel->setObjectName("whiteLabel");

    QToolButton *minButton = new QToolButton();
    QPixmap minPixmap = this->style()->standardPixmap(QStyle::SP_TitleBarMinButton);
    minButton->setIcon(minPixmap);
    connect(minButton, SIGNAL(clicked()), this, SLOT(slotShowSmall()));

    maxButton_ = new QToolButton();
    maxPixmap_ = this->style()->standardPixmap(QStyle::SP_TitleBarMaxButton);
    restorePixmap_ = this->style()->standardPixmap(QStyle::SP_TitleBarNormalButton);
    maxButton_->setIcon(maxPixmap_);
    connect(maxButton_, SIGNAL(clicked()), this, SLOT(slotShowMaxRestore()));

    QToolButton *closeButton = new QToolButton();
    QPixmap closePixmap = this->style()->standardPixmap(QStyle::SP_TitleBarCloseButton);
    closeButton->setIcon(closePixmap);
    connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));

    QHBoxLayout *titleLayout = new QHBoxLayout();
    titleLayout->addWidget(logoLabel);
    titleLayout->addWidget(titleLabel);
    titleLabel->setContentsMargins(5, 0, 0, 0);
    titleLayout->addStretch();
    titleLayout->addWidget(minButton, 0, Qt::AlignTop);
    titleLayout->addWidget(maxButton_, 0, Qt::AlignTop);
    titleLayout->addWidget(closeButton, 0, Qt::AlignTop);
    titleLayout->setSpacing(0);
    titleLayout->setContentsMargins(5, 0, 0, 0);

    QWidget *titleWidget = new QWidget();
    titleWidget->setLayout(titleLayout);
    titleWidget->installEventFilter(0);

    QVBoxLayout *mainLayout = new QVBoxLayout();
    mainLayout->addWidget(titleWidget);
    mainLayout->addWidget(contentWidget_);
    mainLayout->setSpacing(0);
    mainLayout->setMargin(5);
    this->setLayout(mainLayout);
}
Example #9
0
/*----------------------------------------------------------------------
 * EDIT SEASON DIALOG
 *--------------------------------------------------------------------*/
EditSeasonDialog::EditSeasonDialog(Context *context, Season *season) :
    QDialog(context->mainWindow, Qt::Dialog), context(context), season(season)
{
    setWindowTitle(tr("Edit Date Range"));
    QVBoxLayout *mainLayout = new QVBoxLayout(this);

    // Grid
    QGridLayout *grid = new QGridLayout;
    QLabel *name = new QLabel(tr("Name"));
    QLabel *type = new QLabel(tr("Type"));
    QLabel *from = new QLabel(tr("From"));
    QLabel *to = new QLabel(tr("To"));
    QLabel *seed = new QLabel(tr("Starting LTS"));
    QLabel *low  = new QLabel(tr("Lowest SB"));

    nameEdit = new QLineEdit(this);
    nameEdit->setText(season->getName());

    typeEdit = new QComboBox;
    typeEdit->addItem(tr("Season"), Season::season);
    typeEdit->addItem(tr("Cycle"), Season::cycle);
    typeEdit->addItem(tr("Adhoc"), Season::adhoc);
    typeEdit->setCurrentIndex(typeEdit->findData(season->getType()));

    fromEdit = new QDateEdit(this);
    fromEdit->setDate(season->getStart());

    toEdit = new QDateEdit(this);
    toEdit->setDate(season->getEnd());

    seedEdit = new QDoubleSpinBox(this);
    seedEdit->setDecimals(0);
    seedEdit->setRange(0.0, 300.0);
    seedEdit->setSingleStep(1.0);
    seedEdit->setWrapping(true);
    seedEdit->setAlignment(Qt::AlignLeft);
    seedEdit->setValue(season->getSeed());
    
    lowEdit = new QDoubleSpinBox(this);
    lowEdit->setDecimals(0);
    lowEdit->setRange(-500, 0);
    lowEdit->setSingleStep(1.0);
    lowEdit->setWrapping(true);
    lowEdit->setAlignment(Qt::AlignLeft);
    lowEdit->setValue(season->getLow());
    

    grid->addWidget(name, 0,0);
    grid->addWidget(nameEdit, 0,1);
    grid->addWidget(type, 1,0);
    grid->addWidget(typeEdit, 1,1);
    grid->addWidget(from, 2,0);
    grid->addWidget(fromEdit, 2,1);
    grid->addWidget(to, 3,0);
    grid->addWidget(toEdit, 3,1);
    grid->addWidget(seed, 4,0);
    grid->addWidget(seedEdit, 4,1);
    grid->addWidget(low, 5,0);
    grid->addWidget(lowEdit, 5,1);

    mainLayout->addLayout(grid);

    // Buttons
    QHBoxLayout *buttonLayout = new QHBoxLayout;
    buttonLayout->addStretch();
    applyButton = new QPushButton(tr("&OK"), this);
    cancelButton = new QPushButton(tr("&Cancel"), this);
    buttonLayout->addWidget(cancelButton);
    buttonLayout->addWidget(applyButton);
    mainLayout->addLayout(buttonLayout);

    // connect up slots
    connect(applyButton, SIGNAL(clicked()), this, SLOT(applyClicked()));
    connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelClicked()));
}
Example #10
0
void DiskRipper::RipTrack(int track,int end_track,QString cutname,QString title)
{
  RDCdRipper *ripper=NULL;
  RDCut *cut=new RDCut(cutname);
  RDCart *cart=new RDCart(cut->cartNumber());
  QString sql;
  RDSqlQuery *q;

  //
  // Create Cut
  //
  sql=QString("insert into CUTS set ")+
    "CUT_NAME=\""+RDEscapeString(cutname)+"\","+
    QString().sprintf("CART_NUMBER=%u,",cut->cartNumber())+
    "DESCRIPTION=\""+tr("Cut")+" 001\"";
  q=new RDSqlQuery(sql);
  delete q;
  
  rip_done=false;
  rip_rip_aborted=false;
  rip_track_number=track;
  rip_title=title;
  rip_cutname=cutname;
  if(title.isEmpty()) {
    rip_trackbar_label->setText(tr("Track Progress")+" - "+tr("Track")+
				QString().sprintf(" %d",track));
  }
  else {
    rip_trackbar_label->setText(tr("Track Progress")+" - "+title);
  }
  rip_diskbar_label->setEnabled(true);
  rip_trackbar_label->setEnabled(true);

  //
  // Rip from disc
  //
  RDAudioImport::ErrorCode conv_err;
  RDAudioConvert::ErrorCode audio_conv_err;
  RDCdRipper::ErrorCode ripper_err;
  QString tmpdir=RDTempDir();
  QString tmpfile=tmpdir+"/"+RIPPER_TEMP_WAV;
  if(rip_profile_rip) {
    ripper=new RDCdRipper(stdout,this);
  }
  else {
    ripper=new RDCdRipper(NULL,this);
  }
  rip_track_bar->setTotalSteps(ripper->totalSteps()+1);
  connect(ripper,SIGNAL(progressChanged(int)),
	  rip_track_bar,SLOT(setProgress(int)));
  connect(rip_rip_button,SIGNAL(clicked()),ripper,SLOT(abort()));
  RDAudioImport *conv=NULL;
  RDSettings *settings=NULL;
  ripper->setDevice(rdlibrary_conf->ripperDevice());
  ripper->setDestinationFile(tmpfile);
  switch((ripper_err=ripper->rip(rip_track_number-1,end_track-1))) {
  case RDCdRipper::ErrorOk:
    conv=new RDAudioImport(rdstation_conf,lib_config,this);
    conv->setSourceFile(tmpfile);
    conv->setCartNumber(cut->cartNumber());
    conv->setCutNumber(cut->cutNumber());
    conv->setUseMetadata(false);
    settings=new RDSettings();
    if(rdlibrary_conf->defaultFormat()==1) {
      settings->setFormat(RDSettings::MpegL2Wav);
    }
    else {
      settings->setFormat(RDSettings::Pcm16);
    }
    settings->setChannels(rip_channels_box->currentText().toInt());
    settings->setSampleRate(lib_system->sampleRate());
    settings->setBitRate(rdlibrary_conf->defaultBitrate());
    if(rip_normalize_box->isChecked()) {
      settings->setNormalizationLevel(rip_normalize_spin->value());
    }
    if(rip_autotrim_box->isChecked()) {
      settings->setAutotrimLevel(rip_autotrim_spin->value());
    }
    conv->setDestinationSettings(settings);
    switch((conv_err=conv->
	    runImport(lib_user->name(),lib_user->password(),
		      &audio_conv_err))) {
    case RDAudioImport::ErrorOk:
      cart->setMetadata(rip_wave_datas[track-1]);
      cut->setDescription(rip_wave_datas[track-1]->title());
      cut->setIsrc(rip_cddb_record.isrc(rip_track_number-1));
      cart->clearPending();
      break;

    default:
      cart->remove(rdstation_conf,lib_user,lib_config);
      QMessageBox::warning(this,tr("RDLibrary - Importer Error"),
			   RDAudioImport::errorText(conv_err,audio_conv_err));
      break;
    }
    delete settings;
    delete conv;
    break;

  case RDCdRipper::ErrorNoDevice:
  case RDCdRipper::ErrorNoDestination:
  case RDCdRipper::ErrorInternal:
  case RDCdRipper::ErrorNoDisc:
  case RDCdRipper::ErrorNoTrack:
    cart->remove(rdstation_conf,lib_user,lib_config);
    QMessageBox::warning(this,tr("RDLibrary - Ripper Error"),
			 RDCdRipper::errorText(ripper_err));
    break;

  case RDCdRipper::ErrorAborted:
    rip_aborting=true;
    cart->remove(rdstation_conf,lib_user,lib_config);
    break;
  }
  delete ripper;
  unlink(tmpfile);
  rmdir(tmpdir);
  rip_track_bar->setProgress(0);
  rip_track_bar->setPercentageVisible(true);

  delete cart;
  delete cut;
}
Example #11
0
CustInfo::CustInfo(QWidget *pParent, const char *name) :
  QWidget(pParent, name)
{
//  Create and place the component Widgets
  QHBoxLayout *layoutMain = new QHBoxLayout(this, 0, 6, "layoutMain"); 
  QHBoxLayout *layoutNumber = new QHBoxLayout(0, 0, 6, "layoutNumber"); 
  QHBoxLayout *layoutButtons = new QHBoxLayout(0, 0, -1, "layoutButtons"); 

  _customerNumberLit = new QLabel(tr("Customer #:"), this, "_customerNumberLit");
  _customerNumberLit->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
  layoutNumber->addWidget(_customerNumberLit);

  _customerNumber = new CLineEdit(this, "_customerNumber");
  _customerNumber->setMinimumWidth(100);
  layoutNumber->addWidget(_customerNumber);
  
  _customerNumberEdit = new XLineEdit(this, "_customerNumberEdit");
  _customerNumberEdit->setMinimumWidth(100);
  _customerNumberEdit->setMaximumWidth(100);
  layoutNumber->addWidget(_customerNumberEdit);
  _customerNumberEdit->hide();
  layoutMain->addLayout(layoutNumber);

  _list = new QPushButton(tr("..."), this, "_list");
  _list->setFocusPolicy(Qt::NoFocus);
  if(_x_preferences)
  {
    if(_x_preferences->value("DefaultEllipsesAction") == "search")
      _list->setToolTip(tr("Search"));
    else
      _list->setToolTip(tr("List"));
  }
  layoutButtons->addWidget(_list);

  _info = new QPushButton(tr("?"), this, "_info");
  _info->setFocusPolicy(Qt::NoFocus);
  _info->setToolTip(tr("Open"));
  _info->setEnabled(false);
  layoutButtons->addWidget(_info);
  connect(this, SIGNAL(valid(bool)), _info, SLOT(setEnabled(bool)));
  
  _delete = new QPushButton(tr("x"), this, "_delete");
  _delete->setFocusPolicy(Qt::NoFocus);
  _delete->setToolTip(tr("Delete"));
  layoutButtons->addWidget(_delete);
  
  _new = new QPushButton(tr("+"), this, "_new");
  _new->setFocusPolicy(Qt::NoFocus);
  _new->setToolTip(tr("New"));
  layoutButtons->addWidget(_new);

  _edit = new QPushButton(tr("!"), this, "_edit");
  _edit->setFocusPolicy(Qt::NoFocus);
  _edit->setCheckable(true);
  _edit->setToolTip(tr("Edit Mode"));
  layoutButtons->addWidget(_edit);
  
#ifndef Q_WS_MAC
  _list->setMaximumWidth(25);
  _info->setMaximumWidth(25);
  _new->setMaximumWidth(25);
  _edit->setMaximumWidth(25);
  _delete->setMaximumWidth(25);
#else
  _list->setMinimumWidth(60);
  _list->setMinimumHeight(32);
  _info->setMinimumWidth(60);
  _info->setMinimumHeight(32);
  _new->setMinimumWidth(60);
  _new->setMinimumHeight(32);
  _edit->setMinimumWidth(60);
  _edit->setMinimumHeight(32);
  _delete->setMinimumWidth(60);
  _delete->setMinimumHeight(32);
  layoutNumber->setContentsMargins(2,0,0,0);
  layoutButtons->setContentsMargins(0,8,0,0);
  layoutButtons->setSpacing(6);
#endif
  
  layoutMain->addLayout(layoutButtons);

//  Make some internal connections
  connect(_list, SIGNAL(clicked()), _customerNumber, SLOT(sEllipses()));
  connect(_info, SIGNAL(clicked()), this, SLOT(sInfo()));

  connect(_customerNumber, SIGNAL(newId(int)), this, SIGNAL(newId(int)));
  connect(_customerNumber, SIGNAL(custNameChanged(const QString &)), this, SIGNAL(nameChanged(const QString &)));
  connect(_customerNumber, SIGNAL(custAddr1Changed(const QString &)), this, SIGNAL(address1Changed(const QString &)));
  connect(_customerNumber, SIGNAL(custAddr2Changed(const QString &)), this, SIGNAL(address2Changed(const QString &)));
  connect(_customerNumber, SIGNAL(custAddr3Changed(const QString &)), this, SIGNAL(address3Changed(const QString &)));
  connect(_customerNumber, SIGNAL(custCityChanged(const QString &)), this, SIGNAL(cityChanged(const QString &)));
  connect(_customerNumber, SIGNAL(custStateChanged(const QString &)), this, SIGNAL(stateChanged(const QString &)));
  connect(_customerNumber, SIGNAL(custZipCodeChanged(const QString &)), this, SIGNAL(zipCodeChanged(const QString &)));
  connect(_customerNumber, SIGNAL(custCountryChanged(const QString &)), this, SIGNAL(countryChanged(const QString &)));
  connect(_customerNumber, SIGNAL(custAddressChanged(const int)), this, SIGNAL(addressChanged(const int)));
  connect(_customerNumber, SIGNAL(custContactChanged(const int)), this, SIGNAL(contactChanged(const int)));
  connect(_customerNumber, SIGNAL(valid(bool)), this, SIGNAL(valid(bool)));

  connect(_customerNumber, SIGNAL(creditStatusChanged(const QString &)), this, SLOT(sHandleCreditStatus(const QString &)));
  connect(_customerNumber, SIGNAL(textChanged(const QString &)), _customerNumberEdit, SLOT(setText(const QString &)));
  connect(_customerNumberEdit, SIGNAL(editingFinished()), this, SIGNAL(editingFinished()));
  connect(_edit, SIGNAL(clicked()), this, SLOT(setMode()));
  connect(_new, SIGNAL(clicked()), this, SLOT(sNewClicked()));
  connect(_delete, SIGNAL(clicked()), this, SIGNAL(deleteClicked()));
  connect(_customerNumber, SIGNAL(newId(int)), this, SLOT(setMode()));

  if(_x_privileges && (!_x_privileges->check("MaintainCustomerMasters") && !_x_privileges->check("ViewCustomerMasters")))
  {
    _info->setEnabled(false);
    _delete->setEnabled(false);
    _edit->setEnabled(false);
    _new->setEnabled(false);
  }
  else
  {
    connect(_customerNumber, SIGNAL(valid(bool)), _info, SLOT(setEnabled(bool)));
    connect(_customerNumber, SIGNAL(requestInfo()), this, SLOT(sInfo()));
  }
  
  if(_x_privileges && (!_x_privileges->check("MaintainCustomerMasters") ))
  {
    _delete->setEnabled(false);
    _edit->setEnabled(false);
    _new->setEnabled(false);
  }

  setFocusProxy(_customerNumber);

  _mapper = new XDataWidgetMapper(this);
  _labelVisible = true;
  _canEdit=true;
  setCanEdit(false);
}
Example #12
0
DiskRipper::DiskRipper(QString *filter,QString *group,QString *schedcode,
		       bool profile_rip,QWidget *parent,const char *name) 
  : QDialog(parent,name)
{
  rip_isrc_read=false;
  rip_filter_text=filter;
  rip_group_text=group;
  rip_schedcode_text=schedcode;
  rip_profile_rip=profile_rip;
  rip_aborting=false;

  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());

  //
  // Generate Fonts
  //
  QFont button_font=QFont("Helvetica",12,QFont::Bold);
  button_font.setPixelSize(12);
  QFont label_font=QFont("Helvetica",12,QFont::Bold);
  label_font.setPixelSize(12);

  setCaption(tr("Rip Disk"));

  //
  // Create Dialogs
  //
  rip_wavedata_dialog=new RDWaveDataDialog("RDLibrary",this);

  //
  // Create Temporary Directory
  //
  char path[PATH_MAX];
  strncpy(path,RDTempDir(),PATH_MAX);
  strcat(path,"/XXXXXX");
  if(mkdtemp(path)==NULL) {
    QMessageBox::warning(this,"RDLibrary - "+tr("Ripper Error"),
			 tr("Unable to create temporary directory!"));
  }
  else {
    rip_cdda_dir.setPath(path);
  }

  //
  // The CDROM Drive
  //
  if(rip_profile_rip) {
    rip_cdrom=new RDCdPlayer(stdout,this);
  }
  else {
    rip_cdrom=new RDCdPlayer(NULL,this);
  }
  connect(rip_cdrom,SIGNAL(ejected()),this,SLOT(ejectedData()));
  connect(rip_cdrom,SIGNAL(mediaChanged()),this,SLOT(mediaChangedData()));
  connect(rip_cdrom,SIGNAL(played(int)),this,SLOT(playedData(int)));
  connect(rip_cdrom,SIGNAL(stopped()),this,SLOT(stoppedData()));
  rip_cdrom->setDevice(rdlibrary_conf->ripperDevice());
  rip_cdrom->open();

  //
  // CDDB Stuff
  //
  if(rip_profile_rip) {
    rip_cddb_lookup=new RDCddbLookup(stdout,this);
  }
  else {
    rip_cddb_lookup=new RDCddbLookup(NULL,this);
  }
  connect(rip_cddb_lookup,SIGNAL(done(RDCddbLookup::Result)),
	  this,SLOT(cddbDoneData(RDCddbLookup::Result)));

  //
  // Artist Label
  //
  QLabel *label=new QLabel(tr("Artist:"),this);
  label->setGeometry(10,10,50,18);
  label->setFont(label_font);
  label->setAlignment(AlignRight|AlignVCenter);
  rip_artist_edit=new QLineEdit(this);

  //
  // Album Edit
  //
  label=new QLabel(tr("Album:"),this);
  label->setGeometry(10,32,50,18);
  label->setFont(label_font);
  label->setAlignment(AlignRight|AlignVCenter);
  rip_album_edit=new QLineEdit(this);

  //
  // Other Edit
  //
  label=new QLabel(tr("Other:"),this);
  label->setGeometry(10,54,50,16);
  label->setFont(label_font);
  label->setAlignment(AlignRight);
  rip_other_edit=new QTextEdit(this);
  rip_other_edit->setReadOnly(true);

  //
  // Apply FreeDB Check Box
  //
  rip_apply_box=new QCheckBox(this,"rip_apply_box");
  rip_apply_box->setChecked(true);
  rip_apply_box->setDisabled(true);
  rip_apply_label=
    new QLabel(rip_apply_box,tr("Apply FreeDB Values to Carts"),this);
  rip_apply_label->setFont(label_font);
  rip_apply_label->setAlignment(AlignLeft);
  rip_apply_box->setChecked(false);
  rip_apply_label->setDisabled(true);

  //
  // Track List
  //
  rip_track_list=new QListView(this);
  rip_track_list->setAllColumnsShowFocus(true);
  rip_track_list->setItemMargin(5);
  rip_track_list->setSorting(-1);
  rip_track_list->setSelectionMode(QListView::Extended);
  connect(rip_track_list,SIGNAL(selectionChanged()),
	  this,SLOT(selectionChangedData()));
  connect(rip_track_list,
	  SIGNAL(doubleClicked(QListViewItem *,const QPoint &,int)),
	  this,
	  SLOT(doubleClickedData(QListViewItem *,const QPoint &,int)));
  rip_track_label=new QLabel(rip_track_list,tr("Tracks"),this);
  rip_track_label->setFont(label_font);
  rip_track_list->addColumn(tr("TRACK"));
  rip_track_list->setColumnAlignment(0,Qt::AlignHCenter);
  rip_track_list->addColumn(tr("LENGTH"));
  rip_track_list->setColumnAlignment(1,Qt::AlignRight);
  rip_track_list->addColumn(tr("TITLE"));
  rip_track_list->setColumnAlignment(2,Qt::AlignLeft);
  rip_track_list->addColumn(tr("OTHER"));
  rip_track_list->setColumnAlignment(3,Qt::AlignLeft);
  rip_track_list->addColumn(tr("TYPE"));
  rip_track_list->setColumnAlignment(4,Qt::AlignLeft);
  rip_track_list->addColumn(tr("CUT"));
  rip_track_list->setColumnAlignment(5,Qt::AlignLeft);

  //
  // Progress Bars
  //
  rip_disk_bar=new QProgressBar(this);
  rip_diskbar_label=new QLabel(tr("Disk Progress"),this);
  rip_diskbar_label->setFont(label_font);
  rip_diskbar_label->setAlignment(AlignLeft|AlignVCenter);
  rip_diskbar_label->setDisabled(true);
  rip_track_bar=new QProgressBar(this);
  rip_trackbar_label=new QLabel(tr("Track Progress"),this);
  rip_trackbar_label->setFont(label_font);
  rip_trackbar_label->setAlignment(AlignLeft|AlignVCenter);
  rip_trackbar_label->setDisabled(true);

  //
  // Eject Button
  //
  rip_eject_button=new RDTransportButton(RDTransportButton::Eject,this);
  connect(rip_eject_button,SIGNAL(clicked()),this,SLOT(ejectButtonData()));
  
  //
  // Play Button
  //
  rip_play_button=new RDTransportButton(RDTransportButton::Play,this);
  connect(rip_play_button,SIGNAL(clicked()),this,SLOT(playButtonData()));
  
  //
  // Stop Button
  //
  rip_stop_button=new RDTransportButton(RDTransportButton::Stop,this);
  rip_stop_button->setOnColor(red);
  rip_stop_button->on();
  connect(rip_stop_button,SIGNAL(clicked()),this,SLOT(stopButtonData()));
  
  //
  // Set Cut Button
  //
  rip_setcut_button=new QPushButton(tr("Set\n&Cart/Cut"),this);
  rip_setcut_button->setFont(button_font);
  rip_setcut_button->setDisabled(true);
  connect(rip_setcut_button,SIGNAL(clicked()),this,SLOT(setCutButtonData()));

  //
  // Set Multi Tracks Button
  //
  rip_setall_button=new QPushButton(tr("Add Cart\nPer Track"),this);
  rip_setall_button->setFont(button_font);
  rip_setall_button->setDisabled(true);
  connect(rip_setall_button,SIGNAL(clicked()),this,SLOT(setMultiButtonData()));

  //
  // Set Single Button
  //
  rip_setsingle_button=new QPushButton(tr("Add Single\nCart"),this);
  rip_setsingle_button->setFont(button_font);
  rip_setsingle_button->setDisabled(true);
  connect(rip_setsingle_button,SIGNAL(clicked()),
	  this,SLOT(setSingleButtonData()));

  //
  // Set Cart Label Button
  //
  rip_cartlabel_button=new QPushButton(tr("Modify\nCart Label"),this);
  rip_cartlabel_button->setFont(button_font);
  rip_cartlabel_button->setDisabled(true);
  connect(rip_cartlabel_button,SIGNAL(clicked()),
	  this,SLOT(modifyCartLabelData()));

  //
  // Clear Selection Button
  //
  rip_clear_button=new QPushButton(tr("Clear\nSelection"),this);
  rip_clear_button->setFont(button_font);
  rip_clear_button->setDisabled(true);
  connect(rip_clear_button,SIGNAL(clicked()),this,SLOT(clearSelectionData()));

  //
  // Normalize Check Box
  //
  rip_normalize_box=new QCheckBox(this);
  rip_normalize_box->setChecked(true);
  rip_normalizebox_label=new QLabel(rip_normalize_box,tr("Normalize"),this);
  rip_normalizebox_label->setFont(label_font);
  rip_normalizebox_label->setAlignment(AlignLeft|AlignVCenter);
  connect(rip_normalize_box,SIGNAL(toggled(bool)),
	  this,SLOT(normalizeCheckData(bool)));

  //
  // Normalize Level
  //
  rip_normalize_spin=new QSpinBox(this);
  rip_normalize_spin->setRange(-30,0);
  rip_normalize_label=new QLabel(rip_normalize_spin,tr("Level:"),this);
  rip_normalize_label->setFont(label_font);
  rip_normalize_label->setAlignment(AlignRight|AlignVCenter);
  rip_normalize_unit=new QLabel(tr("dBFS"),this);
  rip_normalize_unit->setFont(label_font);
  rip_normalize_unit->setAlignment(AlignLeft|AlignVCenter);

  //
  // Autotrim Check Box
  //
  rip_autotrim_box=new QCheckBox(this);
  rip_autotrim_box->setChecked(true);
  rip_autotrimbox_label=new QLabel(rip_autotrim_box,tr("Autotrim"),this);
  rip_autotrimbox_label->setFont(label_font);
  rip_autotrimbox_label->setAlignment(AlignLeft|AlignVCenter);
  connect(rip_autotrim_box,SIGNAL(toggled(bool)),
	  this,SLOT(autotrimCheckData(bool)));

  //
  // Autotrim Level
  //
  rip_autotrim_spin=new QSpinBox(this);
  rip_autotrim_spin->setRange(-99,0);
  rip_autotrim_label=new QLabel(rip_autotrim_spin,tr("Level:"),this);
  rip_autotrim_label->setFont(label_font);
  rip_autotrim_label->setAlignment(AlignRight|AlignVCenter);
  rip_autotrim_unit=new QLabel(tr("dBFS"),this);
  rip_autotrim_unit->setFont(label_font);
  rip_autotrim_unit->setAlignment(AlignLeft|AlignVCenter);

  //
  // Channels
  //
  rip_channels_box=new QComboBox(this);
  rip_channels_label=new QLabel(rip_channels_box,tr("Channels:"),this);
  rip_channels_label->setFont(label_font);
  rip_channels_label->setAlignment(AlignRight|AlignVCenter);

  //
  // Rip Disc Button
  //
  rip_rip_button=new QPushButton(tr("&Rip\nDisc"),this);
  rip_rip_button->setFont(button_font);
  connect(rip_rip_button,SIGNAL(clicked()),this,SLOT(ripDiskButtonData()));
  rip_rip_button->setDisabled(true);

  //
  // Close Button
  //
  rip_close_button=new QPushButton(tr("&Close"),this);
  rip_close_button->setFont(button_font);
  connect(rip_close_button,SIGNAL(clicked()),this,SLOT(closeData()));

  //
  // Populate Data
  //
  rip_normalize_spin->setValue(rdlibrary_conf->ripperLevel()/100);
  rip_autotrim_spin->setValue(rdlibrary_conf->trimThreshold()/100);
  rip_channels_box->insertItem("1");
  rip_channels_box->insertItem("2");
  rip_channels_box->setCurrentItem(rdlibrary_conf->defaultChannels()-1);
  rip_done=false;
}
Example #13
0
void DiskRipper::ripDiskButtonData()
{
  RDListViewItem *item=(RDListViewItem *)rip_track_list->selectedItem();
  if(item!=NULL) {
    rip_track_list->setSelected(item,false);
  }
  rip_aborting=false;

  //
  // Calculate number of tracks to rip
  //
  int tracks=0;
  for(unsigned i=0;i<rip_cutnames.size();i++) {
    if(!rip_cutnames[i].isEmpty()) {
      tracks++;
    }
  }
  rip_disk_bar->setTotalSteps(tracks);

  //
  // Read ISRCs
  //
  if(!rip_isrc_read) {
    rip_cddb_lookup->
      readIsrc(rip_cdda_dir.path(),rdlibrary_conf->ripperDevice());
    rip_isrc_read=true;
  }

  //
  // Rip
  //
  tracks=0;
  item=(RDListViewItem *)rip_track_list->firstChild();
  while((item!=NULL)&&(!rip_aborting)) {
    if(!rip_cutnames[item->text(0).toInt()-1].isEmpty()) {
      rip_eject_button->setDisabled(true);
      rip_play_button->setDisabled(true);
      rip_stop_button->setDisabled(true);
      rip_rip_button->setText(tr("Abort\nRip"));
      disconnect(rip_rip_button,SIGNAL(clicked()),
		 this,SLOT(ripDiskButtonData()));
      rip_setcut_button->setDisabled(true);
      rip_setall_button->setDisabled(true);
      rip_cartlabel_button->setDisabled(true);
      rip_clear_button->setDisabled(true);
      rip_close_button->setDisabled(true);
      rip_normalize_box->setDisabled(true);
      rip_normalize_spin->setDisabled(true);
      rip_channels_box->setDisabled(true);
      rip_autotrim_box->setDisabled(true);
      rip_autotrim_spin->setDisabled(true);
      rip_disk_bar->setProgress(tracks++);
      rip_disk_bar->setPercentageVisible(true);
      int start_track=item->text(0).toInt();
      int end_track=rip_end_track[item->text(0).toInt()-1];
      RipTrack(start_track,end_track,rip_cutnames[item->text(0).toInt()-1],
	       BuildTrackName(start_track,end_track));
    }
    item=(RDListViewItem *)item->nextSibling();
  }
  rip_eject_button->setEnabled(true);
  rip_play_button->setEnabled(true);
  rip_stop_button->setEnabled(true);
  rip_setcut_button->setEnabled(false);
  rip_setall_button->setEnabled(false);
  rip_setsingle_button->setEnabled(false);
  rip_cartlabel_button->setEnabled(false);
  rip_clear_button->setEnabled(false);
  rip_close_button->setEnabled(true);
  rip_rip_button->setText(tr("Rip\nDisk"));
  rip_rip_button->setEnabled(false);
  connect(rip_rip_button,SIGNAL(clicked()),this,SLOT(ripDiskButtonData()));
  rip_normalize_box->setEnabled(true);
  rip_normalize_spin->setEnabled(true);
  rip_channels_box->setEnabled(true);
  rip_autotrim_box->setEnabled(true);
  rip_autotrim_spin->setEnabled(true);
  rip_disk_bar->setPercentageVisible(false);
  rip_disk_bar->reset();
  rip_diskbar_label->setDisabled(true);
  rip_trackbar_label->setDisabled(true);
  rip_diskbar_label->setText(tr("Total Progress"));
  rip_trackbar_label->setText(tr("Track Progress"));
  item=(RDListViewItem *)rip_track_list->firstChild();
  while(item!=NULL) {
    item->setText(5,"");
    item=(RDListViewItem *)item->nextSibling();
  }
  rip_cdrom->eject();
  if(rip_aborting) {
    QMessageBox::information(this,tr("Rip Complete"),tr("Rip aborted!"));
  }
  else {
    QMessageBox::information(this,tr("Rip Complete"),tr("Rip complete!"));
  }
}
Example #14
0
EditorView::EditorView(QWidget *parent) :
    QWidget(parent)
{
    p = new EditorViewPrivate;
    p->save_timer = 0;
    p->paperId = 0;
    p->signal_blocker = false;
    p->synced = true;
    p->has_files = false;

    if( !back_image )
        back_image = new QImage(":/qml/Kaqaz/files/background.jpg");
    if( !papers_image )
        papers_image = new QImage(":/qml/Kaqaz/files/paper.png");
    if( !paper_clip )
        paper_clip = new QImage(":/qml/Kaqaz/files/paper-clip.png");
    if( !paper_clip_off )
        paper_clip_off = new QImage(":/qml/Kaqaz/files/paper-clip-off.png");

    p->attach_img = *paper_clip;

    p->title_font = Kaqaz::instance()->titleFont();
    p->body_font = Kaqaz::instance()->bodyFont();

    p->group_font.setFamily("Droid Kaqaz Sans");
    p->group_font.setPointSize(9);

    p->date_font.setFamily("Droid Kaqaz Sans");
    p->date_font.setPointSize(8);

    p->group = new GroupButton(this);
    p->group->move(25,PAPER_BRD-1);
    p->group->setFixedSize(110,30);
    p->group->setFont(p->group_font);

    p->title = new QLineEdit();
    p->title->setPlaceholderText( tr("Title") );
    p->title->setAlignment(Qt::AlignHCenter);
    p->title->setFont(p->title_font);
    p->title->setStyleSheet("QLineEdit{background: transparent; border: 0px solid translarent}");

    p->body = new PaperTextArea();
    p->body->setPlaceholderText( tr("Text...") );
    p->body->setViewFont(p->body_font);
    p->body->setStyleSheet("QTextEdit{background: transparent; border: 0px solid translarent}");

    p->date = new QLabel(this);
    p->date->setFixedWidth(200);
    p->date->setFont(p->date_font);

    p->top_layout = new QHBoxLayout();
    p->top_layout->addSpacing(p->group->width());
    p->top_layout->addWidget(p->title);
    p->top_layout->addSpacing(p->group->width());
    p->top_layout->setContentsMargins(0,0,0,0);
    p->top_layout->setSpacing(0);

    p->main_layout = new QVBoxLayout(this);
    p->main_layout->addLayout(p->top_layout);
    p->main_layout->addWidget(p->body);
    p->main_layout->setContentsMargins(30,20,30,45);
    p->main_layout->setSpacing(0);

    p->attach_btn = new QPushButton(this);
    p->attach_btn->setFixedSize( PAPER_CLP, PAPER_CLP );
    p->attach_btn->move( width()-PAPER_CLP, height()-PAPER_CLP );
    p->attach_btn->setStyleSheet("QPushButton{ border: 0px solid transparent; background: transparent }");
    p->attach_btn->setCursor(Qt::PointingHandCursor);

    p->files = new PaperFilesView(this);
    p->files->setFixedSize( width(), FILES_HEIGHT );
    p->files->move( 0, height()-FILES_HEIGHT );
    p->files->hide();

    setStyleSheet("QScrollBar:vertical { border: 0px solid transparent; background: transparent; max-width: 5px; min-width: 5px; }"
                  "QScrollBar::handle:vertical { border: 0px solid transparent; background: #aaaaaa; width: 5px; min-width: 5px; min-height: 30px }"
                  "QScrollBar::handle:hover { background: palette(highlight); }"
                  "QScrollBar::add-line:vertical { border: 0px solid transparent; background: transparent; height: 0px; subcontrol-position: bottom; subcontrol-origin: margin; }"
                  "QScrollBar::sub-line:vertical { border: 0px solid transparent; background: transparent; height: 0px; subcontrol-position: top; subcontrol-origin: margin; }" );

    connect( p->title, SIGNAL(textChanged(QString)), SLOT(delayedSave()) );
    connect( p->body , SIGNAL(textChanged())       , SLOT(delayedSave()) );
    connect( p->group, SIGNAL(groupSelected(int))  , SLOT(delayedSave()) );

    connect( p->attach_btn, SIGNAL(clicked()), p->files, SLOT(show()) );

    connect( Kaqaz::instance(), SIGNAL(titleFontChanged())          , SLOT(titleFontChanged())           );
    connect( Kaqaz::instance(), SIGNAL(bodyFontChanged())           , SLOT(bodyFontChanged())            );
    connect( Kaqaz::database(), SIGNAL(revisionChanged(QString,int)), SLOT(revisionChanged(QString,int)) );
    connect( Kaqaz::database(), SIGNAL(paperChanged(int))           , SLOT(paperChanged(int))            );
}
Example #15
0
VerifyDlg::VerifyDlg( const char* workingDir, int fileno, const RangeList& ranges,
                      bool restore, QWidget* parent, const char* name )
        : QDialog( parent, name, TRUE ),
          _restore( restore ),
          _proc( NULL ),
          _workingDir( workingDir ),
          _fileno( fileno ),
          _ranges( ranges ),
          _totalKBytes( 0.0 ),
          _fileCount( 0 ),
          _wroteStdin( TRUE ),
          _aborted( FALSE ),
          _done( FALSE )
{
    // Calculate size of verify.
    QListIterator<Range> i( _ranges.getRanges() );
    _archiveSize = 0;
    for ( ; i.current(); ++i ) {
        _archiveSize += i.current()->getEnd() - i.current()->getStart();
    }
    _archiveSize = ( _archiveSize + 1 ) / 2;
    
    if ( _restore ) {
        setCaption( i18n( "KDat: Restore" ) );
        setIconText( i18n( "KDat: Restore" ) );
    } else {
        setCaption( i18n( "KDat: Verify" ) );
        setIconText( i18n( "KDat: Verify" ) );
    }

    resize( 500, 300 );

    const int labelWidth = 96;

    QFrame* f1 = new QFrame( this );
    f1->setFrameStyle( QFrame::Panel | QFrame::Sunken );

    QFrame* f2 = new QFrame( this );
    f2->setFrameStyle( QFrame::Panel | QFrame::Sunken );

    QLabel* lbl1 = new QLabel( i18n( "Elapsed time:" ), f1 );
    lbl1->setFixedSize( labelWidth, lbl1->sizeHint().height() );

    _elapsedTime = new QLabel( i18n( "00:00:00" ), f1 );
    _elapsedTime->setFixedHeight( _elapsedTime->sizeHint().height() );

    QLabel* lbl2 = new QLabel( i18n( "Time remaining:" ), f2 );
    lbl2->setFixedSize( labelWidth, lbl2->sizeHint().height() );

    _timeRemaining = new QLabel( i18n( "00:00:00" ), f2 );
    _timeRemaining->setFixedHeight( _timeRemaining->sizeHint().height() );

    QLabel* lbl3 = new QLabel( i18n( "Total kbytes:" ), f1 );
    lbl3->setFixedSize( labelWidth, lbl3->sizeHint().height() );

    QLabel* totalKbytes = new QLabel( Util::kbytesToString( _archiveSize ), f1 );
    totalKbytes->setFixedHeight( totalKbytes->sizeHint().height() );

    QLabel* lbl4 = new QLabel( i18n( "Kbytes read:" ), f2 );
    lbl4->setFixedSize( labelWidth, lbl4->sizeHint().height() );

    _kbytesRead = new QLabel( i18n( "0k" ), f2 );
    _kbytesRead->setFixedHeight( _kbytesRead->sizeHint().height() );

    QLabel* lbl5 = new QLabel( i18n( "Transfer rate:" ), f1 );
    lbl5->setFixedSize( labelWidth, lbl5->sizeHint().height() );

    _transferRate = new QLabel( i18n( "0k/min" ), f1 );
    _transferRate->setFixedHeight( _transferRate->sizeHint().height() );

    QLabel* lbl6;
    if ( _restore ) {
        lbl6 = new QLabel( i18n( "Files:" ), f2 );
        lbl6->setFixedSize( labelWidth, lbl6->sizeHint().height() );
    } else {
        lbl6 = new QLabel( i18n( "Differences:" ), f2 );
        lbl6->setFixedSize( labelWidth, lbl6->sizeHint().height() );
    }

    _files = new QLabel( "0", f2 );
    _files->setFixedHeight( _files->sizeHint().height() );

    if ( _restore ) {
        _log = new LoggerWidget( i18n( "Restore log:" ), this );
    } else {
        _log = new LoggerWidget( i18n( "Verify log:" ), this );
    }

    _ok = new QPushButton( i18n( "OK" ), this );
    _ok->setFixedSize( 80, _ok->sizeHint().height() );
    connect( _ok, SIGNAL( clicked() ), this, SLOT( slotOK() ) );
    _ok->setEnabled( FALSE );

    _save = new QPushButton( i18n( "Save Log..." ), this );
    _save->setFixedSize( 80, _save->sizeHint().height() );
    connect( _save, SIGNAL( clicked() ), _log, SLOT( save() ) );
    _save->setEnabled( FALSE );

    _abort = new QPushButton( i18n( "Abort" ), this );
    _abort->setFixedSize( 80, _abort->sizeHint().height() );
    connect( _abort, SIGNAL( clicked() ), this, SLOT( slotAbort() ) );

    QVBoxLayout* l1 = new QVBoxLayout( this, 8, 4 );

    QHBoxLayout* l1_1 = new QHBoxLayout();
    l1->addLayout( l1_1 );
    l1_1->addStrut( 3 * lbl1->height() + 16 );
    l1_1->addWidget( f1 );
    l1_1->addWidget( f2 );
    
    QVBoxLayout* l1_1_1 = new QVBoxLayout( f1, 4, 4 );

    QHBoxLayout* l1_1_1_1 = new QHBoxLayout();
    l1_1_1->addLayout( l1_1_1_1 );
    l1_1_1_1->addWidget( lbl1 );
    l1_1_1_1->addWidget( _elapsedTime, 1 );

    QHBoxLayout* l1_1_1_2 = new QHBoxLayout();
    l1_1_1->addLayout( l1_1_1_2 );
    l1_1_1_2->addWidget( lbl3 );
    l1_1_1_2->addWidget( totalKbytes, 1 );

    QHBoxLayout* l1_1_1_3 = new QHBoxLayout();
    l1_1_1->addLayout( l1_1_1_3 );
    l1_1_1_3->addWidget( lbl5 );
    l1_1_1_3->addWidget( _transferRate, 1 );

    QVBoxLayout* l1_1_2 = new QVBoxLayout( f2, 4, 4 );

    QHBoxLayout* l1_1_2_1 = new QHBoxLayout();
    l1_1_2->addLayout( l1_1_2_1 );
    l1_1_2_1->addWidget( lbl2 );
    l1_1_2_1->addWidget( _timeRemaining, 1 );

    QHBoxLayout* l1_1_2_2 = new QHBoxLayout();
    l1_1_2->addLayout( l1_1_2_2 );
    l1_1_2_2->addWidget( lbl4 );
    l1_1_2_2->addWidget( _kbytesRead, 1 );

    QHBoxLayout* l1_1_2_3 = new QHBoxLayout();
    l1_1_2->addLayout( l1_1_2_3 );
    l1_1_2_3->addWidget( lbl6 );
    l1_1_2_3->addWidget( _files, 1 );

    l1->addWidget( _log, 1 );

    QHBoxLayout* l1_2 = new QHBoxLayout();
    l1->addLayout( l1_2 );
    l1_2->addStretch( 1 );
    l1_2->addWidget( _ok );
    l1_2->addWidget( _save );
    l1_2->addWidget( _abort );
}
FtpDialog::FtpDialog(QWidget *parent, QString pathToVideoFile, QString videoFileName) :
    QDialog(parent)
{
    m_pathToVideoFile = pathToVideoFile;
    m_videoFileName = videoFileName;
    ftp = NULL;

    ftpServerLabel = new QLabel(tr("Ftp &server:"), this);
    //ftpServerLineEdit = new QLineEdit("ftp.qt.nokia.com", this);
    ftpServerLineEdit = new QLineEdit("127.0.0.1", this);
    ftpServerLabel->setBuddy(ftpServerLineEdit);

    statusLabel = new QLabel(tr("Please enter the name of an FTP server."), this);
    statusLabel->setWordWrap(true);

    fileList = new QTreeWidget(this);
    fileList->setEnabled(false);
    fileList->setRootIsDecorated(false);
    fileList->setHeaderLabels(QStringList() << tr("Name") << tr("Size") << tr("Owner") << tr("Group") << tr("Time"));
    fileList->header()->setStretchLastSection(false);

    connectButton = new QPushButton(tr("Connect"), this);
    connectButton->setDefault(true);

    cdToParentButton = new QPushButton(this);
    cdToParentButton->setIcon(QPixmap(":/images/cdtoparent.png"));
    cdToParentButton->setEnabled(false);

    uploadButton = new QPushButton(tr("Upload"), this);
    uploadButton->setEnabled(false);

    quitButton = new QPushButton(tr("Quit"), this);

    QHBoxLayout * buttonBoxLayout = new QHBoxLayout;
    buttonBoxLayout->addWidget(uploadButton);
    buttonBoxLayout->addWidget(quitButton);

    /*buttonBox = new QDialogButtonBox(this);
    buttonBox->addButton(uploadButton, QDialogButtonBox::ActionRole);
    buttonBox->addButton(quitButton, QDialogButtonBox::RejectRole);*/

    progressDialog = new QProgressDialog(this);

    connect(quitButton, SIGNAL(clicked()), this, SLOT(reject()));

    connect(connectButton, SIGNAL(clicked()), this, SLOT(onConnectOrDisconnect()));

    connect(fileList, SIGNAL(itemActivated(QTreeWidgetItem*, int)), this, SLOT(processItem(QTreeWidgetItem*,int)));
    //connect(fileList, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(enableDownloadButton()));

    connect(uploadButton, SIGNAL(clicked()), this, SLOT(uploadFile()));

    connect(cdToParentButton, SIGNAL(clicked()), this, SLOT(cdToParent()));
            /*
    connect(progressDialog, SIGNAL(canceled()), this, SLOT(cancelDownload()));*/

    QHBoxLayout * topLayout = new QHBoxLayout;
    topLayout->addWidget(ftpServerLabel);
    topLayout->addWidget(ftpServerLineEdit);
    topLayout->addWidget(cdToParentButton);
    topLayout->addWidget(connectButton);

    QVBoxLayout * mainLayout = new QVBoxLayout;
    mainLayout->addLayout(topLayout);
    mainLayout->addWidget(fileList);
    mainLayout->addWidget(statusLabel);
    //mainLayout->addWidget(buttonBox);
    mainLayout->addLayout(buttonBoxLayout);
    setLayout(mainLayout);

    QNetworkConfigurationManager manager;
    //qDebug() << manager.capabilities() << "end";
    if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired)
    {
        // Get saved network configuration
        QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
        settings.beginGroup(QLatin1String("QtNetwork"));
        const QString id = settings.value(QLatin1String("DefaultNetworkConfiguration")).toString();
        settings.endGroup();

        // If the saved network configuration is not currently discovered use the system default
        QNetworkConfiguration config = manager.configurationFromIdentifier(id);
        if ((config.state() & QNetworkConfiguration::Discovered) !=
            QNetworkConfiguration::Discovered) {
            config = manager.defaultConfiguration();
        }

        networkSession = new QNetworkSession(config, this);
        connect(networkSession, SIGNAL(opened()), this, SLOT(enableConnectButton()));

        connectButton->setEnabled(false);
        quitButton->setEnabled(false);
        statusLabel->setText(tr("Opening network session."));
        networkSession->open();
    }

    setWindowTitle(tr("FTP"));
}
tcFxjFileImportSourceDialog::tcFxjFileImportSourceDialog(QWidget *pParent)
	: QDialog(pParent)
{
	setupUi(this);
	connect(btn1, SIGNAL(clicked()), this, SLOT(DoSelectDadFilePath()));
}
Example #18
0
RPCConsole::RPCConsole(const PlatformStyle *_platformStyle, QWidget *parent) :
    QWidget(parent),
    ui(new Ui::RPCConsole),
    clientModel(0),
    historyPtr(0),
    platformStyle(_platformStyle),
    peersTableContextMenu(0),
    banTableContextMenu(0),
    consoleFontSize(0)
{
    ui->setupUi(this);
    GUIUtil::restoreWindowGeometry("nRPCConsoleWindow", this->size(), this);

    ui->openDebugLogfileButton->setToolTip(ui->openDebugLogfileButton->toolTip().arg(tr(PACKAGE_NAME)));

    QString theme = GUIUtil::getThemeName();
    if (platformStyle->getImagesOnButtons()) {
        ui->openDebugLogfileButton->setIcon(QIcon(":/icons/" + theme + "/export"));
    }
    // Needed on Mac also
    ui->clearButton->setIcon(QIcon(":/icons/" + theme + "/remove"));
    ui->fontBiggerButton->setIcon(QIcon(":/icons/" + theme + "/fontbigger"));
    ui->fontSmallerButton->setIcon(QIcon(":/icons/" + theme + "/fontsmaller"));

    // Install event filter for up and down arrow
    ui->lineEdit->installEventFilter(this);
    ui->messagesWidget->installEventFilter(this);

    connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear()));
    connect(ui->fontBiggerButton, SIGNAL(clicked()), this, SLOT(fontBigger()));
    connect(ui->fontSmallerButton, SIGNAL(clicked()), this, SLOT(fontSmaller()));
    connect(ui->btnClearTrafficGraph, SIGNAL(clicked()), ui->trafficGraph, SLOT(clear()));
    
    // Wallet Repair Buttons
    // connect(ui->btn_salvagewallet, SIGNAL(clicked()), this, SLOT(walletSalvage()));
    // Disable salvage option in GUI, it's way too powerful and can lead to funds loss
    ui->btn_salvagewallet->setEnabled(false);
    connect(ui->btn_rescan, SIGNAL(clicked()), this, SLOT(walletRescan()));
    connect(ui->btn_zapwallettxes1, SIGNAL(clicked()), this, SLOT(walletZaptxes1()));
    connect(ui->btn_zapwallettxes2, SIGNAL(clicked()), this, SLOT(walletZaptxes2()));
    connect(ui->btn_upgradewallet, SIGNAL(clicked()), this, SLOT(walletUpgrade()));
    connect(ui->btn_reindex, SIGNAL(clicked()), this, SLOT(walletReindex()));

    // set library version labels
#ifdef ENABLE_WALLET
    ui->berkeleyDBVersion->setText(DbEnv::version(0, 0, 0));
    std::string walletPath = GetDataDir().string();
    walletPath += QDir::separator().toLatin1() + GetArg("-wallet", "wallet.dat");
    ui->wallet_path->setText(QString::fromStdString(walletPath));
#else
    ui->label_berkeleyDBVersion->hide();
    ui->berkeleyDBVersion->hide();
#endif
    // Register RPC timer interface
    rpcTimerInterface = new QtRPCTimerInterface();
    // avoid accidentally overwriting an existing, non QTThread
    // based timer interface
    RPCSetTimerInterfaceIfUnset(rpcTimerInterface);

    setTrafficGraphRange(INITIAL_TRAFFIC_GRAPH_SETTING);

    ui->peerHeading->setText(tr("Select a peer to view detailed information."));

    QSettings settings;
    consoleFontSize = settings.value(fontSizeSettingsKey, QFontInfo(QFont()).pointSize()).toInt();
    clear();
}
Example #19
0
manageLayers::manageLayers (QWidget * parent, OPTIONS *op, MISC *mi):
  QDialog (parent, (Qt::WindowFlags) Qt::WA_DeleteOnClose)
{
  options = op;
  misc = mi;


  setWindowTitle ("pfmEdit Layer Preferences");


  resize (400, 100);


  setSizeGripEnabled (TRUE);


  QVBoxLayout *vbox = new QVBoxLayout (this);
  vbox->setMargin (5);
  vbox->setSpacing (5);


  displayGrp = new QButtonGroup (this);
  displayGrp->setExclusive (FALSE);
  connect (displayGrp, SIGNAL (buttonClicked (int)), this, SLOT (slotDisplay (int)));


  QHBoxLayout *layersLayout[MAX_ABE_PFMS];

  for (NV_INT32 i = 0 ; i < misc->abe_share->pfm_count ; i++)
    {
      layers[i] = new QGroupBox (tr ("Layer  "), this);
      layers[i]->setWhatsThis (layersGridText);
      layersLayout[i] = new QHBoxLayout;
      layers[i]->setLayout (layersLayout[i]);

      file[i] = new QLineEdit (layers[i]);
      file[i]->setReadOnly (TRUE);
      file[i]->setToolTip (tr ("Filename (read-only)"));
      layersLayout[i]->addWidget (file[i]);
      file[i]->setText (QFileInfo (QString (misc->abe_share->open_args[i].list_path)).fileName ());


      display[i] = new QCheckBox (tr ("Display"), layers[i]);
      display[i]->setToolTip (tr ("Toggle display of the layer"));
      display[i]->setChecked (misc->abe_share->display_pfm[i]);
      layersLayout[i]->addWidget (display[i]);
      displayGrp->addButton (display[i], i);

      vbox->addWidget (layers[i], 0, 0);
    }


  QHBoxLayout *actions = new QHBoxLayout (0);
  vbox->addLayout (actions);

  QPushButton *bHelp = new QPushButton (this);
  bHelp->setIcon (QIcon (":/icons/contextHelp.xpm"));
  bHelp->setToolTip (tr ("Enter What's This mode for help"));
  connect (bHelp, SIGNAL (clicked ()), this, SLOT (slotHelp ()));
  actions->addWidget (bHelp);

  actions->addStretch (10);

  QPushButton *closeButton = new QPushButton (tr ("Close"), this);
  closeButton->setToolTip (tr ("Close the layers dialog"));
  connect (closeButton, SIGNAL (clicked ()), this, SLOT (slotClose ()));
  actions->addWidget (closeButton);


  show ();
}
Example #20
0
QTORGANIZER_USE_NAMESPACE

TodoEditPage::TodoEditPage(QWidget *parent)
    :QWidget(parent),
    m_manager(0),
    m_subjectEdit(0),
    m_startTimeEdit(0),
    m_dueTimeEdit(0),
    m_priorityEdit(0),
    m_statusEdit(0),
    m_alarmComboBox(0)
{
    // Create widgets
    QLabel *subjectLabel = new QLabel("Subject:", this);
    m_subjectEdit = new QLineEdit(this);
    QLabel *startTimeLabel = new QLabel("Start time:", this);
    m_startTimeEdit = new QDateTimeEdit(this);
    m_startTimeEdit->setDisplayFormat(QString("yyyy-MM-dd hh:mm:ss AP"));
    QLabel *dueTimeLabel = new QLabel("Due time:", this);
    m_dueTimeEdit = new QDateTimeEdit(this);
    m_dueTimeEdit->setDisplayFormat(QString("yyyy-MM-dd hh:mm:ss AP"));
    QLabel *priorityLabel = new QLabel("Priority:", this);
    m_priorityEdit = new QComboBox(this);
    QLabel *statusLabel = new QLabel("Status:", this);
    m_statusEdit = new QComboBox(this);
    QLabel *alarmLabel = new QLabel("Alarm:", this);
    m_alarmComboBox = new QComboBox(this);
    QLabel *calendarLabel = new QLabel("Calendar:", this);

    QStringList alarmList;
    alarmList  << "None"
                << "0 minutes before"
                << "5 minutes before"
                << "15 minutes before"
                << "30 minutes before"
                << "1 hour before";
    m_alarmComboBox->addItems(alarmList);
    connect(m_alarmComboBox, SIGNAL(currentIndexChanged(const QString)), this,
                        SLOT(handleAlarmIndexChanged(const QString)));

    m_calendarComboBox = new QComboBox(this);
    // the calendar names are not know here, fill the combo box later...

    // Add push buttons
    QHBoxLayout* hbLayout = new QHBoxLayout();
    QPushButton *okButton = new QPushButton("Save", this);
    connect(okButton,SIGNAL(clicked()),this,SLOT(saveClicked()));
    hbLayout->addWidget(okButton);
    QPushButton *cancelButton = new QPushButton("Cancel", this);
    connect(cancelButton,SIGNAL(clicked()),this,SLOT(cancelClicked()));
    hbLayout->addWidget(cancelButton);

    // check to see whether we support alarms.
    QOrganizerManager defaultManager;
    QList<QOrganizerItemDetail::DetailType> supportedDetails = defaultManager.supportedItemDetails(QOrganizerItemType::TypeTodo);

    QVBoxLayout *scrollAreaLayout = new QVBoxLayout();
    scrollAreaLayout->addWidget(subjectLabel);
    scrollAreaLayout->addWidget(m_subjectEdit);
    scrollAreaLayout->addWidget(startTimeLabel);
    scrollAreaLayout->addWidget(m_startTimeEdit);
    scrollAreaLayout->addWidget(dueTimeLabel);
    scrollAreaLayout->addWidget(m_dueTimeEdit);
    scrollAreaLayout->addWidget(priorityLabel);
    scrollAreaLayout->addWidget(m_priorityEdit);
    scrollAreaLayout->addWidget(statusLabel);
    scrollAreaLayout->addWidget(m_statusEdit);
    if (supportedDetails.contains(QOrganizerItemDetail::TypeVisualReminder)) {
        scrollAreaLayout->addWidget(alarmLabel);
        scrollAreaLayout->addWidget(m_alarmComboBox);
    }
    scrollAreaLayout->addWidget(calendarLabel);
    scrollAreaLayout->addWidget(m_calendarComboBox);
    scrollAreaLayout->addStretch();
    scrollAreaLayout->addLayout(hbLayout);

    QScrollArea *scrollArea = new QScrollArea(this);
    scrollArea->setWidgetResizable(true);
    QWidget *formContainer = new QWidget(scrollArea);
    formContainer->setLayout(scrollAreaLayout);
    scrollArea->setWidget(formContainer);

    QVBoxLayout *mainLayout = new QVBoxLayout();
    mainLayout->addWidget(scrollArea);
    setLayout(mainLayout);

    // Fill priority combo
    m_priorityEdit->addItem("Unknown", QVariant(QOrganizerItemPriority::UnknownPriority));
    m_priorityEdit->addItem("Highest", QVariant(QOrganizerItemPriority::HighestPriority));
    m_priorityEdit->addItem("Extremely high", QVariant(QOrganizerItemPriority::ExtremelyHighPriority));
    m_priorityEdit->addItem("Very high", QVariant(QOrganizerItemPriority::VeryHighPriority));
    m_priorityEdit->addItem("High", QVariant(QOrganizerItemPriority::HighPriority));
    m_priorityEdit->addItem("Medium", QVariant(QOrganizerItemPriority::MediumPriority));
    m_priorityEdit->addItem("Low", QVariant(QOrganizerItemPriority::LowPriority));
    m_priorityEdit->addItem("Very low", QVariant(QOrganizerItemPriority::VeryLowPriority));
    m_priorityEdit->addItem("Extremely low", QVariant(QOrganizerItemPriority::ExtremelyLowPriority));
    m_priorityEdit->addItem("Lowest", QVariant(QOrganizerItemPriority::LowestPriority));

    // Fill status combo
    m_statusEdit->addItem("Not started", QVariant(QOrganizerTodoProgress::StatusNotStarted));
    m_statusEdit->addItem("In progress", QVariant(QOrganizerTodoProgress::StatusInProgress));
    m_statusEdit->addItem("Complete", QVariant(QOrganizerTodoProgress::StatusComplete));
}
Example #21
0
CameraSelection::CameraSelection(QWidget* const parent)
    : QDialog(parent),
      d(new Private)
{
    qApp->setOverrideCursor(Qt::WaitCursor);

    setWindowTitle(i18n("Camera Configuration"));
    setModal(true);

    const int spacing = QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing);

    d->buttons        = new QDialogButtonBox(QDialogButtonBox::Help | QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
    d->buttons->button(QDialogButtonBox::Ok)->setDefault(true);

    d->UMSCameraNameActual  = QLatin1String("Directory Browse");   // Don't be i18n!
    d->UMSCameraNameShown   = i18n("Mounted Camera");
    d->PTPCameraNameShown   = QLatin1String("USB PTP Class Camera");
    d->PTPIPCameraNameShown = QLatin1String("PTP/IP Camera");

    QWidget* const page        = new QWidget(this);
    QGridLayout* mainBoxLayout = new QGridLayout(page);

    // --------------------------------------------------------------

    d->listView = new QTreeWidget(page);
    d->listView->setRootIsDecorated(false);
    d->listView->setSelectionMode(QAbstractItemView::SingleSelection);
    d->listView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    d->listView->setMinimumWidth(350);
    d->listView->setAllColumnsShowFocus(true);
    d->listView->setColumnCount(1);
    d->listView->setHeaderLabels(QStringList() << i18n("Camera List"));
    d->listView->setWhatsThis(i18n("<p>Select the camera name that you want to use here. All "
                                   "default settings on the right panel "
                                   "will be set automatically.</p><p>This list has been generated "
                                   "using the gphoto2 library installed on your computer.</p>"));

    d->searchBar = new SearchTextBar(page, QLatin1String("CameraSelectionSearchBar"));

    // --------------------------------------------------------------

    QGroupBox* const titleBox   = new QGroupBox(i18n("Camera Title"), page);
    QVBoxLayout* const gLayout1 = new QVBoxLayout(titleBox);
    d->titleEdit                = new QLineEdit(titleBox);
    d->titleEdit->setWhatsThis(i18n("<p>Set here the name used in digiKam interface to "
                                    "identify this camera.</p>"));

    gLayout1->addWidget(d->titleEdit);
    gLayout1->setContentsMargins(spacing, spacing, spacing, spacing);
    gLayout1->setSpacing(spacing);

    // --------------------------------------------------------------

    QGroupBox* const portPathBox = new QGroupBox(i18n("Camera Port Type"), page);
    QGridLayout* const gLayout2  = new QGridLayout(portPathBox);
    d->portButtonGroup           = new QButtonGroup(portPathBox);
    d->portButtonGroup->setExclusive(true);

    d->usbButton        = new QRadioButton(i18n("USB"), portPathBox);
    d->usbButton->setWhatsThis(i18n("<p>Select this option if your camera is connected to your "
                                    "computer using a USB cable.</p>"));

    d->serialButton     = new QRadioButton(i18n("Serial"), portPathBox);
    d->serialButton->setWhatsThis(i18n("<p>Select this option if your camera is connected to your "
                                       "computer using a serial cable.</p>"));

    d->networkButton    = new QRadioButton(i18n("Network"), portPathBox);
    d->networkButton->setWhatsThis(i18n("<p>Select this option if your camera is connected to your "
                                        "computer network.</p>"));

    d->portPathComboBox = new QComboBox(portPathBox);
    d->portPathComboBox->setDuplicatesEnabled(false);
    d->portPathComboBox->setWhatsThis(i18n("<p>Select the serial port to use on your computer here. "
                                           "This option is only required if you use a serial camera.</p>"));

    d->networkEdit      = new QLineEdit(portPathBox);
    d->networkEdit->setWhatsThis(i18n("<p>Enter here the network address of your camera.</p>"));
    d->networkEdit->setInputMask(QLatin1String("000.000.000.000"));
    d->networkEdit->setText(QLatin1String("192.168.001.001"));

    d->portButtonGroup->addButton(d->usbButton);
    d->portButtonGroup->addButton(d->serialButton);
    d->portButtonGroup->addButton(d->networkButton);

    gLayout2->addWidget(d->usbButton,        0, 0, 1, 2);
    gLayout2->addWidget(d->serialButton,     1, 0, 1, 2);
    gLayout2->addWidget(d->portPathComboBox, 1, 1, 1, 2);
    gLayout2->addWidget(d->networkButton,    2, 0, 1, 2);
    gLayout2->addWidget(d->networkEdit,      2, 1, 1, 2);
    gLayout2->setContentsMargins(spacing, spacing, spacing, spacing);
    gLayout2->setSpacing(spacing);

    // --------------------------------------------------------------

    QGroupBox* const umsMountBox = new QGroupBox(i18n("Camera Mount Path"), page);
    QVBoxLayout* const gLayout3  = new QVBoxLayout(umsMountBox);

    QLabel* const umsMountLabel = new QLabel(umsMountBox);
    umsMountLabel->setText(i18n("Note: only for USB/IEEE mass storage cameras."));

    d->umsMountURL = new DFileSelector(umsMountBox);
    d->umsMountURL->setFileDlgPath(QLatin1String("/mnt/camera"));
    d->umsMountURL->setFileDlgMode(QFileDialog::Directory);
    d->umsMountURL->setWhatsThis(i18n("<p>Set here the mount path to use on your computer. This "
                                      "option is only required if you use a <b>USB Mass Storage</b> "
                                      "camera.</p>"));

    gLayout3->addWidget(umsMountLabel);
    gLayout3->addWidget(d->umsMountURL);
    gLayout3->setContentsMargins(spacing, spacing, spacing, spacing);
    gLayout3->setSpacing(spacing);

    // --------------------------------------------------------------

    QWidget* const box2         = new QWidget(page);
    QGridLayout* const gLayout4 = new QGridLayout(box2);

    QLabel* const logo = new QLabel(box2);
    logo->setPixmap(QIcon::fromTheme(QLatin1String("digikam")).pixmap(QSize(48,48)));

    QLabel* const link = new QLabel(box2);
    link->setText(i18n("<p>To set a <b>USB Mass Storage</b> camera<br/>"
                       "(which looks like a removable drive when mounted<br/>"
                       "on your desktop), please use<br/>"
                       "<a href=\"umscamera\">%1</a> from the camera list.</p>",
                       d->UMSCameraNameShown));

    QLabel* const link2 = new QLabel(box2);
    link2->setText(i18n("<p>To set a <b>Generic PTP USB Device</b><br/>"
                        "(which uses Picture Transfer Protocol), please<br/>"
                        "use <a href=\"ptpcamera\">%1</a> from the camera list.</p>",
                        d->PTPCameraNameShown));

    QLabel* const link3 = new QLabel(box2);
    link3->setText(i18n("<p>To set a <b>Generic PTP/IP Network Device</b><br/>"
                        "(which uses Picture Transfer Protocol), please<br/>"
                        "use <a href=\"ptpipcamera\">%1</a> from the camera list.</p>",
                        d->PTPIPCameraNameShown));

    QLabel* const explanation = new QLabel(box2);
    explanation->setOpenExternalLinks(true);
    explanation->setText(i18n("<p>A complete list of camera settings to use is<br/>"
                              "available at <a href='http://www.teaser.fr/~hfiguiere/linux/digicam.html'>"
                              "this URL</a>.</p>"));

    gLayout4->setContentsMargins(spacing, spacing, spacing, spacing);
    gLayout4->setSpacing(spacing);
    gLayout4->addWidget(logo,        0, 0, 1, 1);
    gLayout4->addWidget(link,        0, 1, 2, 1);
    gLayout4->addWidget(link2,       2, 1, 2, 1);
    gLayout4->addWidget(link3,       4, 1, 2, 1);
    gLayout4->addWidget(explanation, 6, 1, 2, 1);

    // --------------------------------------------------------------

    mainBoxLayout->addWidget(d->listView,  0, 0, 6, 1);
    mainBoxLayout->addWidget(d->searchBar, 7, 0, 1, 1);
    mainBoxLayout->addWidget(titleBox,     0, 1, 1, 1);
    mainBoxLayout->addWidget(portPathBox,  1, 1, 1, 1);
    mainBoxLayout->addWidget(umsMountBox,  2, 1, 1, 1);
    mainBoxLayout->addWidget(box2,         3, 1, 2, 1);
    mainBoxLayout->setColumnStretch(0, 10);
    mainBoxLayout->setRowStretch(6, 10);
    mainBoxLayout->setContentsMargins(QMargins());
    mainBoxLayout->setSpacing(spacing);

    QVBoxLayout* const vbx = new QVBoxLayout(this);
    vbx->addWidget(page);
    vbx->addWidget(d->buttons);
    setLayout(vbx);

    // Connections --------------------------------------------------

    connect(link, SIGNAL(linkActivated(QString)),
            this, SLOT(slotUMSCameraLinkUsed()));

    connect(link2, SIGNAL(linkActivated(QString)),
            this, SLOT(slotPTPCameraLinkUsed()));

    connect(link3, SIGNAL(linkActivated(QString)),
            this, SLOT(slotPTPIPCameraLinkUsed()));

    connect(d->networkEdit, SIGNAL(textChanged(QString)),
            this, SLOT(slotNetworkEditChanged(QString)));

    connect(d->listView, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
            this, SLOT(slotSelectionChanged(QTreeWidgetItem*,int)));

    connect(d->portButtonGroup, SIGNAL(buttonClicked(int)),
            this, SLOT(slotPortChanged()));

    connect(d->searchBar, SIGNAL(signalSearchTextSettings(SearchTextSettings)),
            this, SLOT(slotSearchTextChanged(SearchTextSettings)));

    connect(d->buttons->button(QDialogButtonBox::Ok), SIGNAL(clicked()),
            this, SLOT(slotOkClicked()));

    connect(d->buttons->button(QDialogButtonBox::Cancel), SIGNAL(clicked()),
            this, SLOT(reject()));

    connect(d->buttons->button(QDialogButtonBox::Help), SIGNAL(clicked()),
            this, SLOT(slotHelp()));

    // Initialize  --------------------------------------------------

#ifndef HAVE_GPHOTO2
    // If digiKam is compiled without Gphoto2 support, we hide widgets relevant.
    d->listView->hide();
    d->searchBar->hide();
    box2->hide();
    slotUMSCameraLinkUsed();
#else
    getCameraList();
    getSerialPortList();
#endif /* HAVE_GPHOTO2 */

    qApp->restoreOverrideCursor();
}
DialogSettings::DialogSettings(QWidget* parent, SettingsPage::settingsPage page) :
	QDialog(parent),
	ui(new Ui::DialogSettings)
{
	ui->setupUi(this);
	ui->comboBoxG2Mode->setView(new QListView());
	ui->comboBoxOnClose->setView(new QListView());
	ui->comboBoxQueueLength->setView(new QListView());
	switchSettingsPage(page);

	newSkinSelected = false;

	// Load Basic Settings
	ui->checkBoxStartWithSystem->setChecked(quazaaSettings.System.StartWithSystem);
	ui->checkBoxConnectOnStart->setChecked(quazaaSettings.System.ConnectOnStartup);
	ui->comboBoxOnClose->setCurrentIndex(quazaaSettings.System.CloseMode);
	ui->checkBoxOnMinimize->setChecked(quazaaSettings.System.MinimizeToTray);
	ui->spinBoxDiskWarn->setValue(quazaaSettings.System.DiskSpaceWarning);
	ui->spinBoxDiskStop->setValue(quazaaSettings.System.DiskSpaceStop);

	// Load Parental Settings
	ui->checkBoxParentalChatFilter->setChecked(quazaaSettings.Parental.ChatAdultCensor);
	ui->checkBoxParentalSearchFilter->setChecked(quazaaSettings.Parental.FilterAdultSearchResults);
	ui->listWidgetParentalFilter->addItems(quazaaSettings.Parental.AdultFilter);

	// Load Library Settings
	ui->checkBoxLibraryRememberViews->setChecked(quazaaSettings.Library.RememberViews);
	ui->checkBoxQuickHashing->setChecked(quazaaSettings.Library.HighPriorityHashing);
	ui->checkBoxDisplayHashingProgress->setChecked(quazaaSettings.Library.HashWindow);
	ui->checkBoxLibraryGhostFiles->setChecked(quazaaSettings.Library.GhostFiles);
	ui->checkBoxVideoSeriesDetection->setChecked(quazaaSettings.Library.SmartSeriesDetection);
	ui->spinBoxFileHistoryRemember->setValue(quazaaSettings.Library.HistoryTotal);
	ui->spinBoxFileHistoryDays->setValue(quazaaSettings.Library.HistoryDays);
	ui->listWidgetFileTypesSafeOpen->addItems(quazaaSettings.Library.SafeExecuteTypes);
	ui->listWidgetFileTypesNeverShare->addItems(quazaaSettings.Library.NeverShareTypes);

	// File Types Settings

	// Load Media Player Settings

	// Load Search Settings
	ui->checkBoxSearchExpandMultiSorce->setChecked(quazaaSettings.Search.ExpandSearchMatches);
	ui->checkBoxSearchSwitchOnDownload->setChecked(quazaaSettings.Search.SwitchOnDownload);
	ui->checkBoxSearchHighlightNewMatches->setChecked(quazaaSettings.Search.HighlightNew);

	// Load Private Messages Settings
	ui->checkBoxPrivateMessagesAres->setChecked(quazaaSettings.PrivateMessages.AresEnable);
	ui->checkBoxPrivateMessagesGnutella->setChecked(quazaaSettings.PrivateMessages.Gnutella2Enable);
	ui->checkBoxPrivateMessagesEDonkey->setChecked(quazaaSettings.PrivateMessages.eDonkeyEnable);
	ui->spinBoxPrivateMessagesIdleMessage->setValue(quazaaSettings.PrivateMessages.AwayMessageIdleTime);
	ui->plainTextEditPrivateMessagesIdleMessage->setPlainText(quazaaSettings.PrivateMessages.AwayMessage);

	// Load Chat Settings
	ui->checkBoxIrcConnectOnStart->setChecked(quazaaSettings.Chat.ConnectOnStartup);
	ui->checkBoxIrcEnableFileTransfers->setChecked(quazaaSettings.Chat.EnableFileTransfers);
	ui->checkBoxIrcShowTimestamp->setChecked(quazaaSettings.Chat.ShowTimestamp);
	ui->checkBoxIrcSSL->setChecked(quazaaSettings.Chat.IrcUseSSL);
	ui->lineEditIrcServer->setText(quazaaSettings.Chat.IrcServerName);
	ui->spinBoxIrcPort->setValue(quazaaSettings.Chat.IrcServerPort);

	// Load Connection Settings
	ui->doubleSpinBoxInSpeed->setValue((quazaaSettings.Connection.InSpeed / 1024) * 8);
	ui->doubleSpinBoxOutSpeed->setValue((quazaaSettings.Connection.OutSpeed / 1024) * 8);
	ui->spinBoxNetworkPort->setValue(quazaaSettings.Connection.Port);
	ui->checkBoxRandomPort->setChecked(quazaaSettings.Connection.RandomPort);
	ui->spinBoxConnectionTimeout->setValue(quazaaSettings.Connection.TimeoutConnect);

	// Load Web Settings
	ui->checkBoxIntegrationMagnetLinks->setChecked(quazaaSettings.Web.Magnet);
	ui->checkBoxIntegrationAresLinks->setChecked(quazaaSettings.Web.Ares);
	ui->checkBoxIntegrationBitTorrentLinks->setChecked(quazaaSettings.Web.Torrent);
	ui->checkBoxIntegrationPioletLinks->setChecked(quazaaSettings.Web.Piolet);
	ui->checkBoxIntegrationEDonkeyLinks->setChecked(quazaaSettings.Web.ED2K);
	ui->checkBoxManageWebDownloads->setChecked(quazaaSettings.Web.BrowserIntegration);
	ui->listWidgetManageDownloadTypes->addItems(quazaaSettings.Web.ManageDownloadTypes);

	// Load Transfer Settings
	ui->checkBoxOnlyDownloadConnectedNetworks->setChecked(quazaaSettings.Transfers.RequireConnectedNetwork);
	ui->checkBoxSimpleProgress->setChecked(quazaaSettings.Transfers.SimpleProgressBar);

	// Load Download Settings
	ui->checkBoxExpandDownloads->setChecked(quazaaSettings.Downloads.ExpandDownloads);
	ui->lineEditSaveFolder->setText(quazaaSettings.Downloads.CompletePath);
	ui->lineEditTempFolder->setText(quazaaSettings.Downloads.IncompletePath);
	ui->comboBoxQueueLength->setCurrentIndex(quazaaSettings.Downloads.QueueLimit);
	ui->spinBoxMaxFiles->setValue(quazaaSettings.Downloads.MaxFiles);
	ui->spinBoxMaxTransfers->setValue(quazaaSettings.Downloads.MaxTransfers);
	ui->spinBoxTransfersPerFile->setValue(quazaaSettings.Downloads.MaxTransfersPerFile);

	// Load Upload Settings
	ui->checkBoxSharePartials->setChecked(quazaaSettings.Uploads.SharePartials);
	ui->checkBoxSharingLimitHub->setChecked(quazaaSettings.Uploads.HubShareLimiting);
	ui->checkBoxSharePreviews->setChecked(quazaaSettings.Uploads.SharePreviews);
	ui->spinBoxUniqueHostLimit->setValue(quazaaSettings.Uploads.MaxPerHost);

	// Load Security Settings
	ui->checkBoxChatFilterSpam->setChecked(quazaaSettings.Security.ChatFilter);
	ui->checkBoxAllowBrowseProfile->setChecked(quazaaSettings.Security.AllowProfileBrowse);
	ui->checkBoxIrcFloodProtection->setChecked(quazaaSettings.Security.IrcFloodProtection);
	ui->spinBoxChatFloodLimit->setValue(quazaaSettings.Security.IrcFloodLimit);
	ui->checkBoxRemoteEnable->setChecked(quazaaSettings.Security.RemoteEnable);
	ui->lineEditRemoteUserName->setText(quazaaSettings.Security.RemoteUsername);
	ui->lineEditRemotePassword->setText(quazaaSettings.Security.RemotePassword);
	ui->checkBoxIgnoreLocalIP->setChecked(quazaaSettings.Security.SearchIgnoreLocalIP);
	ui->checkBoxEnableUPnP->setChecked(quazaaSettings.Security.EnableUPnP);
	ui->checkBoxAllowBrowseShares->setChecked(quazaaSettings.Security.AllowSharesBrowse);
	ui->listWidgetUserAgents->addItems(quazaaSettings.Security.BlockedAgentUploadFilter);

	// Load Gnutella 2 Settings
	ui->checkBoxConnectG2->setChecked(quazaaSettings.Gnutella2.Enable);
	ui->comboBoxG2Mode->setCurrentIndex(quazaaSettings.Gnutella2.ClientMode);
	ui->spinBoxG2LeafToHub->setValue(quazaaSettings.Gnutella2.NumHubs);
	ui->spinBoxG2HubToLeaf->setValue(quazaaSettings.Gnutella2.NumLeafs);
	ui->spinBoxG2HubToHub->setValue(quazaaSettings.Gnutella2.NumPeers);

	// Load Ares Settings
	ui->checkBoxConnectAres->setChecked(quazaaSettings.Ares.Enable);

	// Load eDonkey 2k Settings
	ui->checkBoxConnectEDonkey->setChecked(quazaaSettings.EDonkey.Enable);
	ui->checkBoxConnectKAD->setChecked(quazaaSettings.EDonkey.EnableKad);
	ui->checkBoxED2kSearchCahedServers->setChecked(quazaaSettings.EDonkey.SearchCachedServers);
	ui->spinBoxED2kMaxResults->setValue(quazaaSettings.EDonkey.MaxResults);
	ui->checkBoxED2kUpdateServerList->setChecked(quazaaSettings.EDonkey.LearnNewServers);
	ui->spinBoxED2kMaxClients->setValue(quazaaSettings.EDonkey.MaxClients);
	ui->checkBoxAutoQueryServerList->setChecked(quazaaSettings.EDonkey.MetAutoQuery);
	ui->lineEditEDonkeyServerListUrl->setText(quazaaSettings.EDonkey.ServerListURL);

	// Load BitTorrent Settings
	ui->checkBoxTorrentSaveDialog->setChecked(quazaaSettings.BitTorrent.UseSaveDialog);
	ui->checkBoxTorrentsStartPaused->setChecked(quazaaSettings.BitTorrent.StartPaused);
	ui->checkBoxTorrentsUseTemp->setChecked(quazaaSettings.BitTorrent.UseTemp);
	ui->checkBoxManagedTorrent->setChecked(quazaaSettings.BitTorrent.Managed);
	ui->checkBoxTorrentsEndgame->setChecked(quazaaSettings.BitTorrent.Endgame);
	ui->spinBoxTorrentsSimultaneous->setValue(quazaaSettings.BitTorrent.DownloadTorrents);
	ui->spinBoxTorrentsClientConnections->setValue(quazaaSettings.BitTorrent.DownloadConnections);
	ui->checkBoxTorrentsClearDownloaded->setChecked(quazaaSettings.BitTorrent.AutoClear);
	ui->spinBoxTorrentsRatioClear->setValue(quazaaSettings.BitTorrent.ClearRatio);
	ui->checkBoxTorrentsPreferTorrent->setChecked(quazaaSettings.BitTorrent.PreferBTSources);
	ui->checkBoxTorrentsUseKademlia->setChecked(quazaaSettings.BitTorrent.UseKademlia);
	ui->lineEditTorrentFolder->setText(quazaaSettings.BitTorrent.TorrentPath);

	// Set Generic Control States
	ui->groupBoxParentalFilter->setVisible(false);
	ui->pushButtonApply->setEnabled(false);

	// System Settings
	connect(ui->checkBoxStartWithSystem, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxConnectOnStart, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->comboBoxOnClose, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApply()));
	connect(ui->checkBoxOnMinimize, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->spinBoxDiskWarn, SIGNAL(valueChanged(int)), this, SLOT(enableApply()));
	connect(ui->spinBoxDiskStop, SIGNAL(valueChanged(int)), this, SLOT(enableApply()));

	// Parental Settings
	connect(ui->checkBoxParentalChatFilter, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxParentalSearchFilter, SIGNAL(clicked()), this, SLOT(enableApply()));

	// Library Settings
	connect(ui->checkBoxLibraryRememberViews, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxQuickHashing, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxDisplayHashingProgress, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxLibraryGhostFiles, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxVideoSeriesDetection, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->spinBoxFileHistoryRemember, SIGNAL(valueChanged(int)), this, SLOT(enableApply()));
	connect(ui->spinBoxFileHistoryDays, SIGNAL(valueChanged(int)), this, SLOT(enableApply()));


	// File Types Settings

	// Media Player Settings

	// Search Settings
	connect(ui->checkBoxSearchExpandMultiSorce, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxSearchSwitchOnDownload, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxSearchHighlightNewMatches, SIGNAL(clicked()), this, SLOT(enableApply()));

	// Private Messages Settings
	connect(ui->checkBoxPrivateMessagesAres, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->plainTextEditPrivateMessagesIdleMessage, SIGNAL(textChanged()), this, SLOT(enableApply()));
	connect(ui->spinBoxPrivateMessagesIdleMessage, SIGNAL(valueChanged(int)), this, SLOT(enableApply()));
	connect(ui->checkBoxPrivateMessagesEDonkey, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxPrivateMessagesGnutella, SIGNAL(clicked()), this, SLOT(enableApply()));

	// Chat Settings
	connect(ui->checkBoxPrivateMessagesGnutella, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxIrcConnectOnStart, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxIrcEnableFileTransfers, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxIrcShowTimestamp, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->spinBoxPrivateMessagesIdleMessage, SIGNAL(valueChanged(int)), this, SLOT(enableApply()));
	connect(ui->lineEditIrcServer, SIGNAL(textEdited(QString)), this, SLOT(enableApply()));
	connect(ui->spinBoxIrcPort, SIGNAL(valueChanged(int)), this, SLOT(enableApply()));
	connect(ui->checkBoxIrcSSL, SIGNAL(clicked()), this, SLOT(enableApply()));

	// Connection Settings
	connect(ui->doubleSpinBoxInSpeed, SIGNAL(valueChanged(double)), this, SLOT(enableApply()));
	connect(ui->doubleSpinBoxOutSpeed, SIGNAL(valueChanged(double)), this, SLOT(enableApply()));
	connect(ui->spinBoxNetworkPort, SIGNAL(valueChanged(int)), this, SLOT(enableApply()));
	connect(ui->checkBoxRandomPort, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->spinBoxConnectionTimeout, SIGNAL(valueChanged(int)), this, SLOT(enableApply()));

	// Web Settings
	connect(ui->checkBoxIntegrationMagnetLinks, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxIntegrationAresLinks, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxIntegrationBitTorrentLinks, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxIntegrationPioletLinks, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxIntegrationEDonkeyLinks, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxManageWebDownloads, SIGNAL(clicked()), this, SLOT(enableApply()));

	// Transfer Settings
	connect(ui->checkBoxOnlyDownloadConnectedNetworks, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxSimpleProgress, SIGNAL(clicked()), this, SLOT(enableApply()));

	// Download Settings
	connect(ui->checkBoxExpandDownloads, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->lineEditSaveFolder, SIGNAL(textEdited(QString)), this, SLOT(enableApply()));
	connect(ui->lineEditTempFolder, SIGNAL(textEdited(QString)), this, SLOT(enableApply()));
	connect(ui->comboBoxQueueLength, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApply()));
	connect(ui->spinBoxMaxFiles, SIGNAL(valueChanged(int)), this, SLOT(enableApply()));
	connect(ui->spinBoxMaxTransfers, SIGNAL(valueChanged(int)), this, SLOT(enableApply()));
	connect(ui->spinBoxTransfersPerFile, SIGNAL(valueChanged(int)), this, SLOT(enableApply()));

	// Upload Settings
	connect(ui->checkBoxSharePartials, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxSharingLimitHub, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxSharePreviews, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->spinBoxUniqueHostLimit, SIGNAL(valueChanged(int)), this, SLOT(enableApply()));

	// Security Settings
	connect(ui->checkBoxChatFilterSpam, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxAllowBrowseProfile, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxIrcFloodProtection, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->spinBoxChatFloodLimit, SIGNAL(valueChanged(int)), this, SLOT(enableApply()));
	connect(ui->checkBoxRemoteEnable, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->lineEditRemoteUserName, SIGNAL(textEdited(QString)), this, SLOT(enableApply()));
	connect(ui->lineEditRemotePassword, SIGNAL(textEdited(QString)), this, SLOT(enableApply()));
	connect(ui->checkBoxIgnoreLocalIP, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxEnableUPnP, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxAllowBrowseShares, SIGNAL(clicked()), this, SLOT(enableApply()));

	// Gnutella 2 Settings
	connect(ui->checkBoxConnectG2, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->comboBoxG2Mode, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApply()));
	connect(ui->spinBoxG2LeafToHub, SIGNAL(valueChanged(int)), this, SLOT(enableApply()));
	connect(ui->spinBoxG2HubToLeaf, SIGNAL(valueChanged(int)), this, SLOT(enableApply()));
	connect(ui->spinBoxG2HubToHub, SIGNAL(valueChanged(int)), this, SLOT(enableApply()));

	// Ares Settings
	connect(ui->checkBoxConnectAres, SIGNAL(clicked()), this, SLOT(enableApply()));

	// eDonkey 2k Settings
	connect(ui->checkBoxConnectEDonkey, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxConnectKAD, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxED2kSearchCahedServers, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->spinBoxED2kMaxResults, SIGNAL(valueChanged(int)), this, SLOT(enableApply()));
	connect(ui->checkBoxED2kUpdateServerList, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->spinBoxED2kMaxClients, SIGNAL(valueChanged(int)), this, SLOT(enableApply()));
	connect(ui->checkBoxAutoQueryServerList, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->lineEditEDonkeyServerListUrl, SIGNAL(textEdited(QString)), this, SLOT(enableApply()));

	// BitTorrent Settings
	connect(ui->checkBoxTorrentSaveDialog, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxTorrentsStartPaused, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxTorrentsUseTemp, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxManagedTorrent, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxTorrentsEndgame, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->spinBoxTorrentsSimultaneous, SIGNAL(valueChanged(int)), this, SLOT(enableApply()));
	connect(ui->spinBoxTorrentsClientConnections, SIGNAL(valueChanged(int)), this, SLOT(enableApply()));
	connect(ui->checkBoxTorrentsClearDownloaded, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->spinBoxTorrentsRatioClear, SIGNAL(valueChanged(int)), this, SLOT(enableApply()));
	connect(ui->checkBoxTorrentsPreferTorrent, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->checkBoxTorrentsUseKademlia, SIGNAL(clicked()), this, SLOT(enableApply()));
	connect(ui->lineEditTorrentFolder, SIGNAL(textEdited(QString)), this, SLOT(enableApply()));
}
Example #23
0
// Make a popup dialog box 
PolymerBoard::PolymerBoard(MainForm *mainForm, QWidget * parent)
    : QDialog(parent), mainForm(mainForm)
{
    setWindowTitle( "AViz: Set Polymer Atom Types" );

    {
        // Create a hboxlayout that will fill the first row
        hb1 = new QWidget(this);

        // Create a combo box that will go into the
        // second column; entries in the combo box will
        // be made later
        atomCob = new QComboBox();
        connect( atomCob, SIGNAL(activated(int)), SLOT(setPolymerAtom()) );

        // Add a check box button
        showPolymerAtomCb = new QCheckBox("Show Polymer Atoms");
        showPolymerAtomCb->setChecked(true);
        connect( showPolymerAtomCb, SIGNAL(clicked()), this, SLOT(adjustPolymer()) );

        QHBoxLayout *hbox = new QHBoxLayout(hb1);
        hbox->addWidget(new QLabel(" Type: "));
        hbox->addWidget(atomCob);
        hbox->addStretch(1);
        hbox->addWidget(showPolymerAtomCb);
    }

    {
        // Create a hboxlayout that will fill the next row
        hb2 = new QWidget(this);

        // Add color labels
        colorLabel0 = new ColorLabel(hb2);
        colorLabel1 = new ColorLabel(hb2);
        colorLabel2 = new ColorLabel(hb2);
        colorLabel3 = new ColorLabel(hb2);
        colorLabel4 = new ColorLabel(hb2);
        colorLabel5 = new ColorLabel(hb2);
        colorLabel0->setFixedHeight( LABEL_HEIGHT );
        colorLabel1->setFixedHeight( LABEL_HEIGHT );
        colorLabel2->setFixedHeight( LABEL_HEIGHT );
        colorLabel3->setFixedHeight( LABEL_HEIGHT );
        colorLabel4->setFixedHeight( LABEL_HEIGHT );
        colorLabel5->setFixedHeight( LABEL_HEIGHT );

        // Add a push button
        colorButton = new QPushButton("Set Color...");

        // Define a callback for this button
        connect(colorButton, SIGNAL(clicked()), SLOT(setColorCb()));

        QHBoxLayout *hbox = new QHBoxLayout(hb2);
        hbox->setSpacing(0);
        hbox->addWidget(new QLabel(" Color: "));
        hbox->addWidget(colorLabel0);
        hbox->addWidget(colorLabel1);
        hbox->addWidget(colorLabel2);
        hbox->addWidget(colorLabel3);
        hbox->addWidget(colorLabel4);
        hbox->addWidget(colorLabel5);
        hbox->addWidget(colorButton);
    }


    // Create a hboxlayout that will fill the next row
    sizeBox = new SizeBox(this);

    {
        // Create a hboxlayout that will fill the next row
        hb4 = new QWidget(this);

        // Add radiobuttons and a label
        modeL = new QLabel(" Color Criterion: ");

        colorMode = new QGroupBox();
        QHBoxLayout *colorModeLayout = new QHBoxLayout(colorMode);

        colorMode0 = new QRadioButton("Type");
        colorMode1 = new QRadioButton("Position");
        colorMode2 = new QRadioButton("Property");
        colorMode3 = new QRadioButton("ColorCode");
        colorModeLayout->addWidget(colorMode0);
        colorModeLayout->addWidget(colorMode1);
        colorModeLayout->addWidget(colorMode2);
        colorModeLayout->addWidget(colorMode3);

        QButtonGroup *colorModeButtonGroup = new QButtonGroup(this);
        colorModeButtonGroup->addButton(colorMode0);
        colorModeButtonGroup->addButton(colorMode1);
        colorModeButtonGroup->addButton(colorMode2);
        colorModeButtonGroup->addButton(colorMode3);

        // Define a callback for these radio buttons
        connect(colorModeButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(adjustCriterion()) );

        QHBoxLayout *hBox = new QHBoxLayout(hb4);
        hBox->addWidget(modeL);
        hBox->addWidget(colorMode);
    }

    // Create hboxlayouts that will fill the next row; these
    // are shown only when appropriate
    positionBox = new PositionBox(this);
    propertyBox = new PropertyBox(this);
    codeBox = new CodeBox(this);

    {
        hb5 = new QWidget(this);

        // Create pushbuttons that will go into the lowest row
        QPushButton * bonds = new QPushButton("Bonds...");
        connect( bonds, SIGNAL(clicked()), this, SLOT(bbonds()) );

        DoneApplyCancelWidget *doneApplyCancel = new DoneApplyCancelWidget(this);
        connect(doneApplyCancel, SIGNAL(done()), this, SLOT(bdone()) );
        connect(doneApplyCancel, SIGNAL(applied()), this, SLOT(bapply()) );
        connect(doneApplyCancel, SIGNAL(canceled()), this, SLOT(bcancel()));

        QHBoxLayout *hbox = new QHBoxLayout(hb5);
        hbox->addWidget(bonds);
        hbox->addStretch(1);
        hbox->addWidget(doneApplyCancel);
    }

    // Clear the board pointer
    polymerBox = NULL;

    // Clear the color board pointer
    cb = NULL;

    // Clear internal variables
    colors = 1;
    colorPosX = colorPosY = 0;
    showColorBoard = false;
    polymerAtomRenderStyle = PADOT;
    renderQuality = LOW;

    // Set defaults appropriate for startup without data
    colorButton->setDisabled(true);
    sizeBox->setDisabled(true);
    modeL->setDisabled(true);
    colorMode->setDisabled(true);
    colorMode0->setChecked(true);

    // Build default layout
    this->buildLayout( TYPE );
}
Example #24
0
ModifyConstraintActivitiesPreferredStartingTimesForm::ModifyConstraintActivitiesPreferredStartingTimesForm(QWidget* parent, ConstraintActivitiesPreferredStartingTimes* ctr): QDialog(parent)
{
	setupUi(this);

	int duration=ctr->duration;
	durationCheckBox->setChecked(duration>=1);
	durationSpinBox->setEnabled(duration>=1);
	durationSpinBox->setMinimum(1);
	durationSpinBox->setMaximum(gt.rules.nHoursPerDay);
	if(duration>=1)
		durationSpinBox->setValue(duration);
	else
		durationSpinBox->setValue(1);

	okPushButton->setDefault(true);

	connect(preferredTimesTable, SIGNAL(itemClicked(QTableWidgetItem*)), this, SLOT(itemClicked(QTableWidgetItem*)));
	connect(cancelPushButton, SIGNAL(clicked()), this, SLOT(cancel()));
	connect(okPushButton, SIGNAL(clicked()), this, SLOT(ok()));
	connect(setAllAllowedPushButton, SIGNAL(clicked()), this, SLOT(setAllSlotsAllowed()));
	connect(setAllNotAllowedPushButton, SIGNAL(clicked()), this, SLOT(setAllSlotsNotAllowed()));

	centerWidgetOnScreen(this);
	restoreFETDialogGeometry(this);

	QSize tmp1=teachersComboBox->minimumSizeHint();
	Q_UNUSED(tmp1);
	QSize tmp2=studentsComboBox->minimumSizeHint();
	Q_UNUSED(tmp2);
	QSize tmp3=subjectsComboBox->minimumSizeHint();
	Q_UNUSED(tmp3);
	QSize tmp4=activityTagsComboBox->minimumSizeHint();
	Q_UNUSED(tmp4);
	
	this->_ctr=ctr;

	updateTeachersComboBox();
	updateStudentsComboBox(parent);
	updateSubjectsComboBox();
	updateActivityTagsComboBox();

	preferredTimesTable->setRowCount(gt.rules.nHoursPerDay);
	preferredTimesTable->setColumnCount(gt.rules.nDaysPerWeek);

	for(int j=0; j<gt.rules.nDaysPerWeek; j++){
		QTableWidgetItem* item=new QTableWidgetItem(gt.rules.daysOfTheWeek[j]);
		preferredTimesTable->setHorizontalHeaderItem(j, item);
	}
	for(int i=0; i<gt.rules.nHoursPerDay; i++){
		QTableWidgetItem* item=new QTableWidgetItem(gt.rules.hoursOfTheDay[i]);
		preferredTimesTable->setVerticalHeaderItem(i, item);
	}

	//bool currentMatrix[MAX_HOURS_PER_DAY][MAX_DAYS_PER_WEEK];
	Matrix2D<bool> currentMatrix;
	currentMatrix.resize(gt.rules.nHoursPerDay, gt.rules.nDaysPerWeek);
	
	for(int i=0; i<gt.rules.nHoursPerDay; i++)
		for(int j=0; j<gt.rules.nDaysPerWeek; j++)
			currentMatrix[i][j]=false;
	for(int k=0; k<ctr->nPreferredStartingTimes_L; k++){
		if(ctr->hours_L[k]==-1 || ctr->days_L[k]==-1)
			assert(0);
		int i=ctr->hours_L[k];
		int j=ctr->days_L[k];
		if(i>=0 && i<gt.rules.nHoursPerDay && j>=0 && j<gt.rules.nDaysPerWeek)
			currentMatrix[i][j]=true;
	}

	for(int i=0; i<gt.rules.nHoursPerDay; i++)
		for(int j=0; j<gt.rules.nDaysPerWeek; j++){
			QTableWidgetItem* item= new QTableWidgetItem();
			item->setTextAlignment(Qt::AlignCenter);
			item->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled);
			if(SHOW_TOOLTIPS_FOR_CONSTRAINTS_WITH_TABLES)
				item->setToolTip(gt.rules.daysOfTheWeek[j]+QString("\n")+gt.rules.hoursOfTheDay[i]);
			preferredTimesTable->setItem(i, j, item);
			
			if(!currentMatrix[i][j])
				item->setText(NO);
			else
				item->setText(YES);
				
			colorItem(item);
		}
		
	preferredTimesTable->resizeRowsToContents();
				
	weightLineEdit->setText(CustomFETString::number(ctr->weightPercentage));

	connect(preferredTimesTable->horizontalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(horizontalHeaderClicked(int)));
	connect(preferredTimesTable->verticalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(verticalHeaderClicked(int)));

	preferredTimesTable->setSelectionMode(QAbstractItemView::NoSelection);

	tableWidgetUpdateBug(preferredTimesTable);
	
	setStretchAvailabilityTableNicely(preferredTimesTable);
}
Example #25
0
SeExprEdColorCurve::SeExprEdColorCurve(QWidget* parent, QString pLabel, QString vLabel, QString iLabel,
    bool expandable) :
    QWidget(parent),  _scene(0), _selPosEdit(0), _selValEdit(0), _interpComboBox(0)
{
    Q_UNUSED(iLabel);
    QHBoxLayout *mainLayout = new QHBoxLayout();
    mainLayout->setSpacing(2);
    mainLayout->setMargin(5);

    QWidget *edits = new QWidget;
    QVBoxLayout *editsLayout = new QVBoxLayout;
    editsLayout->setAlignment(Qt::AlignTop);
    editsLayout->setSpacing(0);
    editsLayout->setMargin(0);
    edits->setLayout(editsLayout);

    QWidget *selPos = new QWidget;
    QHBoxLayout *selPosLayout = new QHBoxLayout;
    selPosLayout->setSpacing(1);
    selPosLayout->setMargin(1);
    selPos->setLayout(selPosLayout);
    _selPosEdit = new QLineEdit;
    QDoubleValidator *posValidator = new QDoubleValidator(0.0,1.0,6,_selPosEdit);
    _selPosEdit->setValidator(posValidator);
    _selPosEdit->setFixedWidth(38);
    _selPosEdit->setFixedHeight(20);
    selPosLayout->addStretch(50);
    QLabel *posLabel;
    if (pLabel.isEmpty()) {
        posLabel = new QLabel("Selected Position:  ");
    } else {
        posLabel = new QLabel(pLabel);
    }
    selPosLayout->addWidget(posLabel);
    selPosLayout->addWidget(_selPosEdit);

    QWidget *selVal = new QWidget;
    QBoxLayout *selValLayout = new QHBoxLayout;
    selValLayout->setSpacing(1);
    selValLayout->setMargin(1);
    selVal->setLayout(selValLayout);
    _selValEdit = new SeExprEdCSwatchFrame(SeVec3d(.5));
    _selValEdit->setFixedWidth(38);
    _selValEdit->setFixedHeight(20);
    selValLayout->addStretch(50);
    QLabel *valLabel;
    if (vLabel.isEmpty()) {
        valLabel = new QLabel("Selected Color:  ");
    } else {
        valLabel = new QLabel(vLabel);
    }
    selValLayout->addWidget(valLabel);
    selValLayout->addWidget(_selValEdit);

    _interpComboBox = new QComboBox;
    _interpComboBox->addItem("None");
    _interpComboBox->addItem("Linear");
    _interpComboBox->addItem("Smooth");
    _interpComboBox->addItem("Spline");
    _interpComboBox->addItem("MSpline");
    _interpComboBox->setCurrentIndex(4);
    _interpComboBox->setFixedWidth(70);
    _interpComboBox->setFixedHeight(20);

    editsLayout->addWidget(selPos);
    editsLayout->addWidget(selVal);
    editsLayout->addWidget(_interpComboBox);

    QFrame *curveFrame = new QFrame;
    curveFrame->setFrameShape(QFrame::Panel);
    curveFrame->setFrameShadow(QFrame::Sunken);
    curveFrame->setLineWidth(1);
    QHBoxLayout *curveFrameLayout = new QHBoxLayout;
    curveFrameLayout->setMargin(0);
    CurveGraphicsView *curveView = new CurveGraphicsView;
    curveView->setFrameShape(QFrame::Panel);
    curveView->setFrameShadow(QFrame::Sunken);
    curveView->setLineWidth(1);
    curveView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    curveView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    _scene = new CCurveScene;
    curveView->setScene(_scene);
    curveView->setTransform(QTransform().scale(1, -1));
    curveView->setRenderHints(QPainter::Antialiasing);
    curveFrameLayout->addWidget(curveView);
    curveFrame->setLayout(curveFrameLayout);

    mainLayout->addWidget(edits);
    mainLayout->addWidget(curveFrame);
    if(expandable){
        QPushButton* expandButton=new QPushButton(">");
        expandButton->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding);
        expandButton->setFixedWidth(15);
        mainLayout->addWidget(expandButton);
        // open a the detail widget when clicked
        connect(expandButton, SIGNAL(clicked()), this, SLOT(openDetail()));
    }
    mainLayout->setStretchFactor(curveFrame,100);
    setLayout(mainLayout);

    // SIGNALS

    // when a user selects a cv, update the fields on left
    connect(_scene, SIGNAL(cvSelected(double, SeVec3d, T_INTERP)), this, SLOT(cvSelectedSlot(double, SeVec3d, T_INTERP)));
    // when a user selects a different interp, the curve has to redraw
    connect(_interpComboBox, SIGNAL(activated(int)), _scene, SLOT(interpChanged(int)));
    // when a user types a different position, the curve has to redraw
    connect(_selPosEdit, SIGNAL(returnPressed()), this, SLOT(selPosChanged()));
    connect(this, SIGNAL(selPosChangedSignal(double)), _scene, SLOT(selPosChanged(double)));
    // when a user selects a different color, the ramp has to redraw
    connect(_selValEdit, SIGNAL(selValChangedSignal(SeVec3d)), _scene, SLOT(selValChanged(SeVec3d)));
    connect(_selValEdit, SIGNAL(swatchChanged(QColor)), this, SLOT(internalSwatchChanged(QColor)));
    // when the widget is resized, resize the curve widget
    connect(curveView, SIGNAL(resizeSignal(int, int)), _scene, SLOT(resize(int, int)));
}
Example #26
0
void QCommonDialog::addButton(const std::string &text) {
	QPushButton *button = new QPushButton(myButtonGroup);
	button->setText(text.c_str());
	myButtonLayout->addWidget(button, 0, 0);
	connect(button, SIGNAL(clicked()), this, SLOT(accept()));
}
Example #27
0
TupCanvas::TupCanvas(QWidget *parent, Qt::WindowFlags flags, TupGraphicsScene *scene, 
                   const QPointF centerPoint, const QSize &screenSize, TupProject *project, double scaleFactor,
                   int angle, TupBrushManager *brushManager) : QFrame(parent, flags), k(new Private)
{
    setWindowTitle(tr("Tupi: Open 2D Magic"));
    setWindowIcon(QIcon(QPixmap(THEME_DIR + "icons/animation_mode.png")));

    k->scene = scene;
    k->size = project->dimension();
    k->currentColor = brushManager->penColor();
    k->brushManager = brushManager;
    k->project = project;

    graphicsView = new TupCanvasView(this, screenSize, k->size, project->bgColor());

    graphicsView->setScene(scene);
    graphicsView->centerOn(centerPoint);
    graphicsView->scale(scaleFactor, scaleFactor);
    graphicsView->rotate(angle);

    TImageButton *pencil = new TImageButton(QPixmap(THEME_DIR + "icons/pencil_big.png"), 40, this, true);
    pencil->setToolTip(tr("Pencil"));
    connect(pencil, SIGNAL(clicked()), this, SLOT(wakeUpPencil()));

    TImageButton *ink = new TImageButton(QPixmap(THEME_DIR + "icons/ink_big.png"), 40, this, true);
    ink->setToolTip(tr("Ink"));
    connect(ink, SIGNAL(clicked()), this, SLOT(wakeUpInk()));

    /*
    TImageButton *polyline = new TImageButton(QPixmap(THEME_DIR + "icons/polyline_big.png"), 40, this, true);
    polyline->setToolTip(tr("Polyline"));
    connect(polyline, SIGNAL(clicked()), this, SLOT(wakeUpPolyline()));
    */

    TImageButton *ellipse = new TImageButton(QPixmap(THEME_DIR + "icons/ellipse_big.png"), 40, this, true);
    ellipse->setToolTip(tr("Ellipse"));
    connect(ellipse, SIGNAL(clicked()), this, SLOT(wakeUpEllipse()));

    TImageButton *rectangle = new TImageButton(QPixmap(THEME_DIR + "icons/square_big.png"), 40, this, true);
    rectangle->setToolTip(tr("Rectangle"));
    connect(rectangle, SIGNAL(clicked()), this, SLOT(wakeUpRectangle()));

    TImageButton *images = new TImageButton(QPixmap(THEME_DIR + "icons/bitmap_big.png"), 40, this, true);
    images->setToolTip(tr("Images"));
    connect(images, SIGNAL(clicked()), this, SLOT(wakeUpLibrary()));

    TImageButton *objects = new TImageButton(QPixmap(THEME_DIR + "icons/selection_big.png"), 40, this, true);
    objects->setToolTip(tr("Object Selection"));
    connect(objects, SIGNAL(clicked()), this, SLOT(wakeUpObjectSelection()));

    TImageButton *nodes = new TImageButton(QPixmap(THEME_DIR + "icons/nodes_big.png"), 40, this, true);
    nodes->setToolTip(tr("Line Selection"));
    connect(nodes, SIGNAL(clicked()), this, SLOT(wakeUpNodeSelection()));

    TImageButton *trash = new TImageButton(QPixmap(THEME_DIR + "icons/delete_big.png"), 40, this, true);
    trash->setToolTip(tr("Delete Selection"));
    connect(trash, SIGNAL(clicked()), this, SLOT(wakeUpDeleteSelection()));

    TImageButton *zoomIn = new TImageButton(QPixmap(THEME_DIR + "icons/zoom_in_big.png"), 40, this, true);
    zoomIn->setToolTip(tr("Zoom In"));
    connect(zoomIn, SIGNAL(clicked()), this, SLOT(wakeUpZoomIn()));

    TImageButton *zoomOut = new TImageButton(QPixmap(THEME_DIR + "icons/zoom_out_big.png"), 40, this, true);
    zoomOut->setToolTip(tr("Zoom Out"));
    connect(zoomOut, SIGNAL(clicked()), this, SLOT(wakeUpZoomOut()));

    TImageButton *hand = new TImageButton(QPixmap(THEME_DIR + "icons/hand_big.png"), 40, this, true);
    hand->setToolTip(tr("Hand"));
    connect(hand, SIGNAL(clicked()), this, SLOT(wakeUpHand()));

    TImageButton *undo = new TImageButton(QPixmap(THEME_DIR + "icons/undo_big.png"), 40, this, true);
    undo->setToolTip(tr("Undo"));
    connect(undo, SIGNAL(clicked()), this, SLOT(undo()));

    TImageButton *redo = new TImageButton(QPixmap(THEME_DIR + "icons/redo_big.png"), 40, this, true);
    redo->setToolTip(tr("Redo"));
    connect(redo, SIGNAL(clicked()), this, SLOT(redo()));

    TImageButton *colors = new TImageButton(QPixmap(THEME_DIR + "icons/color_palette_big.png"), 40, this, true);
    colors->setToolTip(tr("Color Palette"));
    connect(colors, SIGNAL(clicked()), this, SLOT(colorDialog()));

    TImageButton *pen = new TImageButton(QPixmap(THEME_DIR + "icons/pen_properties.png"), 40, this, true);
    pen->setToolTip(tr("Pen Size"));
    connect(pen, SIGNAL(clicked()), this, SLOT(penDialog()));

    TImageButton *exposure = new TImageButton(QPixmap(THEME_DIR + "icons/exposure_sheet_big.png"), 40, this, true);
    exposure->setToolTip(tr("Exposure Sheet"));
    connect(exposure, SIGNAL(clicked()), this, SLOT(exposureDialog()));

    QBoxLayout *controls = new QBoxLayout(QBoxLayout::TopToBottom);
    controls->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
    controls->setContentsMargins(3, 3, 3, 3);
    controls->setSpacing(7);

    controls->addWidget(pencil);
    controls->addWidget(ink);
    // controls->addWidget(polyline);
    controls->addWidget(ellipse);
    controls->addWidget(rectangle);
    controls->addWidget(images);
    controls->addWidget(objects);
    controls->addWidget(nodes);
    controls->addWidget(trash);
    controls->addWidget(zoomIn);
    controls->addWidget(zoomOut);
    controls->addWidget(hand);

    controls->addWidget(undo);
    controls->addWidget(redo);
    controls->addWidget(colors);
    controls->addWidget(pen);
    controls->addWidget(exposure);

    QHBoxLayout *layout = new QHBoxLayout(this);
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setSpacing(2);
    layout->addLayout(controls);
    layout->addWidget(graphicsView);

    setLayout(layout);
}
Example #28
0
void MateriaPrimaDetail::setParam(const ParameterList& param)
{
	formulaTitleLabel->hide();
	formulaLabel->hide();
	label1->hide();
	label2->hide();
	lineEdit1->hide();
	lineEdit2->hide();

	nomeEdit->clear();
	tipoComboBox->setCurrentIndex(-1);
	precoEdit->clear();

	if (param["mode"] != "new")
	{
		disconnect(pushButton, SIGNAL(clicked()), this, SLOT(newClicked()));
		connect(pushButton, SIGNAL(clicked()), this, SLOT(editClicked()));
		pushButton->setText("&Salvar");
		query.prepare("UPDATE materiaprima SET nome = :nome, preco_por_kilo = :preco_por_kilo, tipo = :tipo WHERE cod_materiaprima = :cod");
		query.bindValue(":cod", param["cod"].toULongLong());

		QSqlQuery sql;
		sql.prepare("SELECT nome, tipo, preco_por_kilo FROM materia_prima WHERE cod_materiaprima=:cod_materia_prima");
		sql.bindValue("cod_materia_prima", param["cod"].toULongLong());

		if (!sql.exec())
		{
			QMessageBox::warning(this, "Admin",
				QString::fromUtf8("Erro na consulta\1%1").arg(query.lastError().text()));
		}

		else
		{
			sql.last();

			nomeEdit->setText(sql.value(0).toString());
			tipoComboBox->setCurrentIndex(sql.value(1).toInt());
			precoEdit->setText(sql.value(2).toString());
		}

		if (param["mode"] == "view")
		{
			setWindowTitle(QString::fromUtf8("Visualizando registro [%1]").arg(sql.value(0).toString()));

			nomeEdit->setReadOnly(true);
			precoEdit->setReadOnly(true);
			pushButton->hide();
			cancelButton->setText("Fe&char");
		} else {
			setWindowTitle(QString::fromUtf8("Editando registro [%1]").arg(sql.value(0).toString()));
		}
	}

	else
	{
		setWindowTitle(QString::fromUtf8("Novo registro"));
		disconnect(pushButton, SIGNAL(clicked()), this, SLOT(editClicked()));
		connect(pushButton, SIGNAL(clicked()), this, SLOT(newClicked()));
		pushButton->setText("&Inserir");
		query.prepare("INSERT INTO materiaprima (nome, preco_por_kilo, tipo) VALUES (:nome, :preco_por_kilo, :tipo)");
	}
}
Example #29
0
QtHighlightEditor::QtHighlightEditor(QtSettingsProvider* settings, QWidget* parent)
	: QWidget(parent), settings_(settings), previousRow_(-1)
{
	ui_.setupUi(this);

	connect(ui_.listWidget, SIGNAL(currentRowChanged(int)), SLOT(onCurrentRowChanged(int)));

	connect(ui_.newButton, SIGNAL(clicked()), SLOT(onNewButtonClicked()));
	connect(ui_.deleteButton, SIGNAL(clicked()), SLOT(onDeleteButtonClicked()));

	connect(ui_.buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), SLOT(onApplyButtonClick()));
	connect(ui_.buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), SLOT(onCancelButtonClick()));
	connect(ui_.buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), SLOT(onOkButtonClick()));
	connect(ui_.buttonBox->button(QDialogButtonBox::RestoreDefaults), SIGNAL(clicked()), SLOT(onResetToDefaultRulesClicked()));

	connect(ui_.noColorRadio, SIGNAL(clicked()), SLOT(colorOtherSelect()));
	connect(ui_.customColorRadio, SIGNAL(clicked()), SLOT(colorCustomSelect()));

	connect(ui_.noSoundRadio, SIGNAL(clicked()), SLOT(soundOtherSelect()));
	connect(ui_.defaultSoundRadio, SIGNAL(clicked()), SLOT(soundOtherSelect()));
	connect(ui_.customSoundRadio, SIGNAL(clicked()), SLOT(soundCustomSelect()));

	/* replace the static line-edit control with the roster autocompleter */
	ui_.dummySenderName->setVisible(false);
	jid_ = new QtSuggestingJIDInput(this, settings);
	ui_.senderName->addWidget(jid_);
	jid_->onUserSelected.connect(boost::bind(&QtHighlightEditor::handleOnUserSelected, this, _1));

	/* handle autocomplete */
	connect(jid_, SIGNAL(textEdited(QString)), SLOT(handleContactSuggestionRequested(QString)));

	/* we need to be notified if any of the state changes so that we can update our textual rule description */
	connect(ui_.chatRadio, SIGNAL(clicked()), SLOT(widgetClick()));
	connect(ui_.roomRadio, SIGNAL(clicked()), SLOT(widgetClick()));
	connect(ui_.nickIsKeyword, SIGNAL(clicked()), SLOT(widgetClick()));
	connect(ui_.allMsgRadio, SIGNAL(clicked()), SLOT(widgetClick()));
	connect(ui_.senderRadio, SIGNAL(clicked()), SLOT(widgetClick()));
	connect(jid_, SIGNAL(textChanged(const QString&)), SLOT(widgetClick()));
	connect(ui_.keywordRadio, SIGNAL(clicked()), SLOT(widgetClick()));
	connect(ui_.keyword, SIGNAL(textChanged(const QString&)), SLOT(widgetClick()));
	connect(ui_.matchPartialWords, SIGNAL(clicked()), SLOT(widgetClick()));
	connect(ui_.matchCase, SIGNAL(clicked()), SLOT(widgetClick()));
	connect(ui_.noColorRadio, SIGNAL(clicked()), SLOT(widgetClick()));
	connect(ui_.customColorRadio, SIGNAL(clicked()), SLOT(widgetClick()));
	connect(ui_.noSoundRadio, SIGNAL(clicked()), SLOT(widgetClick()));
	connect(ui_.defaultSoundRadio, SIGNAL(clicked()), SLOT(widgetClick()));
	connect(ui_.customSoundRadio, SIGNAL(clicked()), SLOT(widgetClick()));

	/* allow selection of a custom sound file */
	connect(ui_.soundFileButton, SIGNAL(clicked()), SLOT(selectSoundFile()));

	/* allowing reordering items */
	connect(ui_.moveUpButton, SIGNAL(clicked()), this, SLOT(onUpButtonClicked()));
	connect(ui_.moveDownButton, SIGNAL(clicked()), this, SLOT(onDownButtonClicked()));

	setWindowTitle(tr("Highlight Rules"));
}
void ClickableLabel::mouseReleaseEvent ( QMouseEvent * event )
{
	emit clicked();
}