mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-07-06 15:37:45 +02:00
2021-06-21 Fred Gleason <fredg@paravelsystems.com>
* Added 'RDMainWindow' to rdlogedit(1). Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
dea256d14d
commit
fbfa861b2b
@ -21934,3 +21934,5 @@
|
||||
* Removed 'RDCartFilter::loadConfig()' and 'RDCartFilter::saveConfig()'
|
||||
methods.
|
||||
* Added 'RDMainWindow' to rdlibrary(1).
|
||||
2021-06-21 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added 'RDMainWindow' to rdlogedit(1).
|
||||
|
@ -558,16 +558,12 @@ EditLog::~EditLog()
|
||||
|
||||
QSize EditLog::sizeHint() const
|
||||
{
|
||||
printf("sizeHint(%d,%d)\n",global_logedit_window_size.width(),
|
||||
global_logedit_window_size.height());
|
||||
return global_logedit_window_size;
|
||||
}
|
||||
|
||||
|
||||
QSizePolicy EditLog::sizePolicy() const
|
||||
{
|
||||
return QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
}
|
||||
|
||||
|
||||
int EditLog::exec()
|
||||
{
|
||||
QString username;
|
||||
|
@ -47,7 +47,6 @@ class EditLog : public RDDialog
|
||||
QWidget *parent=0);
|
||||
~EditLog();
|
||||
QSize sizeHint() const;
|
||||
QSizePolicy sizePolicy() const;
|
||||
|
||||
public slots:
|
||||
int exec();
|
||||
|
@ -28,7 +28,7 @@
|
||||
// Global Resources
|
||||
//
|
||||
extern bool global_import_running;
|
||||
extern QSize global_top_window_size;
|
||||
//extern QSize global_top_window_size;
|
||||
extern QSize global_logedit_window_size;
|
||||
extern int global_start_time_style;
|
||||
|
||||
|
@ -38,12 +38,12 @@
|
||||
// Global Resources
|
||||
//
|
||||
bool global_import_running=false;
|
||||
QSize global_top_window_size;
|
||||
//QSize global_top_window_size;
|
||||
QSize global_logedit_window_size;
|
||||
int global_start_time_style;
|
||||
|
||||
MainWidget::MainWidget(RDConfig *c,QWidget *parent)
|
||||
: RDWidget(c,parent)
|
||||
: RDMainWindow("rdlogedit",c)
|
||||
{
|
||||
QString err_msg;
|
||||
|
||||
@ -57,7 +57,6 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent)
|
||||
//
|
||||
setMinimumWidth(RDLOGEDIT_DEFAULT_WIDTH);
|
||||
setMinimumHeight(RDLOGEDIT_DEFAULT_HEIGHT);
|
||||
LoadPositions();
|
||||
|
||||
//
|
||||
// Open the Database
|
||||
@ -183,12 +182,14 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent)
|
||||
tr("User")+": ["+tr("Unknown")+"]");
|
||||
|
||||
log_resize=true;
|
||||
|
||||
loadSettings(true);
|
||||
}
|
||||
|
||||
|
||||
QSize MainWidget::sizeHint() const
|
||||
{
|
||||
return global_top_window_size;
|
||||
return QSize(RDLOGEDIT_DEFAULT_WIDTH,RDLOGEDIT_DEFAULT_HEIGHT);
|
||||
}
|
||||
|
||||
|
||||
@ -608,11 +609,17 @@ void MainWidget::notificationReceivedData(RDNotification *notify)
|
||||
|
||||
void MainWidget::quitMainWidget()
|
||||
{
|
||||
SavePositions();
|
||||
saveSettings();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
quitMainWidget();
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
if((log_log_view==NULL)||(!log_resize)) {
|
||||
@ -630,8 +637,6 @@ void MainWidget::resizeEvent(QResizeEvent *e)
|
||||
log_track_button->setGeometry(300,size().height()-55,80,50);
|
||||
log_report_button->setGeometry(400,size().height()-55,80,50);
|
||||
log_close_button->setGeometry(size().width()-90,size().height()-55,80,50);
|
||||
|
||||
global_top_window_size=e->size();
|
||||
}
|
||||
|
||||
|
||||
@ -709,44 +714,6 @@ int main(int argc,char *argv[])
|
||||
RDConfig *config=new RDConfig();
|
||||
config->load();
|
||||
MainWidget *w=new MainWidget(config);
|
||||
w->setGeometry(QRect(QPoint(w->geometry().x(),w->geometry().y()),
|
||||
w->sizeHint()));
|
||||
w->show();
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::LoadPositions() const
|
||||
{
|
||||
QString filename=RDHomeDir()+"/"+RDLOGEDIT_POSITION_FILENAME;
|
||||
RDProfile *p=new RDProfile();
|
||||
p->setSource(filename);
|
||||
global_top_window_size=
|
||||
QSize(p->intValue("RDLogEdit","TopWindowWidth",RDLOGEDIT_DEFAULT_WIDTH),
|
||||
p->intValue("RDLogEdit","TopWindowHeight",RDLOGEDIT_DEFAULT_HEIGHT));
|
||||
global_logedit_window_size=
|
||||
QSize(p->intValue("RDLogEdit","LogeditWindowWidth",RDLOGEDIT_EDITLOG_DEFAULT_WIDTH),
|
||||
p->intValue("RDLogEdit","LogeditWindowHeight",RDLOGEDIT_EDITLOG_DEFAULT_HEIGHT));
|
||||
global_start_time_style=p->intValue("RDLogEdit","StartTimeStyle",0);
|
||||
|
||||
delete p;
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::SavePositions() const
|
||||
{
|
||||
QString filename=RDHomeDir()+"/"+RDLOGEDIT_POSITION_FILENAME;
|
||||
QString temp_filename=RDHomeDir()+"/"+RDLOGEDIT_POSITION_FILENAME+"-temp";
|
||||
FILE *f=NULL;
|
||||
|
||||
if((f=fopen(temp_filename.toUtf8(),"w"))!=NULL) {
|
||||
fprintf(f,"[RDLogEdit]\n");
|
||||
fprintf(f,"TopWindowWidth=%d\n",global_top_window_size.width());
|
||||
fprintf(f,"TopWindowHeight=%d\n",global_top_window_size.height());
|
||||
fprintf(f,"LogeditWindowWidth=%d\n",global_logedit_window_size.width());
|
||||
fprintf(f,"LogeditWindowHeight=%d\n",global_logedit_window_size.height());
|
||||
fprintf(f,"StartTimeStyle=%d\n",global_start_time_style);
|
||||
fclose(f);
|
||||
rename(temp_filename.toUtf8(),filename.toUtf8());
|
||||
}
|
||||
}
|
||||
|
@ -26,16 +26,17 @@
|
||||
#include <rdlog_line.h>
|
||||
#include <rdlogfilter.h>
|
||||
#include <rdloglistmodel.h>
|
||||
#include <rdmainwindow.h>
|
||||
#include <rdnotification.h>
|
||||
#include <rdtableview.h>
|
||||
#include <rdwidget.h>
|
||||
|
||||
#define RDLOGEDIT_POSITION_FILENAME ".rdlogedit"
|
||||
#define RDLOGEDIT_DEFAULT_WIDTH 640
|
||||
#define RDLOGEDIT_DEFAULT_HEIGHT 480
|
||||
#define RDLOGEDIT_POSITION_FILENAME ".rdlogedit"
|
||||
#define RDLOGEDIT_USAGE "\n"
|
||||
|
||||
class MainWidget : public RDWidget
|
||||
class MainWidget : public RDMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@ -60,14 +61,13 @@ class MainWidget : public RDWidget
|
||||
void quitMainWidget();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *e);
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
|
||||
private:
|
||||
void SendNotification(RDNotification::Action action,const QString &logname);
|
||||
void LockList();
|
||||
void UnlockList();
|
||||
void LoadPositions() const;
|
||||
void SavePositions() const;
|
||||
QModelIndex SingleSelectedRow() const;
|
||||
QString log_filename;
|
||||
QString log_import_path;
|
||||
|
Loading…
x
Reference in New Issue
Block a user