예제 #1
0
void FontBuilder::on_addBtn_clicked()
{
    if(ui->lineEdit->text().isEmpty()) {
        QMessageBox::warning(this, tr("Config Name Needed!"),
                             tr("You must input a config name!"),
                             QMessageBox::Ok, QMessageBox::Ok);
        ui->lineEdit->setFocus();
    }
    else {
        int row = m_model->rowCount();
        QString setName = ui->lineEdit->text();
        if(m_model->stringList().count(setName) > 0) {
            QMessageBox::warning(this, tr("Config Name Existed!"),
                                 tr("Config Name \"%1\" is existed!")
                                 .arg(setName),
                                 QMessageBox::Ok, QMessageBox::Ok);
            ui->lineEdit->setFocus();
        }
        else {
            m_model->insertRows(row, 1);

            QModelIndex index = m_model->index(row);
            m_model->setData(index, setName);
            saveIni(setName);
            ui->lineEdit->setText("");
        }

    }
}
예제 #2
0
파일: frmlog.cpp 프로젝트: hominlinx/cppbed
void frmLog::onSetMaxLine(int maxLog, int maxMonitor)
{
	mMaxLog = maxLog;
	mMaxMonitor = maxMonitor;

	applyChangeToUI();
	saveIni();
}
예제 #3
0
void MainWindow::setResourcePath(const QString &path)
{
    LOG("配置资源目录:" + path);
    ConfigFile::getInstance()->setResourcesPath(path);
    ui->fileTreeView->setRootIndex(model.setRootPath(path));
    ui->fileTreeView->setColumnHidden( 0, false);
    saveIni();
}
 void sm::BoostPropertyTree::save(const boost::filesystem::path& fileName) const {
   switch(getFileFormatAndThrowIfUnknown(fileName)){
     case XML:
       saveXml(fileName);
       break;
     case INI:
       saveIni(fileName);
       break;
     case JSON:
       saveJson(fileName);
       break;
     case INFO:
       saveInfo(fileName);
       break;
   }
 }
