导入文件 ,解编lis wis等中文路径无法导入问题。
改变窗口获取高度逻辑,用于绘图渲染
This commit is contained in:
parent
c699f66026
commit
73f6c3171d
|
|
@ -741,9 +741,9 @@ bool ImportDataDialog::SelectAndDeleteWellLog(int iRow,InterfaceWidget *pCurren
|
|||
char *outfile = new char[outputfilename.toStdString().size()+300];
|
||||
strcpy(outfile, outputfilename.toStdString().c_str());
|
||||
|
||||
char *logfilename = new char[m_FilePath.toStdString().size()+1];
|
||||
//char *logfilename = new char[m_FilePath.toStdString().size()+1];
|
||||
|
||||
strcpy(logfilename, m_FilePath.toStdString().c_str());
|
||||
//strcpy(logfilename, m_FilePath.toStdString().c_str());
|
||||
|
||||
QLineEdit * xEdit=pCurrentInterfaceWidget->GetXCodeLineEdit();
|
||||
QLineEdit * yEdit=pCurrentInterfaceWidget->GetYCodeLineEdit();
|
||||
|
|
@ -767,7 +767,7 @@ bool ImportDataDialog::SelectAndDeleteWellLog(int iRow,InterfaceWidget *pCurren
|
|||
|
||||
// QString strCh(logfilename); // 汉字路径转换
|
||||
// // QString strChOut(outfile); // 汉字路径转换
|
||||
if(((InterIConvertor*)(pCurrentInterfaceWidget->m_pConvertor))->Transfer(/*strCh.toLocal8Bit().data()*//*UTF8ToGBK(logfilename).data()*/logfilename,outfile/*strChOut.toLocal8Bit().data()*/,&OutCurveNo[0],&OutCurve[0],&strChineseName[0],&strUnit[0],iRow))
|
||||
if(((InterIConvertor*)(pCurrentInterfaceWidget->m_pConvertor))->Transfer(UTF8ToGBK(m_FilePath).data(),outfile/*strChOut.toLocal8Bit().data()*/,&OutCurveNo[0],&OutCurve[0],&strChineseName[0],&strUnit[0],iRow))
|
||||
{
|
||||
MyWelllogRound *wellRound=pCurrentInterfaceWidget->m_pConvertor->GetWellLogRoundInfo();
|
||||
if(wellRound) {
|
||||
|
|
@ -782,7 +782,7 @@ bool ImportDataDialog::SelectAndDeleteWellLog(int iRow,InterfaceWidget *pCurren
|
|||
delete OutCurve[i];
|
||||
delete strUnit[i];
|
||||
}
|
||||
delete []logfilename;
|
||||
//delete []logfilename;
|
||||
delete []outfile;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,10 +141,11 @@ bool InterIConvertor::Init()
|
|||
bool InterIConvertor::IsSupport( const QString &filename )
|
||||
{
|
||||
IConvertor::IsSupport(filename);
|
||||
string tempStr=filename.toStdString();
|
||||
char *filePath=const_cast<char*>(tempStr.c_str());
|
||||
// string tempStr=filename.toStdString();
|
||||
// char *filePath=const_cast<char*>(tempStr.c_str());
|
||||
// QString strCh(filePath); // 汉字路径转换
|
||||
int Value= ScanLogFile(filePath/*UTF8ToGBK(filePath).data()*//*strCh.toLocal8Bit().data()*/,m_fileMessage,&m_vCurverName[0],&m_vCurverUnit[0]);
|
||||
QByteArray bt = UTF8ToGBK(filename);
|
||||
int Value= ScanLogFile(bt.data(),m_fileMessage,&m_vCurverName[0],&m_vCurverUnit[0]);
|
||||
m_CurveData.Curve_Num=Value;
|
||||
if(Value<=0) return 0;//ww
|
||||
return Value;
|
||||
|
|
|
|||
|
|
@ -1124,7 +1124,7 @@ QString GBKToUTF8(const QByteArray& gbkData) {
|
|||
// UTF-8 转 GBK
|
||||
QByteArray UTF8ToGBK(const QString& utf8Str) {
|
||||
// 此处编码 库加了#pragma execution_character_set("utf-8") ,是否正确???
|
||||
return utf8Str.toStdString().c_str();
|
||||
//return utf8Str.toStdString().c_str();
|
||||
QTextCodec* gbkCodec = QTextCodec::codecForName("GBK");
|
||||
if (!gbkCodec) {
|
||||
return QByteArray();
|
||||
|
|
|
|||
|
|
@ -156,6 +156,24 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
|||
QMainWindow::closeEvent( event );
|
||||
}
|
||||
|
||||
QScreen* getBestScreen() {
|
||||
// 优先使用鼠标所在屏幕
|
||||
QScreen* screen = QGuiApplication::screenAt(QCursor::pos());
|
||||
if (screen) return screen;
|
||||
|
||||
// 其次使用主屏幕
|
||||
screen = QGuiApplication::primaryScreen();
|
||||
if (screen) return screen;
|
||||
|
||||
// 最后使用第一个屏幕
|
||||
QList<QScreen*> screens = QGuiApplication::screens();
|
||||
if (!screens.isEmpty()) {
|
||||
return screens.first();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void MainWindow::ReadConfig()
|
||||
{
|
||||
int iIndex;
|
||||
|
|
@ -197,15 +215,14 @@ void MainWindow::ReadConfig()
|
|||
}
|
||||
else
|
||||
{
|
||||
if (iHeight < QApplication::desktop()->width())
|
||||
QScreen* sr = getBestScreen();
|
||||
if (sr)
|
||||
{
|
||||
iHeight = QApplication::desktop()->width();
|
||||
if (iHeight < sr->size().width())
|
||||
iHeight = sr->size().width();
|
||||
if (iHeight < sr->size().height())
|
||||
iHeight = sr->size().height();
|
||||
}
|
||||
if(iHeight < QApplication::desktop()->height())
|
||||
{
|
||||
//不能低于分辨率
|
||||
iHeight = QApplication::desktop()->height();
|
||||
}
|
||||
}
|
||||
|
||||
g_iHeight_MyCustom = iHeight;
|
||||
|
|
@ -228,6 +245,16 @@ void MainWindow::ReadConfig()
|
|||
g_iPageStep = iPageStep;
|
||||
}
|
||||
|
||||
void MainWindow::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
int nhei = event->size().width();
|
||||
if (nhei < event->size().height())
|
||||
{
|
||||
nhei = event->size().height();
|
||||
}
|
||||
g_iHeight_MyCustom = nhei;
|
||||
}
|
||||
|
||||
void MainWindow::loadStyle(const QString &qssFile)
|
||||
{
|
||||
//加载样式表
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ public:
|
|||
public:
|
||||
virtual void closeEvent(QCloseEvent *event);
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
//样式
|
||||
void loadStyle(const QString &qssFile);
|
||||
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ int CLisConvertor::ScanLogFile(char *FileName,char *Message,char **CurveName,ch
|
|||
strcpy(szTemp, "[LIS]");
|
||||
int pos1=GetBeginPosit(FileName,szTemp);
|
||||
mWellDynamicInfo=&WellDynamicInfo;
|
||||
if((fp=fopen(/*FileName*/UTF8ToGBK(FileName),"rb"))==NULL) {
|
||||
if((fp=fopen(FileName,"rb"))==NULL) {
|
||||
QMessageBox::information(NULL,FileName,"Open Not File:",QMessageBox::Ok);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -592,15 +592,15 @@ bool CLisConvertor::Transfer(char *FileName,char *outfile,int *OutCurveNo,char *
|
|||
|
||||
if(xCoord != -99999 && yCoord != -99999)
|
||||
{
|
||||
char buf[256];
|
||||
QString strWellInfo= "井基本信息";
|
||||
strcpy(buf, strWellInfo.toLocal8Bit().data());
|
||||
int index = m_SlfFile.FindObjectIndex(buf);
|
||||
int indexSTable = m_SlfFile.OpenSTATIC(buf);
|
||||
//char buf[256];
|
||||
const char* strWellInfo= "井基本信息";
|
||||
//strcpy(buf, strWellInfo.toLocal8Bit().data());
|
||||
int index = m_SlfFile.FindObjectIndex(strWellInfo);
|
||||
int indexSTable = m_SlfFile.OpenSTATIC(strWellInfo);
|
||||
|
||||
m_SlfFile.WriteTable(indexSTable, 1, &WellStaticInfo);
|
||||
m_SlfFile.CloseTable(indexSTable);
|
||||
int indexDTable=m_SlfFile.OpenDYNAMIC(buf);
|
||||
int indexDTable=m_SlfFile.OpenDYNAMIC(strWellInfo);
|
||||
m_SlfFile.WriteTable(indexDTable, 1, &WellDynamicInfo);
|
||||
m_SlfFile.CloseTable(indexDTable);
|
||||
}
|
||||
|
|
@ -736,7 +736,7 @@ bool CLisConvertor::Transfer(char *FileName,char *outfile,int *OutCurveNo,char *
|
|||
// format spcification number
|
||||
int nfmsp=0 ,nfrmob;
|
||||
|
||||
if((fp=fopen(UTF8ToGBK(FileName),"rb")) == NULL) {
|
||||
if((fp=fopen(FileName,"rb")) == NULL) {
|
||||
QMessageBox::information(NULL,FileName,"Open Not File:",QMessageBox::Ok);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user