예제 #5
0
void FontBuilder::on_saveBtn_clicked()
{
    if(m_model->rowCount() == 0) {
        QMessageBox::warning(this, tr("No config available!"),
                             tr("There is no config available to save!"),
                             QMessageBox::Ok, QMessageBox::Ok);
    }
    else {
        QModelIndexList indexList = ui->listView->selectionModel()->selectedIndexes();
        if(indexList.isEmpty()) {
            QMessageBox::warning(this, tr("No Config Selected!"),
                                 tr("There is no config being selected!"),
                                 QMessageBox::Ok, QMessageBox::Ok);
        }
        else {
            QString setName = m_model->data(indexList[0], Qt::EditRole).toString();
            saveIni(setName);
        }
    }
}
예제 #6
0
void MainWindow::closeEvent(QCloseEvent *evt)
{
    saveIni();
    evt->accept();
}
예제 #7
0
void FontBuilder::closeEvent(QCloseEvent *event)
{
    saveIni("default");
    QMainWindow::closeEvent(event);
}
예제 #8
0
MRESULT EXPENTRY wpCD(HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2)
{
	switch (msg)
	{
		case WM_INITDLG:
		{
			ULONG rc, i;
			HFILE CDDevice;
			ULONG action;
			ULONG len;
			struct
			{
				USHORT CountCD;
				USHORT FirstCD;
			} CDInfo;
			FIELDINFO *firstFieldInfo, *posFieldInfo, *splitFieldInfo;
			FIELDINFOINSERT fieldInfoInsert;
			CNRINFO cnrInfo;
			cnrInfo.cb = sizeof(cnrInfo);

			firstFieldInfo = posFieldInfo = allocaFieldInfo(hwnd, CT_TRACK, NUM_FIELDS);
			posFieldInfo->flData = CFA_BITMAPORICON | CFA_HORZSEPARATOR | CFA_SEPARATOR;
			posFieldInfo->flTitle = CFA_CENTER;
			posFieldInfo->pTitleData = "Icon";
			posFieldInfo->offStruct = FIELDOFFSET(RECORDCORE,hptrIcon);
			fieldInfo[0] = posFieldInfo;

			posFieldInfo = posFieldInfo->pNextFieldInfo;
			posFieldInfo->flData = CFA_STRING | CFA_HORZSEPARATOR | CFA_SEPARATOR;
			posFieldInfo->flTitle = CFA_CENTER;
			posFieldInfo->pTitleData = "Filename";
			posFieldInfo->offStruct = FIELDOFFSET(RECORDCORE,pszIcon);
			fieldInfo[1] = posFieldInfo;

			cnrInfo.pFieldInfoLast = posFieldInfo;

			posFieldInfo = posFieldInfo->pNextFieldInfo;
			posFieldInfo->flData = CFA_ULONG | CFA_HORZSEPARATOR | CFA_SEPARATOR;
			posFieldInfo->flTitle = CFA_CENTER;
			posFieldInfo->pTitleData = "Track #";
			posFieldInfo->offStruct = FIELDOFFSET(CDTRACKRECORD,track);
			fieldInfo[2] = posFieldInfo;

			posFieldInfo = posFieldInfo->pNextFieldInfo;
			posFieldInfo->flData = CFA_STRING | CFA_HORZSEPARATOR | CFA_SEPARATOR | CFA_FIREADONLY;
			posFieldInfo->flTitle = CFA_CENTER;
			posFieldInfo->pTitleData = "Type";
			posFieldInfo->offStruct = FIELDOFFSET(CDTRACKRECORD,typepointer);
			fieldInfo[3] = posFieldInfo;

			posFieldInfo = posFieldInfo->pNextFieldInfo;
			posFieldInfo->flData = CFA_STRING | CFA_HORZSEPARATOR | CFA_SEPARATOR | CFA_FIREADONLY;
			posFieldInfo->flTitle = CFA_CENTER;
			posFieldInfo->pTitleData = "Time";
			posFieldInfo->offStruct = FIELDOFFSET(CDTRACKRECORD,timepointer);
			fieldInfo[4] = posFieldInfo;

			posFieldInfo = posFieldInfo->pNextFieldInfo;
			posFieldInfo->flData = CFA_ULONG | CFA_HORZSEPARATOR | CFA_SEPARATOR;
			posFieldInfo->flTitle = CFA_CENTER;
			posFieldInfo->pTitleData = "Size";
			posFieldInfo->offStruct = FIELDOFFSET(CDTRACKRECORD,size);
			fieldInfo[5] = posFieldInfo;

			posFieldInfo = posFieldInfo->pNextFieldInfo;
			posFieldInfo->flData = CFA_ULONG | CFA_HORZSEPARATOR | CFA_SEPARATOR;
			posFieldInfo->flTitle = CFA_CENTER;
			posFieldInfo->pTitleData = "MP3 Size";
			posFieldInfo->offStruct = FIELDOFFSET(CDTRACKRECORD,mp3size);
			fieldInfo[6] = posFieldInfo;

			posFieldInfo = posFieldInfo->pNextFieldInfo;
			posFieldInfo->flData = CFA_STRING | CFA_HORZSEPARATOR | CFA_SEPARATOR;
			posFieldInfo->flTitle = CFA_CENTER;
			posFieldInfo->pTitleData = "Title";
			posFieldInfo->offStruct = FIELDOFFSET(CDTRACKRECORD,titleptr);
			fieldInfo[7] = posFieldInfo;

			posFieldInfo = posFieldInfo->pNextFieldInfo;
			posFieldInfo->flData = CFA_STRING | CFA_HORZSEPARATOR | CFA_SEPARATOR;
			posFieldInfo->flTitle = CFA_CENTER;
			posFieldInfo->pTitleData = "Artist";
			posFieldInfo->offStruct = FIELDOFFSET(CDTRACKRECORD,artistptr);
			fieldInfo[8] = posFieldInfo;

			posFieldInfo = posFieldInfo->pNextFieldInfo;
			posFieldInfo->flData = CFA_STRING | CFA_HORZSEPARATOR | CFA_SEPARATOR;
			posFieldInfo->flTitle = CFA_CENTER;
			posFieldInfo->pTitleData = "Album";
			posFieldInfo->offStruct = FIELDOFFSET(CDTRACKRECORD,albumptr);
			fieldInfo[9] = posFieldInfo;

			posFieldInfo = posFieldInfo->pNextFieldInfo;
			posFieldInfo->flData = CFA_STRING | CFA_HORZSEPARATOR | CFA_SEPARATOR;
			posFieldInfo->flTitle = CFA_CENTER;
			posFieldInfo->pTitleData = "Year";
			posFieldInfo->offStruct = FIELDOFFSET(CDTRACKRECORD,yearptr);
			fieldInfo[10] = posFieldInfo;

			posFieldInfo = posFieldInfo->pNextFieldInfo;
			posFieldInfo->flData = CFA_STRING | CFA_HORZSEPARATOR | CFA_SEPARATOR;
			posFieldInfo->flTitle = CFA_CENTER;
			posFieldInfo->pTitleData = "Genre";
			posFieldInfo->offStruct = FIELDOFFSET(CDTRACKRECORD,genreptr);
			fieldInfo[11] = posFieldInfo;

			posFieldInfo = posFieldInfo->pNextFieldInfo;
			posFieldInfo->flData = CFA_STRING | CFA_HORZSEPARATOR | CFA_SEPARATOR;
			posFieldInfo->flTitle = CFA_CENTER;
			posFieldInfo->pTitleData = "Comment";
			posFieldInfo->offStruct = FIELDOFFSET(CDTRACKRECORD,commentptr);
			fieldInfo[12] = posFieldInfo;

			fieldInfoInsert.cb = sizeof(fieldInfoInsert);
			fieldInfoInsert.pFieldInfoOrder = (FIELDINFO *) CMA_FIRST;
			fieldInfoInsert.fInvalidateFieldInfo = TRUE;
			fieldInfoInsert.cFieldInfoInsert = NUM_FIELDS;

			insertFieldInfo(hwnd, CT_TRACK, firstFieldInfo, &fieldInfoInsert);

			cnrInfo.xVertSplitbar = 100;
			cnrInfo.flWindowAttr = CV_DETAIL | CA_DETAILSVIEWTITLES;
			WinSendDlgItemMsg(hwnd,CT_TRACK,CM_SETCNRINFO, MPFROMP(&cnrInfo),
				MPFROMLONG(CMA_PFIELDINFOLAST | CMA_XVERTSPLITBAR | CMA_FLWINDOWATTR));


			loadConfig(CFGFILE, &grabbers, &countGrabbers);
			for(i = 0; i < countGrabbers; i++)
				insertItemText(hwnd,CB_GRABBER,LIT_END,grabbers[i].id);
			selectItem(hwnd,CB_GRABBER,0);

			setText(hwnd, EF_TITLE, "Title");

			/* wohw, this is too powerful, need cooling */

			len = sizeof(CDInfo);
			if(!DosOpen("\\DEV\\CD-ROM2$", &CDDevice, &action, 0,
							FILE_NORMAL, OPEN_ACTION_OPEN_IF_EXISTS,
							OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, NULL))
			{
				if(!DosDevIOCtl(CDDevice, 0x82, 0x60, NULL, 0, NULL, &CDInfo, len, &len))
				{
					for(i = 0; i < CDInfo.CountCD; i++)
					{
						char driveLetter[3] = { (char) ('A' + CDInfo.FirstCD + i), ':', 0};
						insertItemText(hwnd,CB_DRIVE,LIT_END,driveLetter);
					}
				}
				DosClose(CDDevice);
			}

			selectItem(hwnd,CB_DRIVE,0);

			wpCT = WinSubclassWindow(WinWindowFromID(hwnd,CT_TRACK),wpCTTrack);

			dataIco = WinLoadPointer(HWND_DESKTOP, NULLHANDLE, ICO_DATA);
			trackIco = WinLoadPointer(HWND_DESKTOP, NULLHANDLE, ICO_TRACK);
			loadIni(hwnd);
			return 0;
		}
		case WM_COMMAND:
			return processCommand(hwnd,mp1,mp2);
		case WM_CONTROL:
			return processControl(hwnd,mp1,mp2);
		case WM_ADJUSTFRAMEPOS:
		{
			SWP *pos = (SWP*) PVOIDFROMMP(mp1);
			static int bitRateCheck = 0;
			if(pos->fl & SWP_SIZE)
			{
				SWP ctpos;
				WinQueryWindowPos(WinWindowFromID(hwnd, CT_TRACK), &ctpos);
				WinSetWindowPos  (WinWindowFromID(hwnd, CT_TRACK), 0, 0, ctpos.y,
									  pos->cx, pos->cy - ctpos.y,
									  SWP_SIZE | SWP_SHOW | SWP_MOVE);
			}

			if((pos->fl & SWP_SHOW) && bitRateChanged != bitRateCheck)
			{
				bitRateCheck = bitRateChanged;
				refreshFieldInfo(hwnd, CT_TRACK);
			}
			break;
		}

		case WM_MENUEND:
			removeSourceEmphasis(HWNDFROMMP(mp2),&sourceEmphasisInfo);
			return 0;

		case WM_CLOSE:
		{
			WinDestroyPointer(dataIco);
			WinDestroyPointer(trackIco);
			free(grabbers);
			saveIni(hwnd);

			/* delete all current records */
			CDTRACKRECORD *record = (CDTRACKRECORD *) enumRecords(hwnd, CT_TRACK, NULL, CMA_FIRST);
			while(record && record != (CDTRACKRECORD *) -1)
			{
				free(record->record.pszIcon);
				record = (CDTRACKRECORD *) enumRecords(hwnd, CT_TRACK, (RECORDCORE *) record, CMA_NEXT);
			}

			removeRecords(hwnd, CT_TRACK, NULL, 0);

			removeFieldInfo(hwnd,CT_TRACK, NULL, 0);
			return 0;
		}

		case WM_CHAR:
			if(SHORT2FROMMP(mp2) == VK_ESC)
				return 0;
			else
				break;

		/* back from worker thread */
		case DLGCD_REFRESH:
			dlgcd_refresh2(mp1,mp2);
			return 0;

      case CDDB_FUZZYMATCH:
		{
			CDDBQUERY_DATA *matches = (CDDBQUERY_DATA *) mp1,
								*chosen	= (CDDBQUERY_DATA *) mp2;
         FUZZYMATCHCREATEPARAMS data = {matches,chosen};

			WinDlgBox(HWND_DESKTOP, hwnd, wpMatch, NULLHANDLE, DLG_MATCH, &data);
              
			return 0;
		}

	}

	return WinDefDlgProc( hwnd, msg, mp1, mp2 );
}